diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt index 837ae86..2f1bb58 100644 --- a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt @@ -276,7 +276,7 @@ //先存本地 lifecycleScope.launch { withContext(Dispatchers.IO) { - DataBaseManager.get.insertSmallLabel(smallLabelData) +// DataBaseManager.get.insertSmallLabel(smallLabelData) } } @@ -339,7 +339,7 @@ gpioManager.setGpioLow("18") //查本地库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isEmpty()) { binding.objectAttrInclude.markerIdView.text = markerId } else { diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt index 837ae86..2f1bb58 100644 --- a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt @@ -276,7 +276,7 @@ //先存本地 lifecycleScope.launch { withContext(Dispatchers.IO) { - DataBaseManager.get.insertSmallLabel(smallLabelData) +// DataBaseManager.get.insertSmallLabel(smallLabelData) } } @@ -339,7 +339,7 @@ gpioManager.setGpioLow("18") //查本地库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isEmpty()) { binding.objectAttrInclude.markerIdView.text = markerId } else { diff --git a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt index d3ffdd3..a5834bd 100644 --- a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt @@ -6,6 +6,7 @@ import android.app.Dialog import android.content.Context import android.content.DialogInterface +import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable @@ -19,16 +20,16 @@ import android.os.CountDownTimer import android.os.Handler import android.os.Message +import android.util.Log import android.view.KeyEvent import android.view.View -import android.view.animation.Animation -import android.view.animation.RotateAnimation import android.widget.AdapterView import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import com.amap.api.location.AMapLocation import com.amap.api.maps.AMap import com.amap.api.maps.AMapOptions +import com.amap.api.maps.AMapUtils import com.amap.api.maps.CameraUpdateFactory import com.amap.api.maps.CoordinateConverter import com.amap.api.maps.model.BitmapDescriptorFactory @@ -39,8 +40,9 @@ import com.casic.electric.detector.R import com.casic.electric.detector.adapter.EditableImageAdapter import com.casic.electric.detector.base.SerialPortActivity -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.TaskBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean import com.casic.electric.detector.callback.OnGetLocationListener import com.casic.electric.detector.callback.OnImageCompressListener import com.casic.electric.detector.cluster.ClusterItem @@ -49,9 +51,10 @@ import com.casic.electric.detector.databinding.ActivityMainBinding import com.casic.electric.detector.databinding.DialogInstallMarkerBinding import com.casic.electric.detector.databinding.DialogInstallSmallMarkerBinding -import com.casic.electric.detector.databinding.DialogSearchMarkerBinding +import com.casic.electric.detector.databinding.DialogSearchMarkerNewBinding import com.casic.electric.detector.extensions.appendExcelDownloadUrl import com.casic.electric.detector.extensions.compressImage +import com.casic.electric.detector.extensions.createTaskCode import com.casic.electric.detector.extensions.drawCircle import com.casic.electric.detector.extensions.getDefaultValue import com.casic.electric.detector.extensions.hexToString @@ -61,6 +64,7 @@ import com.casic.electric.detector.extensions.setDefaultValue import com.casic.electric.detector.extensions.show import com.casic.electric.detector.extensions.toHex +import com.casic.electric.detector.model.TaskDetailLocalModel import com.casic.electric.detector.model.TaskModel import com.casic.electric.detector.utils.DataBaseManager import com.casic.electric.detector.utils.ExcelHub @@ -70,9 +74,10 @@ import com.casic.electric.detector.utils.LocationHub import com.casic.electric.detector.utils.RouteOnMap import com.casic.electric.detector.vm.TaskViewModel +import com.casic.electric.detector.widgets.MarkerDetailDialog import com.casic.electric.detector.widgets.QueryMarkerDialog +import com.casic.electric.detector.widgets.RadarScanView import com.casic.electric.detector.widgets.SamplePopupWindow -import com.google.gson.Gson import com.luck.picture.lib.basic.PictureSelector import com.luck.picture.lib.config.SelectMimeType import com.luck.picture.lib.entity.LocalMedia @@ -81,8 +86,10 @@ import com.pengxh.kt.lite.extensions.binding import com.pengxh.kt.lite.extensions.convertColor import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.createLogFile import com.pengxh.kt.lite.extensions.dateToTimestamp import com.pengxh.kt.lite.extensions.dp2px +import com.pengxh.kt.lite.extensions.getSystemService import com.pengxh.kt.lite.extensions.initDialogLayoutParams import com.pengxh.kt.lite.extensions.isNetworkConnected import com.pengxh.kt.lite.extensions.navigatePageTo @@ -90,6 +97,7 @@ import com.pengxh.kt.lite.extensions.timestampToCompleteDate import com.pengxh.kt.lite.extensions.timestampToTime import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.extensions.writeToFile import com.pengxh.kt.lite.utils.FileDownloadManager import com.pengxh.kt.lite.utils.LoadState import com.pengxh.kt.lite.utils.LoadingDialogHub @@ -103,47 +111,50 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File +import java.math.RoundingMode import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer import java.util.TimerTask +import kotlin.math.atan2 @SuppressLint("all") class MainActivity : SerialPortActivity(), SensorEventListener, Handler.Callback { private val kTag = "MainActivity" - private val context = this@MainActivity + private val context = this private val samplePopupWindow by lazy { SamplePopupWindow(this) } - private val gson by lazy { Gson() } private val regionRadius by lazy { LocaleConstant.RADIUS_SIZE.dp2px(this) } private val backDrawables by lazy { HashMap() } private val installDialog by lazy { InstallMarkerDialog(this) } - private val searchDialog by lazy { SearchMarkerDialog(this) } + private val searchNewDialog by lazy { SearchMarkerNewDialog(this) } + private val detailDialog by lazy { MarkerDetailDialog(this) } + private val locationHub by lazy { LocationHub(this) } + private val decimalFormat by lazy { DecimalFormat("0.00") } private val sensorMessageCode = 2024022301 private val rotationMatrix = FloatArray(9)//旋转矩阵缓存 private val valueArray = FloatArray(3)//方位角数值 private var clickTime: Long = 0 - private var labelBeans = ArrayList() + private var markers = ArrayList() + private var smallMarkers = ArrayList() private var clusterOverlay: ClusterOverlay? = null - private var latitude: Double = 0.0 - private var longitude: Double = 0.0 private var isFreeTask = false + private var freeTaskTitle = "" private var ids = HashSet() private var signalTask: TimerTask? = null + private var energyTask: TimerTask? = null private var searchMarkerTimer: Timer? = null - private var taskId: String? = null + private var freeTaskId: String? = null private var gravity: FloatArray? = null private var geomagnetic: FloatArray? = null private lateinit var aMap: AMap - private lateinit var task: TaskBean private lateinit var sensorManager: SensorManager private lateinit var weakReferenceHandler: WeakReferenceHandler /***inner class 需要用到*****start*/ private val gpioManager by lazy { GpioManager() } - private val locationHub by lazy { LocationHub(this) } private val taskViewModel by lazy { ViewModelProvider(this)[TaskViewModel::class.java] } private val attr = AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ALARM) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build() @@ -168,6 +179,9 @@ slowSoundResourceId = soundPool.load(this, R.raw.ring4, 1) fastSoundResourceId = soundPool.load(this, R.raw.ring2, 1) + //保留小数2位 + decimalFormat.roundingMode = RoundingMode.HALF_UP + "登录成功".show(this) //地图初始化 @@ -177,12 +191,14 @@ samplePopupWindow.setPopupMenuItem(LocaleConstant.POPUP_TITLES) samplePopupWindow.setBackgroundDrawable(null) + sensorManager = getSystemService()!! + weakReferenceHandler = WeakReferenceHandler(this) + //task网络请求监听 taskViewModel.markerFileResult.observe(this) { if (it.success == "true") { //清空之前的数据 - DataBaseManager.get.clearLabels() - DataBaseManager.get.clearSmallLabels() + DataBaseManager.get.clearMarkers() /** * "data":"/xls/marker1.xls,/xls/smallMarker1.xls" * 有两份excel表格需要下载 @@ -200,10 +216,10 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { - labelBeans = ExcelHub.readLabel(file.absolutePath) + markers = ExcelHub.readLabel(file.absolutePath) withContext(Dispatchers.IO) { - labelBeans.forEach { label -> - DataBaseManager.get.insertLabel(label) + markers.forEach { marker -> + DataBaseManager.get.saveMarkerInLocale(marker) } } LoadingDialogHub.dismiss() @@ -227,12 +243,12 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { -// smallLabels = ExcelHub.readSmallLabel(file.absolutePath) -// withContext(Dispatchers.IO) { -// smallLabels.forEach { label -> -// DataBaseManager.get.insertSmallLabel(label) -// } -// } + smallMarkers = ExcelHub.readSmallLabel(file.absolutePath) + withContext(Dispatchers.IO) { + smallMarkers.forEach { marker -> + DataBaseManager.get.saveSmallMarkerInLocale(marker) + } + } } } @@ -250,18 +266,35 @@ taskViewModel.taskResult.observe(this) { if (it.success == "true") { //清空之前的数据 -// DataBaseManager.get.clearTasks() AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") .setMessage("您有${it.message.size}个新任务!").setPositiveButton("知道了") .setOnDialogButtonClickListener(object : AlertMessageDialog.OnDialogButtonClickListener { override fun onConfirmClick() { - saveTaskInformation(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { + freeTaskId = it + // 自由巡检保存在本地 + val bean = TaskLocalBean() + bean.id = freeTaskId.toString().toLong() + val currentTimeMillis = System.currentTimeMillis() + bean.taskCode = currentTimeMillis.createTaskCode() + bean.description = freeTaskTitle + val time = currentTimeMillis.timestampToCompleteDate() + bean.createTime = time + bean.status = "0" + val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + bean.createUserName = userName + bean.startTime = time + bean.endTime = "" + bean.isFreeTask = "1" + DataBaseManager.get.saveTaskInLocale(bean) + } + taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -290,10 +323,11 @@ }).build().show() } else { lifecycleScope.launch(Dispatchers.Main) { - val labels = withContext(Dispatchers.IO) { - DataBaseManager.get.queryLabelById("0") + val markers = withContext(Dispatchers.IO) { + DataBaseManager.get.queryMarkerByState("0") } - if (labels.isNotEmpty()) { + //如果有需要补全的标识器,Popup右侧会有小圆点提示 + if (markers.isNotEmpty()) { samplePopupWindow.setShowPosition(4) } val x = @@ -307,37 +341,42 @@ SamplePopupWindow.OnPopupWindowClickListener { override fun onPopupItemClicked(position: Int) { when (position) { - 0 -> updateLabels() + 0 -> updateMarkers() 1 -> downloadTask() 2 -> navigatePageTo() 3 -> uploadEvent() -// 4 -> uploadLabel() +// 4 -> completionMarker() } } }) //安装。上传,然后存入本地库 binding.installButton.setOnClickListener { - AlertControlDialog.Builder().setContext(context).setTitle("提示") - .setMessage("请选择安装对象").setPositiveButton("标识器") - .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - //标识器 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installMarkerDialog.show() - } + if (isFreeTask) { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("正在自由巡检任务中,请完成此次任务之后再使用此功能") + .setPositiveButton("好的").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { - override fun onCancelClick() { - //电子标签 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installSmallMarkerDialog.show() - } - }).build().show() + } + }).build().show() + } else { + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择安装对象").setPositiveButton("标识器") + .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + //标识器 +// installMarkerDialog.show() + } + + override fun onCancelClick() { + //电子标签 +// installSmallMarkerDialog.show() + } + }).build().show() + } } //查看 @@ -351,24 +390,24 @@ ) { //查询数据库 lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { + markers = withContext(Dispatchers.IO) { if (contentValue.size == 1) { - DataBaseManager.get.loadLabelByCondition( + DataBaseManager.get.loadMarkerByCondition( selectedCondition, contentValue[0] - ) as ArrayList + ) as ArrayList } else { DataBaseManager.get.loadLabelByDate( contentValue[0], contentValue[1] - ) as ArrayList + ) as ArrayList } } val latitudeList = ArrayList() val longitudeList = ArrayList() - labelBeans.forEach { - val latitude = it.latitude - val longitude = it.longitude + markers.forEach { + val latitude = markers.first().lat + val longitude = markers.first().lng if (latitude.isNotBlank() && longitude.isNotBlank()) { if (CoordinateConverter.isAMapDataAvailable( latitude.toDouble(), longitude.toDouble() @@ -400,52 +439,63 @@ //巡检 binding.inspectionButton.setOnClickListener { -// val task = DataBaseManager.get.queryDistinctTask() -// if (task.isNotEmpty()) { -// val arrayList = ArrayList() -// task.forEachIndexed { index, taskBean -> -// arrayList.add("任务${index + 1}:${taskBean.taskId},${taskBean.desc}") -// } -// -// BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) -// .setActionItemTitle(arrayList) -// .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { -// override fun onActionItemClick(position: Int) { -// val taskBean = task[position] -// SaveKeyValues.putValue(LocaleConstant.TASK_ID, taskBean.taskId) -// AlertControlDialog.Builder().setContext(context).setTitle("提示") -// .setMessage("请选择操作方式").setPositiveButton("执行工单") -// .setNegativeButton("提交工单") -// .setOnDialogButtonClickListener(object : -// AlertControlDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// detectRedrawGraphic(taskBean.taskId) -// -// val latLng = LatLng( -// taskBean.lat.toDouble(), taskBean.lng.toDouble() -// ) -// aMap.moveCamera( -// CameraUpdateFactory.newLatLngZoom(latLng, 16f) -// ) -// uploadTask(taskBean.taskId, "1") -// } -// -// override fun onCancelClick() { -// uploadTask(taskBean.taskId, "2") -// } -// }).build().show() -// } -// }).build().show() -// } else { -// AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") -// .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") -// .setPositiveButton("知道了").setOnDialogButtonClickListener(object : -// AlertMessageDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// startFreeTask() -// } -// }).build().show() -// } + val tasks = DataBaseManager.get.loadLocalTask() + if (tasks.isNotEmpty()) { + val arrayList = ArrayList() + tasks.forEachIndexed { index, task -> + arrayList.add("任务${index + 1}:${task.taskId},${task.description}") + } + + BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) + .setActionItemTitle(arrayList) + .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { + override fun onActionItemClick(position: Int) { + val task = tasks[position] + Log.d(kTag, task.toJson()) + SaveKeyValues.putValue(LocaleConstant.TASK_ID, task.taskId) + SaveKeyValues.putValue(LocaleConstant.TASK_CODE, task.taskCode) + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择操作方式").setPositiveButton("执行工单") + .setNegativeButton("提交工单") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + if (task.markerModels.isNotEmpty()) { + //移到Task下属第一个标识器位置 + val firstMarker = task.markerModels.first() + val latLng = LatLng(firstMarker.lat, firstMarker.lng) + aMap.moveCamera( + CameraUpdateFactory.newLatLngZoom(latLng, 16f) + ) + //执行工单 + uploadTask(task.taskId, task.taskCode, "1") + detectRedrawGraphic(task) + isExecuteTask = true + } else { + "此工单下无标识器,将执行自由巡检任务".show(context) + freeTaskId = task.taskId + openSerialPort() + } + } + + override fun onCancelClick() { + //提交工单 + uploadTask(task.taskId, task.taskCode, "2") + isExecuteTask = false + } + }).build().show() + } + }).build().show() + } else { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") + .setPositiveButton("知道了").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + startFreeTask() + } + }).build().show() + } } //探测 @@ -465,7 +515,7 @@ } }).build().show() } else { - searchDialog.show() + searchNewDialog.show() } } @@ -479,16 +529,21 @@ isFreeTask = false soundPool.autoPause() + //停止信号和ID搜索定时器 + signalTask?.cancel() + energyTask?.cancel() + searchMarkerTimer?.cancel() + //降低串口电位 gpioManager.setGpioLow("18") binding.stopFreeTaskButton.visibility = View.GONE - if (taskId.isNullOrBlank()) { + if (freeTaskId.isNullOrBlank()) { "任务ID异常,无法提交任务,请联系服务器管理员".show(context) return } - taskId?.apply { + freeTaskId?.apply { taskViewModel.uploadTaskMarker(context, this, ArrayList(ids)) } } @@ -497,42 +552,65 @@ } } + private fun uploadTask(taskId: String, taskCode: String, state: String) { + if (isNetworkConnected()) { + val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) + } else { + "网络连接已断开,请检查".show(this) + } + } + private fun startFreeTask() { AlertInputDialog.Builder().setContext(this).setTitle("新建自由巡检任务") .setHintMessage("请输入自由巡检任务简要描述").setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : AlertInputDialog.OnDialogButtonClickListener { override fun onConfirmClick(value: String) { + freeTaskTitle = value val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String taskViewModel.createFreeTask(context, userId, value) - //调高串口电位 - gpioManager.setGpioHigh("18") - - isFreeTask = true - //自由巡检 - signalTask = object : TimerTask() { - override fun run() { - out?.write('2'.code) - out?.flush() - } - } - searchMarkerTimer = Timer() - searchMarkerTimer?.apply { - schedule(signalTask, 0, 100) - } - - binding.stopFreeTaskButton.visibility = View.VISIBLE + openSerialPort() } override fun onCancelClick() {} }).build().show() } + private fun openSerialPort() { + //调高串口电位 + gpioManager.setGpioHigh("18") + + isFreeTask = true + //自由巡检 + signalTask = object : TimerTask() { + override fun run() { + out.write('2'.code) + out.flush() + } + } + + energyTask = object : TimerTask() { + override fun run() { + out.write('6'.code) + out.flush() + } + } + + searchMarkerTimer = Timer() + searchMarkerTimer?.apply { + schedule(signalTask, 0, 200) + schedule(energyTask, 0, 251) + } + + binding.stopFreeTaskButton.visibility = View.VISIBLE + } + override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) + if (searchNewDialog.isDetectMarker) { + searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() if (markerId.isNumber()) { @@ -540,26 +618,47 @@ } } else if (isFreeTask) { val markerId = hex.take(20).hexToString() + if (markerId.isNumber()) { //只响一次,因为探测频率高,所以依旧是连续的报警声 soundPool.play(soundResourceId, 1f, 1f, 0, 0, 1f) - "标识器${markerId}已探测".show(this) //添加地图Marker if (!ids.contains(markerId)) { //根据markerId查询标识器经纬度 - val labels = DataBaseManager.get.queryLabelById(markerId) - if (labels.isNotEmpty()) { - val bean = labels.first() + val markers = DataBaseManager.get.queryMarkerById(markerId) + if (markers.isNotEmpty()) { + val bean = markers.first() aMap.addMarker( MarkerOptions().position( - LatLng( - bean.latitude.toDouble(), bean.longitude.toDouble() - ) + LatLng(bean.lat.toDouble(), bean.lng.toDouble()) ).icon(BitmapDescriptorFactory.fromResource(R.mipmap.label_blue1)) ) } } ids.add(markerId) + + //显示标识器详细信息 + if (!detailDialog.isShowing) { + val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull() + if (markerBean == null) { + "无法查询到此ID【${markerId}】的信息".show(context) + } else { + detailDialog.setMarker(markerBean) + detailDialog.show() + } + } + } + + if (hex.startsWith("4E")) { + val energyResponse = hex.take(10).hexToString() + try { + val energy = energyResponse.substring(1).toInt() + if (energy <= 500 && detailDialog.isShowing) { + detailDialog.dismiss() + } + } catch (e: NumberFormatException) { + e.printStackTrace() + } } } } @@ -570,31 +669,21 @@ LoadState.Loading -> { if (installDialog.isInstallMarker) { LoadingDialogHub.show(this, "标识器安装中,请稍后...") - } else if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - "标识器${this.markerRealId}已探测!".show(context) -// DataBaseManager.get.updateTaskLabel(this) - } } else { LoadingDialogHub.show(this, "提交工单中,请稍后") } } - else -> { + LoadState.Success -> { if (installDialog.isInstallMarker) { -// installDialog.clearDefaultData() + installDialog.clearDefaultData() installDialog.dismiss() - "${installDialog.markerId}安装成功".show(context) + "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } } @@ -618,8 +707,6 @@ aMap.myLocationStyle = locationStyle//设置定位蓝点的Style aMap.isMyLocationEnabled = true//设置是否显示定位小蓝点 aMap.setOnMyLocationChangeListener { - longitude = it.longitude - latitude = it.latitude //经纬度逆编码 locationHub.antiCodingLocation(it) { address -> binding.currentLocationView.text = address @@ -631,19 +718,20 @@ aMap.setOnMapLongClickListener { lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } - //显示标签 - showLabelsOnMap() } //虽然不用显示附属标签,但是需要和标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } + + //显示标签 + showLabelsOnMap() } //自定义定位按钮 @@ -666,39 +754,28 @@ }) } - private fun saveTaskInformation(it: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String - if (it.message.size > 0) { - it.message.forEach { messageModel -> -// val count = DataBaseManager.get.countTaskById(messageModel.id.toString()) -// if (count == 0) { -// messageModel.taskDetailInfos.forEach { info -> -// DataBaseManager.get.insertTaskInformation( -// userName, -// messageModel.description, -// info.taskId.toString(), -// info.id.toString(), -// info.markerId.toString(), -// info.markerIdReal.toString(), -// info.longitude.toString(), -// info.latitude.toString(), -// messageModel.status -// ) -// } -// } + private fun saveUserTasks(task: TaskModel) { + task.message.forEach { model -> + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) + } } - "工单下载成功!".show(context) } + "工单下载成功!".show(this) } private fun showLabelsOnMap() { clusterOverlay?.onDestroy() val clusterItems = ArrayList() - labelBeans.forEach { - if (it.latitude.isNotEmpty() && it.longitude.isNotEmpty()) { - val latitude = it.latitude.toDouble() - val longitude = it.longitude.toDouble() + markers.forEach { + if (it.lat.isNotEmpty() && it.lng.isNotEmpty()) { + val latitude = it.lat.toDouble() + val longitude = it.lng.toDouble() val latLng = LatLng(latitude, longitude, false) val regionItem = RegionItem(latLng, it.id.toString()) @@ -717,7 +794,6 @@ ) backDrawables[0] = bitmapDrawable } - bitmapDrawable } if (clusterNum == 1) { var bitmapDrawable = backDrawables[1] @@ -780,8 +856,8 @@ override fun onActionItemClick(position: Int) { when (position) { 0 -> { - labelBeans.forEach { - if (it.markerId.toString() == item.tag) { + markers.forEach { + if (it.id.toString() == item.tag) { navigatePageTo(it.toJson()) } } @@ -789,11 +865,11 @@ 1 -> { val electricMarkers = ArrayList() -// smallLabels.forEach { -// if (it.markerId.toString() == item.tag) { -// electricMarkers.add(it.electricMarkerId) -// } -// } + smallMarkers.forEach { + if (it.id.toString() == item.tag) { + electricMarkers.add(it.electricMarkerId) + } + } if (electricMarkers.isEmpty()) { "此标识器没有绑定的电子标签".show(context) @@ -818,44 +894,32 @@ }.show() } - private fun detectRedrawGraphic(taskId: String) { -// val tasks = DataBaseManager.get.queryTaskById(taskId) -// if (tasks.isNotEmpty()) { -// tasks.forEach { -// val latLng = LatLng(it.lat.toDouble(), it.lng.toDouble()) -// val otMarkerOptions = MarkerOptions() -// otMarkerOptions.position(latLng) -// otMarkerOptions.visible(true) // 设置可见 -// if (it.state == "未开始") { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_red1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } else { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } -// aMap.addMarker(otMarkerOptions) -// } -// } + private fun detectRedrawGraphic(task: TaskDetailLocalModel) { + task.markerModels.forEach { + val latLng = LatLng(it.lat, it.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (it.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } + aMap.addMarker(otMarkerOptions) + } showLabelsOnMap() } - private fun uploadTask(taskId: String?, state: String) { - if (isNetworkConnected()) { - val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String - taskViewModel.uploadTask(userId, taskId, state) - } else { - "网络连接已断开,请检查".show(this) - } - } - //更新数据 - private fun updateLabels() { + private fun updateMarkers() { AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") .setNegativeButton("取消").setPositiveButton("确定") .setOnDialogButtonClickListener(object : @@ -941,7 +1005,7 @@ SensorManager.getOrientation(rotationMatrix, valueArray) val degree = ((360f + valueArray[0] * 180f / Math.PI) % 360).toInt() -// searchNewDialog.updateDegreeValue(degree) + searchNewDialog.updateDegreeValue(degree) } } return true @@ -953,8 +1017,8 @@ super.onResume() binding.mapView.onResume() lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } //显示标签 showLabelsOnMap() @@ -962,9 +1026,9 @@ //虽然不用显示附属标签,但是需要喝标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } //注册加速度传感器监听 @@ -990,8 +1054,6 @@ override fun onDestroy() { super.onDestroy() binding.mapView.onDestroy() - signalTask?.cancel() - searchMarkerTimer?.cancel() soundPool.release() locationHub.stopLocation() //降低串口电位 @@ -1006,6 +1068,7 @@ private val realPaths = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var countDownTimer: CountDownTimer + private lateinit var locationManager: LocationHub var isReadMarker = false var isInstallMarker = false @@ -1150,8 +1213,8 @@ soundPool.play(soundResourceId, 1f, 1f, 0, -1, 1f) - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() countDownTimer = object : CountDownTimer(5 * 1000, 1000) { override fun onTick(millisUntilFinished: Long) { @@ -1174,6 +1237,21 @@ } } + override fun show() { + super.show() + locationManager = LocationHub(context) + locationManager.getCurrentLocation(true, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + if (location != null) { + binding.markerAttrInclude.lngView.text = location.longitude.toString() + binding.markerAttrInclude.latView.text = location.latitude.toString() + } else { + "当前位置信号差,无法获取定位".show(context) + } + } + }) + } + fun bindingValue(markerId: String) { this.markerId = markerId LoadingDialogHub.dismiss() @@ -1193,6 +1271,7 @@ gpioManager.setGpioLow("18") soundPool.autoPause() isInstallMarker = false + locationManager.stopLocation() super.dismiss() } @@ -1515,6 +1594,21 @@ }) } + //清除默认数据 + fun clearDefaultData() { +// "markerObjectTypeView".setDefaultValue("") +// "pipelineDiameterView".setDefaultValue("") +// "buryDeepView".setDefaultValue("") +// "bottomPipeDiameterView".setDefaultValue("") +// "bottomPointDeepView".setDefaultValue("") +// "areaView".setDefaultValue("") +// "lineView".setDefaultValue("") +// "roadView".setDefaultValue("") +// "ownerView".setDefaultValue("") +// "identifierDeepView".setDefaultValue("") +// "personDeptView".setDefaultValue("") + } + //根据选择类型控制界面某些区域显隐 private fun setLayoutVisibility(vararg args: Int) { binding.objectAttrInclude.objectModeLayout.visibility = args[0] @@ -1566,21 +1660,23 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(context: Context) : Dialog(context) { + /**探测标识器新对话框******************************************************************************/ + inner class SearchMarkerNewDialog(context: Context) : Dialog(context) { - private val binding: DialogSearchMarkerBinding by binding() - private val decimal by lazy { DecimalFormat("0.0") } - private val degreeCache by lazy { HashMap() } - private var isPlaying = false + private val taskId by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String + } + private val taskCode by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_CODE, "") as String + } + private val binding: DialogSearchMarkerNewBinding by binding() private var markerId = "" private lateinit var searchMarkerTimer: Timer private lateinit var signalTask: TimerTask private lateinit var energyTask: TimerTask private lateinit var countDownTimer: CountDownTimer - + private lateinit var locationManager: LocationHub var isDetectMarker = false - var taskBean: TaskBean? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -1590,47 +1686,111 @@ energyTask.cancel() searchMarkerTimer.cancel() - out?.write('3'.code) -// val result = DataBaseManager.get.queryLabelById(markerId) -// if (result.isNotEmpty()) { -// val tag = when (result.first().identifierType) { -// "EM30" -> '7' -// "EM50" -> '8' -// "EM14" -> '9' -// else -> '1' -// } -// if (tag == '1') { -// "此标识器无法读取埋深!".show(context) -// } else { -// // 发送读取标识器埋设深度指令 -// LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") -// out.write(tag.code) -// out.flush() -// countDownTimer = object : CountDownTimer(15 * 1000, 1000) { -// override fun onTick(millisUntilFinished: Long) { -// -// } -// -// override fun onFinish() { -// LoadingDialogHub.dismiss() -// "探测此标识器深度超时,请重试".show(context) -// initTimer() -// } -// } -// countDownTimer.start() -// } -// } else { -// "标识器未安装,安装成功后才可读取埋深!".show(context) -// } + out.write('3'.code) + val result = DataBaseManager.get.queryMarkerById(markerId) + if (result.isNotEmpty()) { + val tag = when (result.first().markerType) { + "EM30" -> '7' + "EM50" -> '8' + "EM14" -> '9' + else -> '1' + } + if (tag == '1') { + "此标识器无法读取埋深!".show(context) + initTimer() + } else { + // 发送读取标识器埋设深度指令 + LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") + out.write(tag.code) + out.flush() + countDownTimer = object : CountDownTimer(15 * 1000, 1000) { + override fun onTick(millisUntilFinished: Long) { + + } + + override fun onFinish() { + LoadingDialogHub.dismiss() + "探测此标识器深度超时,请重试".show(context) + initTimer() + } + } + countDownTimer.start() + } + } else { + "标识器未安装,安装成功后才可读取埋深!".show(context) + initTimer() + } } binding.markerInfoButton.setOnClickListener { //查库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isNotEmpty()) { -// context.navigatePageTo(result.first().toJson()) + context.navigatePageTo(result.first().toJson()) } else { -// context.navigatePageTo(markerId) + context.navigatePageTo(markerId) + } + } + } + + override fun show() { + super.show() + locationManager = LocationHub(context) + //点位渲染,每次定位都计算当前位置与符合条件的点距离 + locationManager.getCurrentLocation(false, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + location?.apply { + renderDataPoint(this) + } + } + }) + } + + /** + * 计算并渲染数据点。点太多采用协程计算,不然会有点卡顿 + * @param location 定位点(天宝RTK获取) + * */ + private fun renderDataPoint(location: AMapLocation) { + val longitude = location.longitude + val latitude = location.latitude + lifecycleScope.launch(Dispatchers.IO) { + val dataPoints = ArrayList() + DataBaseManager.get.loadMarkers().forEach { + val distance = AMapUtils.calculateLineDistance( + LatLng(it.lat.toDouble(), it.lng.toDouble()), LatLng(latitude, longitude) + ) + val formatDistance = decimalFormat.format(distance).toFloat() + if (formatDistance <= LocaleConstant.MAX_DISTANCE) { + val angle = atan2( + (it.lat.toDouble() - latitude), (it.lng.toDouble() - longitude) + ) + Math.PI + val formatAngle = decimalFormat.format(angle).toDouble() + + "[$longitude, $latitude,$formatDistance, $formatAngle]".writeToFile( + createLogFile() + ) + dataPoints.add(RadarScanView.DataPoint(formatAngle, formatDistance)) + } + } + withContext(Dispatchers.Main) { + binding.radarScanView.renderPointData(dataPoints, + object : RadarScanView.OnGetNearestPointCallback { + override fun getNearestPoint(point: RadarScanView.DataPoint?) { + if (point == null) { + binding.distanceValueView.text = "大于5.5m" + binding.distancePgBar.progress = 100 + } else { + binding.distanceValueView.text = "${point.distance}m" + val progress = + if (point.distance > LocaleConstant.MAX_DISTANCE) { + 100 + } else { + (point.distance / LocaleConstant.MAX_DISTANCE) * 100 + } + binding.distancePgBar.progress = progress.toInt() + } + } + }) } } } @@ -1644,60 +1804,33 @@ isDetectMarker = true - //角度 - degreeCache["lastDegree"] = 0f + if (isExecuteTask) { + binding.taskStateView.visibility = View.GONE + binding.taskStateView.isSelected = false + } else { + binding.taskStateView.visibility = View.VISIBLE + binding.taskStateView.isSelected = true + } } fun bindingValue(hex: String) { if (hex.startsWith("4E")) { try { //4E转为String为N,代表能量值 - //用能量值转动表盘 val energyResponse = hex.take(10).hexToString() val energy = energyResponse.substring(1).toInt() if (energy >= 4000) { - isPlaying = if (!isPlaying) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(fastSoundResourceId) - false - } + soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) } else { - isPlaying = if (!isPlaying) { - soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(slowSoundResourceId) - false - } + soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) } - binding.resultTextView.text = "信号能量值:${energyResponse}" - - //转换为转动的角度 - val degree = (energy.toFloat() / (50 * 100)) * 180 - binding.energyValueView.text = decimal.format(degree) - - degreeCache["lastDegree"]?.apply { - val animation = RotateAnimation( - this, - degree, - Animation.RELATIVE_TO_SELF, - 0.5f, - Animation.RELATIVE_TO_SELF, - 0.5f - ) - animation.duration = 0 - animation.fillAfter = true - binding.needleView.startAnimation(animation) - } - - //保存旋转后的角度 - degreeCache["lastDegree"] = degree + //通过设置进度条表示能量值 + binding.energyPgBar.progress = energy + binding.energyValueView.text = "${energy}dB" if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" + binding.energyTipsView.text = "信号较弱,可能距离较远" binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) @@ -1712,11 +1845,11 @@ binding.searchResultView.setTextColor(Color.parseColor("#8D1717")) binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } else if (energy >= 4100) {//148° - binding.energyTipsView.text = "标识器信号极强,可能在正下方" + binding.energyTipsView.text = "信号极强,接近标识器正上方" binding.energyTipsView.setTextColor(Color.parseColor("#428d00")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" + binding.energyTipsView.text = "已靠近,请继续移动位置" binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } @@ -1757,31 +1890,37 @@ binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) //自动上传标识器 -// taskBean = DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") -// taskBean?.apply { -// /** -// * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 -// * */ -// taskViewModel.uploadMarker(taskCode) -// } + if (isExecuteTask) { + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) + } + } } } } + //更新罗盘角度 + fun updateDegreeValue(degree: Int) { + binding.radarScanView.setDegreeValue(degree) + } + private fun initTimer() { searchMarkerTimer = Timer() signalTask = object : TimerTask() { override fun run() { - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() } } energyTask = object : TimerTask() { override fun run() { - out?.write('6'.code) - out?.flush() + out.write('6'.code) + out.flush() } } @@ -1798,6 +1937,7 @@ gpioManager.setGpioLow("18") isDetectMarker = false soundPool.autoPause() + locationManager.stopLocation() super.dismiss() } } diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt index 837ae86..2f1bb58 100644 --- a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt @@ -276,7 +276,7 @@ //先存本地 lifecycleScope.launch { withContext(Dispatchers.IO) { - DataBaseManager.get.insertSmallLabel(smallLabelData) +// DataBaseManager.get.insertSmallLabel(smallLabelData) } } @@ -339,7 +339,7 @@ gpioManager.setGpioLow("18") //查本地库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isEmpty()) { binding.objectAttrInclude.markerIdView.text = markerId } else { diff --git a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt index d3ffdd3..a5834bd 100644 --- a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt @@ -6,6 +6,7 @@ import android.app.Dialog import android.content.Context import android.content.DialogInterface +import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable @@ -19,16 +20,16 @@ import android.os.CountDownTimer import android.os.Handler import android.os.Message +import android.util.Log import android.view.KeyEvent import android.view.View -import android.view.animation.Animation -import android.view.animation.RotateAnimation import android.widget.AdapterView import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import com.amap.api.location.AMapLocation import com.amap.api.maps.AMap import com.amap.api.maps.AMapOptions +import com.amap.api.maps.AMapUtils import com.amap.api.maps.CameraUpdateFactory import com.amap.api.maps.CoordinateConverter import com.amap.api.maps.model.BitmapDescriptorFactory @@ -39,8 +40,9 @@ import com.casic.electric.detector.R import com.casic.electric.detector.adapter.EditableImageAdapter import com.casic.electric.detector.base.SerialPortActivity -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.TaskBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean import com.casic.electric.detector.callback.OnGetLocationListener import com.casic.electric.detector.callback.OnImageCompressListener import com.casic.electric.detector.cluster.ClusterItem @@ -49,9 +51,10 @@ import com.casic.electric.detector.databinding.ActivityMainBinding import com.casic.electric.detector.databinding.DialogInstallMarkerBinding import com.casic.electric.detector.databinding.DialogInstallSmallMarkerBinding -import com.casic.electric.detector.databinding.DialogSearchMarkerBinding +import com.casic.electric.detector.databinding.DialogSearchMarkerNewBinding import com.casic.electric.detector.extensions.appendExcelDownloadUrl import com.casic.electric.detector.extensions.compressImage +import com.casic.electric.detector.extensions.createTaskCode import com.casic.electric.detector.extensions.drawCircle import com.casic.electric.detector.extensions.getDefaultValue import com.casic.electric.detector.extensions.hexToString @@ -61,6 +64,7 @@ import com.casic.electric.detector.extensions.setDefaultValue import com.casic.electric.detector.extensions.show import com.casic.electric.detector.extensions.toHex +import com.casic.electric.detector.model.TaskDetailLocalModel import com.casic.electric.detector.model.TaskModel import com.casic.electric.detector.utils.DataBaseManager import com.casic.electric.detector.utils.ExcelHub @@ -70,9 +74,10 @@ import com.casic.electric.detector.utils.LocationHub import com.casic.electric.detector.utils.RouteOnMap import com.casic.electric.detector.vm.TaskViewModel +import com.casic.electric.detector.widgets.MarkerDetailDialog import com.casic.electric.detector.widgets.QueryMarkerDialog +import com.casic.electric.detector.widgets.RadarScanView import com.casic.electric.detector.widgets.SamplePopupWindow -import com.google.gson.Gson import com.luck.picture.lib.basic.PictureSelector import com.luck.picture.lib.config.SelectMimeType import com.luck.picture.lib.entity.LocalMedia @@ -81,8 +86,10 @@ import com.pengxh.kt.lite.extensions.binding import com.pengxh.kt.lite.extensions.convertColor import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.createLogFile import com.pengxh.kt.lite.extensions.dateToTimestamp import com.pengxh.kt.lite.extensions.dp2px +import com.pengxh.kt.lite.extensions.getSystemService import com.pengxh.kt.lite.extensions.initDialogLayoutParams import com.pengxh.kt.lite.extensions.isNetworkConnected import com.pengxh.kt.lite.extensions.navigatePageTo @@ -90,6 +97,7 @@ import com.pengxh.kt.lite.extensions.timestampToCompleteDate import com.pengxh.kt.lite.extensions.timestampToTime import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.extensions.writeToFile import com.pengxh.kt.lite.utils.FileDownloadManager import com.pengxh.kt.lite.utils.LoadState import com.pengxh.kt.lite.utils.LoadingDialogHub @@ -103,47 +111,50 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File +import java.math.RoundingMode import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer import java.util.TimerTask +import kotlin.math.atan2 @SuppressLint("all") class MainActivity : SerialPortActivity(), SensorEventListener, Handler.Callback { private val kTag = "MainActivity" - private val context = this@MainActivity + private val context = this private val samplePopupWindow by lazy { SamplePopupWindow(this) } - private val gson by lazy { Gson() } private val regionRadius by lazy { LocaleConstant.RADIUS_SIZE.dp2px(this) } private val backDrawables by lazy { HashMap() } private val installDialog by lazy { InstallMarkerDialog(this) } - private val searchDialog by lazy { SearchMarkerDialog(this) } + private val searchNewDialog by lazy { SearchMarkerNewDialog(this) } + private val detailDialog by lazy { MarkerDetailDialog(this) } + private val locationHub by lazy { LocationHub(this) } + private val decimalFormat by lazy { DecimalFormat("0.00") } private val sensorMessageCode = 2024022301 private val rotationMatrix = FloatArray(9)//旋转矩阵缓存 private val valueArray = FloatArray(3)//方位角数值 private var clickTime: Long = 0 - private var labelBeans = ArrayList() + private var markers = ArrayList() + private var smallMarkers = ArrayList() private var clusterOverlay: ClusterOverlay? = null - private var latitude: Double = 0.0 - private var longitude: Double = 0.0 private var isFreeTask = false + private var freeTaskTitle = "" private var ids = HashSet() private var signalTask: TimerTask? = null + private var energyTask: TimerTask? = null private var searchMarkerTimer: Timer? = null - private var taskId: String? = null + private var freeTaskId: String? = null private var gravity: FloatArray? = null private var geomagnetic: FloatArray? = null private lateinit var aMap: AMap - private lateinit var task: TaskBean private lateinit var sensorManager: SensorManager private lateinit var weakReferenceHandler: WeakReferenceHandler /***inner class 需要用到*****start*/ private val gpioManager by lazy { GpioManager() } - private val locationHub by lazy { LocationHub(this) } private val taskViewModel by lazy { ViewModelProvider(this)[TaskViewModel::class.java] } private val attr = AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ALARM) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build() @@ -168,6 +179,9 @@ slowSoundResourceId = soundPool.load(this, R.raw.ring4, 1) fastSoundResourceId = soundPool.load(this, R.raw.ring2, 1) + //保留小数2位 + decimalFormat.roundingMode = RoundingMode.HALF_UP + "登录成功".show(this) //地图初始化 @@ -177,12 +191,14 @@ samplePopupWindow.setPopupMenuItem(LocaleConstant.POPUP_TITLES) samplePopupWindow.setBackgroundDrawable(null) + sensorManager = getSystemService()!! + weakReferenceHandler = WeakReferenceHandler(this) + //task网络请求监听 taskViewModel.markerFileResult.observe(this) { if (it.success == "true") { //清空之前的数据 - DataBaseManager.get.clearLabels() - DataBaseManager.get.clearSmallLabels() + DataBaseManager.get.clearMarkers() /** * "data":"/xls/marker1.xls,/xls/smallMarker1.xls" * 有两份excel表格需要下载 @@ -200,10 +216,10 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { - labelBeans = ExcelHub.readLabel(file.absolutePath) + markers = ExcelHub.readLabel(file.absolutePath) withContext(Dispatchers.IO) { - labelBeans.forEach { label -> - DataBaseManager.get.insertLabel(label) + markers.forEach { marker -> + DataBaseManager.get.saveMarkerInLocale(marker) } } LoadingDialogHub.dismiss() @@ -227,12 +243,12 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { -// smallLabels = ExcelHub.readSmallLabel(file.absolutePath) -// withContext(Dispatchers.IO) { -// smallLabels.forEach { label -> -// DataBaseManager.get.insertSmallLabel(label) -// } -// } + smallMarkers = ExcelHub.readSmallLabel(file.absolutePath) + withContext(Dispatchers.IO) { + smallMarkers.forEach { marker -> + DataBaseManager.get.saveSmallMarkerInLocale(marker) + } + } } } @@ -250,18 +266,35 @@ taskViewModel.taskResult.observe(this) { if (it.success == "true") { //清空之前的数据 -// DataBaseManager.get.clearTasks() AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") .setMessage("您有${it.message.size}个新任务!").setPositiveButton("知道了") .setOnDialogButtonClickListener(object : AlertMessageDialog.OnDialogButtonClickListener { override fun onConfirmClick() { - saveTaskInformation(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { + freeTaskId = it + // 自由巡检保存在本地 + val bean = TaskLocalBean() + bean.id = freeTaskId.toString().toLong() + val currentTimeMillis = System.currentTimeMillis() + bean.taskCode = currentTimeMillis.createTaskCode() + bean.description = freeTaskTitle + val time = currentTimeMillis.timestampToCompleteDate() + bean.createTime = time + bean.status = "0" + val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + bean.createUserName = userName + bean.startTime = time + bean.endTime = "" + bean.isFreeTask = "1" + DataBaseManager.get.saveTaskInLocale(bean) + } + taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -290,10 +323,11 @@ }).build().show() } else { lifecycleScope.launch(Dispatchers.Main) { - val labels = withContext(Dispatchers.IO) { - DataBaseManager.get.queryLabelById("0") + val markers = withContext(Dispatchers.IO) { + DataBaseManager.get.queryMarkerByState("0") } - if (labels.isNotEmpty()) { + //如果有需要补全的标识器,Popup右侧会有小圆点提示 + if (markers.isNotEmpty()) { samplePopupWindow.setShowPosition(4) } val x = @@ -307,37 +341,42 @@ SamplePopupWindow.OnPopupWindowClickListener { override fun onPopupItemClicked(position: Int) { when (position) { - 0 -> updateLabels() + 0 -> updateMarkers() 1 -> downloadTask() 2 -> navigatePageTo() 3 -> uploadEvent() -// 4 -> uploadLabel() +// 4 -> completionMarker() } } }) //安装。上传,然后存入本地库 binding.installButton.setOnClickListener { - AlertControlDialog.Builder().setContext(context).setTitle("提示") - .setMessage("请选择安装对象").setPositiveButton("标识器") - .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - //标识器 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installMarkerDialog.show() - } + if (isFreeTask) { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("正在自由巡检任务中,请完成此次任务之后再使用此功能") + .setPositiveButton("好的").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { - override fun onCancelClick() { - //电子标签 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installSmallMarkerDialog.show() - } - }).build().show() + } + }).build().show() + } else { + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择安装对象").setPositiveButton("标识器") + .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + //标识器 +// installMarkerDialog.show() + } + + override fun onCancelClick() { + //电子标签 +// installSmallMarkerDialog.show() + } + }).build().show() + } } //查看 @@ -351,24 +390,24 @@ ) { //查询数据库 lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { + markers = withContext(Dispatchers.IO) { if (contentValue.size == 1) { - DataBaseManager.get.loadLabelByCondition( + DataBaseManager.get.loadMarkerByCondition( selectedCondition, contentValue[0] - ) as ArrayList + ) as ArrayList } else { DataBaseManager.get.loadLabelByDate( contentValue[0], contentValue[1] - ) as ArrayList + ) as ArrayList } } val latitudeList = ArrayList() val longitudeList = ArrayList() - labelBeans.forEach { - val latitude = it.latitude - val longitude = it.longitude + markers.forEach { + val latitude = markers.first().lat + val longitude = markers.first().lng if (latitude.isNotBlank() && longitude.isNotBlank()) { if (CoordinateConverter.isAMapDataAvailable( latitude.toDouble(), longitude.toDouble() @@ -400,52 +439,63 @@ //巡检 binding.inspectionButton.setOnClickListener { -// val task = DataBaseManager.get.queryDistinctTask() -// if (task.isNotEmpty()) { -// val arrayList = ArrayList() -// task.forEachIndexed { index, taskBean -> -// arrayList.add("任务${index + 1}:${taskBean.taskId},${taskBean.desc}") -// } -// -// BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) -// .setActionItemTitle(arrayList) -// .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { -// override fun onActionItemClick(position: Int) { -// val taskBean = task[position] -// SaveKeyValues.putValue(LocaleConstant.TASK_ID, taskBean.taskId) -// AlertControlDialog.Builder().setContext(context).setTitle("提示") -// .setMessage("请选择操作方式").setPositiveButton("执行工单") -// .setNegativeButton("提交工单") -// .setOnDialogButtonClickListener(object : -// AlertControlDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// detectRedrawGraphic(taskBean.taskId) -// -// val latLng = LatLng( -// taskBean.lat.toDouble(), taskBean.lng.toDouble() -// ) -// aMap.moveCamera( -// CameraUpdateFactory.newLatLngZoom(latLng, 16f) -// ) -// uploadTask(taskBean.taskId, "1") -// } -// -// override fun onCancelClick() { -// uploadTask(taskBean.taskId, "2") -// } -// }).build().show() -// } -// }).build().show() -// } else { -// AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") -// .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") -// .setPositiveButton("知道了").setOnDialogButtonClickListener(object : -// AlertMessageDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// startFreeTask() -// } -// }).build().show() -// } + val tasks = DataBaseManager.get.loadLocalTask() + if (tasks.isNotEmpty()) { + val arrayList = ArrayList() + tasks.forEachIndexed { index, task -> + arrayList.add("任务${index + 1}:${task.taskId},${task.description}") + } + + BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) + .setActionItemTitle(arrayList) + .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { + override fun onActionItemClick(position: Int) { + val task = tasks[position] + Log.d(kTag, task.toJson()) + SaveKeyValues.putValue(LocaleConstant.TASK_ID, task.taskId) + SaveKeyValues.putValue(LocaleConstant.TASK_CODE, task.taskCode) + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择操作方式").setPositiveButton("执行工单") + .setNegativeButton("提交工单") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + if (task.markerModels.isNotEmpty()) { + //移到Task下属第一个标识器位置 + val firstMarker = task.markerModels.first() + val latLng = LatLng(firstMarker.lat, firstMarker.lng) + aMap.moveCamera( + CameraUpdateFactory.newLatLngZoom(latLng, 16f) + ) + //执行工单 + uploadTask(task.taskId, task.taskCode, "1") + detectRedrawGraphic(task) + isExecuteTask = true + } else { + "此工单下无标识器,将执行自由巡检任务".show(context) + freeTaskId = task.taskId + openSerialPort() + } + } + + override fun onCancelClick() { + //提交工单 + uploadTask(task.taskId, task.taskCode, "2") + isExecuteTask = false + } + }).build().show() + } + }).build().show() + } else { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") + .setPositiveButton("知道了").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + startFreeTask() + } + }).build().show() + } } //探测 @@ -465,7 +515,7 @@ } }).build().show() } else { - searchDialog.show() + searchNewDialog.show() } } @@ -479,16 +529,21 @@ isFreeTask = false soundPool.autoPause() + //停止信号和ID搜索定时器 + signalTask?.cancel() + energyTask?.cancel() + searchMarkerTimer?.cancel() + //降低串口电位 gpioManager.setGpioLow("18") binding.stopFreeTaskButton.visibility = View.GONE - if (taskId.isNullOrBlank()) { + if (freeTaskId.isNullOrBlank()) { "任务ID异常,无法提交任务,请联系服务器管理员".show(context) return } - taskId?.apply { + freeTaskId?.apply { taskViewModel.uploadTaskMarker(context, this, ArrayList(ids)) } } @@ -497,42 +552,65 @@ } } + private fun uploadTask(taskId: String, taskCode: String, state: String) { + if (isNetworkConnected()) { + val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) + } else { + "网络连接已断开,请检查".show(this) + } + } + private fun startFreeTask() { AlertInputDialog.Builder().setContext(this).setTitle("新建自由巡检任务") .setHintMessage("请输入自由巡检任务简要描述").setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : AlertInputDialog.OnDialogButtonClickListener { override fun onConfirmClick(value: String) { + freeTaskTitle = value val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String taskViewModel.createFreeTask(context, userId, value) - //调高串口电位 - gpioManager.setGpioHigh("18") - - isFreeTask = true - //自由巡检 - signalTask = object : TimerTask() { - override fun run() { - out?.write('2'.code) - out?.flush() - } - } - searchMarkerTimer = Timer() - searchMarkerTimer?.apply { - schedule(signalTask, 0, 100) - } - - binding.stopFreeTaskButton.visibility = View.VISIBLE + openSerialPort() } override fun onCancelClick() {} }).build().show() } + private fun openSerialPort() { + //调高串口电位 + gpioManager.setGpioHigh("18") + + isFreeTask = true + //自由巡检 + signalTask = object : TimerTask() { + override fun run() { + out.write('2'.code) + out.flush() + } + } + + energyTask = object : TimerTask() { + override fun run() { + out.write('6'.code) + out.flush() + } + } + + searchMarkerTimer = Timer() + searchMarkerTimer?.apply { + schedule(signalTask, 0, 200) + schedule(energyTask, 0, 251) + } + + binding.stopFreeTaskButton.visibility = View.VISIBLE + } + override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) + if (searchNewDialog.isDetectMarker) { + searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() if (markerId.isNumber()) { @@ -540,26 +618,47 @@ } } else if (isFreeTask) { val markerId = hex.take(20).hexToString() + if (markerId.isNumber()) { //只响一次,因为探测频率高,所以依旧是连续的报警声 soundPool.play(soundResourceId, 1f, 1f, 0, 0, 1f) - "标识器${markerId}已探测".show(this) //添加地图Marker if (!ids.contains(markerId)) { //根据markerId查询标识器经纬度 - val labels = DataBaseManager.get.queryLabelById(markerId) - if (labels.isNotEmpty()) { - val bean = labels.first() + val markers = DataBaseManager.get.queryMarkerById(markerId) + if (markers.isNotEmpty()) { + val bean = markers.first() aMap.addMarker( MarkerOptions().position( - LatLng( - bean.latitude.toDouble(), bean.longitude.toDouble() - ) + LatLng(bean.lat.toDouble(), bean.lng.toDouble()) ).icon(BitmapDescriptorFactory.fromResource(R.mipmap.label_blue1)) ) } } ids.add(markerId) + + //显示标识器详细信息 + if (!detailDialog.isShowing) { + val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull() + if (markerBean == null) { + "无法查询到此ID【${markerId}】的信息".show(context) + } else { + detailDialog.setMarker(markerBean) + detailDialog.show() + } + } + } + + if (hex.startsWith("4E")) { + val energyResponse = hex.take(10).hexToString() + try { + val energy = energyResponse.substring(1).toInt() + if (energy <= 500 && detailDialog.isShowing) { + detailDialog.dismiss() + } + } catch (e: NumberFormatException) { + e.printStackTrace() + } } } } @@ -570,31 +669,21 @@ LoadState.Loading -> { if (installDialog.isInstallMarker) { LoadingDialogHub.show(this, "标识器安装中,请稍后...") - } else if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - "标识器${this.markerRealId}已探测!".show(context) -// DataBaseManager.get.updateTaskLabel(this) - } } else { LoadingDialogHub.show(this, "提交工单中,请稍后") } } - else -> { + LoadState.Success -> { if (installDialog.isInstallMarker) { -// installDialog.clearDefaultData() + installDialog.clearDefaultData() installDialog.dismiss() - "${installDialog.markerId}安装成功".show(context) + "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } } @@ -618,8 +707,6 @@ aMap.myLocationStyle = locationStyle//设置定位蓝点的Style aMap.isMyLocationEnabled = true//设置是否显示定位小蓝点 aMap.setOnMyLocationChangeListener { - longitude = it.longitude - latitude = it.latitude //经纬度逆编码 locationHub.antiCodingLocation(it) { address -> binding.currentLocationView.text = address @@ -631,19 +718,20 @@ aMap.setOnMapLongClickListener { lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } - //显示标签 - showLabelsOnMap() } //虽然不用显示附属标签,但是需要和标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } + + //显示标签 + showLabelsOnMap() } //自定义定位按钮 @@ -666,39 +754,28 @@ }) } - private fun saveTaskInformation(it: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String - if (it.message.size > 0) { - it.message.forEach { messageModel -> -// val count = DataBaseManager.get.countTaskById(messageModel.id.toString()) -// if (count == 0) { -// messageModel.taskDetailInfos.forEach { info -> -// DataBaseManager.get.insertTaskInformation( -// userName, -// messageModel.description, -// info.taskId.toString(), -// info.id.toString(), -// info.markerId.toString(), -// info.markerIdReal.toString(), -// info.longitude.toString(), -// info.latitude.toString(), -// messageModel.status -// ) -// } -// } + private fun saveUserTasks(task: TaskModel) { + task.message.forEach { model -> + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) + } } - "工单下载成功!".show(context) } + "工单下载成功!".show(this) } private fun showLabelsOnMap() { clusterOverlay?.onDestroy() val clusterItems = ArrayList() - labelBeans.forEach { - if (it.latitude.isNotEmpty() && it.longitude.isNotEmpty()) { - val latitude = it.latitude.toDouble() - val longitude = it.longitude.toDouble() + markers.forEach { + if (it.lat.isNotEmpty() && it.lng.isNotEmpty()) { + val latitude = it.lat.toDouble() + val longitude = it.lng.toDouble() val latLng = LatLng(latitude, longitude, false) val regionItem = RegionItem(latLng, it.id.toString()) @@ -717,7 +794,6 @@ ) backDrawables[0] = bitmapDrawable } - bitmapDrawable } if (clusterNum == 1) { var bitmapDrawable = backDrawables[1] @@ -780,8 +856,8 @@ override fun onActionItemClick(position: Int) { when (position) { 0 -> { - labelBeans.forEach { - if (it.markerId.toString() == item.tag) { + markers.forEach { + if (it.id.toString() == item.tag) { navigatePageTo(it.toJson()) } } @@ -789,11 +865,11 @@ 1 -> { val electricMarkers = ArrayList() -// smallLabels.forEach { -// if (it.markerId.toString() == item.tag) { -// electricMarkers.add(it.electricMarkerId) -// } -// } + smallMarkers.forEach { + if (it.id.toString() == item.tag) { + electricMarkers.add(it.electricMarkerId) + } + } if (electricMarkers.isEmpty()) { "此标识器没有绑定的电子标签".show(context) @@ -818,44 +894,32 @@ }.show() } - private fun detectRedrawGraphic(taskId: String) { -// val tasks = DataBaseManager.get.queryTaskById(taskId) -// if (tasks.isNotEmpty()) { -// tasks.forEach { -// val latLng = LatLng(it.lat.toDouble(), it.lng.toDouble()) -// val otMarkerOptions = MarkerOptions() -// otMarkerOptions.position(latLng) -// otMarkerOptions.visible(true) // 设置可见 -// if (it.state == "未开始") { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_red1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } else { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } -// aMap.addMarker(otMarkerOptions) -// } -// } + private fun detectRedrawGraphic(task: TaskDetailLocalModel) { + task.markerModels.forEach { + val latLng = LatLng(it.lat, it.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (it.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } + aMap.addMarker(otMarkerOptions) + } showLabelsOnMap() } - private fun uploadTask(taskId: String?, state: String) { - if (isNetworkConnected()) { - val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String - taskViewModel.uploadTask(userId, taskId, state) - } else { - "网络连接已断开,请检查".show(this) - } - } - //更新数据 - private fun updateLabels() { + private fun updateMarkers() { AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") .setNegativeButton("取消").setPositiveButton("确定") .setOnDialogButtonClickListener(object : @@ -941,7 +1005,7 @@ SensorManager.getOrientation(rotationMatrix, valueArray) val degree = ((360f + valueArray[0] * 180f / Math.PI) % 360).toInt() -// searchNewDialog.updateDegreeValue(degree) + searchNewDialog.updateDegreeValue(degree) } } return true @@ -953,8 +1017,8 @@ super.onResume() binding.mapView.onResume() lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } //显示标签 showLabelsOnMap() @@ -962,9 +1026,9 @@ //虽然不用显示附属标签,但是需要喝标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } //注册加速度传感器监听 @@ -990,8 +1054,6 @@ override fun onDestroy() { super.onDestroy() binding.mapView.onDestroy() - signalTask?.cancel() - searchMarkerTimer?.cancel() soundPool.release() locationHub.stopLocation() //降低串口电位 @@ -1006,6 +1068,7 @@ private val realPaths = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var countDownTimer: CountDownTimer + private lateinit var locationManager: LocationHub var isReadMarker = false var isInstallMarker = false @@ -1150,8 +1213,8 @@ soundPool.play(soundResourceId, 1f, 1f, 0, -1, 1f) - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() countDownTimer = object : CountDownTimer(5 * 1000, 1000) { override fun onTick(millisUntilFinished: Long) { @@ -1174,6 +1237,21 @@ } } + override fun show() { + super.show() + locationManager = LocationHub(context) + locationManager.getCurrentLocation(true, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + if (location != null) { + binding.markerAttrInclude.lngView.text = location.longitude.toString() + binding.markerAttrInclude.latView.text = location.latitude.toString() + } else { + "当前位置信号差,无法获取定位".show(context) + } + } + }) + } + fun bindingValue(markerId: String) { this.markerId = markerId LoadingDialogHub.dismiss() @@ -1193,6 +1271,7 @@ gpioManager.setGpioLow("18") soundPool.autoPause() isInstallMarker = false + locationManager.stopLocation() super.dismiss() } @@ -1515,6 +1594,21 @@ }) } + //清除默认数据 + fun clearDefaultData() { +// "markerObjectTypeView".setDefaultValue("") +// "pipelineDiameterView".setDefaultValue("") +// "buryDeepView".setDefaultValue("") +// "bottomPipeDiameterView".setDefaultValue("") +// "bottomPointDeepView".setDefaultValue("") +// "areaView".setDefaultValue("") +// "lineView".setDefaultValue("") +// "roadView".setDefaultValue("") +// "ownerView".setDefaultValue("") +// "identifierDeepView".setDefaultValue("") +// "personDeptView".setDefaultValue("") + } + //根据选择类型控制界面某些区域显隐 private fun setLayoutVisibility(vararg args: Int) { binding.objectAttrInclude.objectModeLayout.visibility = args[0] @@ -1566,21 +1660,23 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(context: Context) : Dialog(context) { + /**探测标识器新对话框******************************************************************************/ + inner class SearchMarkerNewDialog(context: Context) : Dialog(context) { - private val binding: DialogSearchMarkerBinding by binding() - private val decimal by lazy { DecimalFormat("0.0") } - private val degreeCache by lazy { HashMap() } - private var isPlaying = false + private val taskId by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String + } + private val taskCode by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_CODE, "") as String + } + private val binding: DialogSearchMarkerNewBinding by binding() private var markerId = "" private lateinit var searchMarkerTimer: Timer private lateinit var signalTask: TimerTask private lateinit var energyTask: TimerTask private lateinit var countDownTimer: CountDownTimer - + private lateinit var locationManager: LocationHub var isDetectMarker = false - var taskBean: TaskBean? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -1590,47 +1686,111 @@ energyTask.cancel() searchMarkerTimer.cancel() - out?.write('3'.code) -// val result = DataBaseManager.get.queryLabelById(markerId) -// if (result.isNotEmpty()) { -// val tag = when (result.first().identifierType) { -// "EM30" -> '7' -// "EM50" -> '8' -// "EM14" -> '9' -// else -> '1' -// } -// if (tag == '1') { -// "此标识器无法读取埋深!".show(context) -// } else { -// // 发送读取标识器埋设深度指令 -// LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") -// out.write(tag.code) -// out.flush() -// countDownTimer = object : CountDownTimer(15 * 1000, 1000) { -// override fun onTick(millisUntilFinished: Long) { -// -// } -// -// override fun onFinish() { -// LoadingDialogHub.dismiss() -// "探测此标识器深度超时,请重试".show(context) -// initTimer() -// } -// } -// countDownTimer.start() -// } -// } else { -// "标识器未安装,安装成功后才可读取埋深!".show(context) -// } + out.write('3'.code) + val result = DataBaseManager.get.queryMarkerById(markerId) + if (result.isNotEmpty()) { + val tag = when (result.first().markerType) { + "EM30" -> '7' + "EM50" -> '8' + "EM14" -> '9' + else -> '1' + } + if (tag == '1') { + "此标识器无法读取埋深!".show(context) + initTimer() + } else { + // 发送读取标识器埋设深度指令 + LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") + out.write(tag.code) + out.flush() + countDownTimer = object : CountDownTimer(15 * 1000, 1000) { + override fun onTick(millisUntilFinished: Long) { + + } + + override fun onFinish() { + LoadingDialogHub.dismiss() + "探测此标识器深度超时,请重试".show(context) + initTimer() + } + } + countDownTimer.start() + } + } else { + "标识器未安装,安装成功后才可读取埋深!".show(context) + initTimer() + } } binding.markerInfoButton.setOnClickListener { //查库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isNotEmpty()) { -// context.navigatePageTo(result.first().toJson()) + context.navigatePageTo(result.first().toJson()) } else { -// context.navigatePageTo(markerId) + context.navigatePageTo(markerId) + } + } + } + + override fun show() { + super.show() + locationManager = LocationHub(context) + //点位渲染,每次定位都计算当前位置与符合条件的点距离 + locationManager.getCurrentLocation(false, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + location?.apply { + renderDataPoint(this) + } + } + }) + } + + /** + * 计算并渲染数据点。点太多采用协程计算,不然会有点卡顿 + * @param location 定位点(天宝RTK获取) + * */ + private fun renderDataPoint(location: AMapLocation) { + val longitude = location.longitude + val latitude = location.latitude + lifecycleScope.launch(Dispatchers.IO) { + val dataPoints = ArrayList() + DataBaseManager.get.loadMarkers().forEach { + val distance = AMapUtils.calculateLineDistance( + LatLng(it.lat.toDouble(), it.lng.toDouble()), LatLng(latitude, longitude) + ) + val formatDistance = decimalFormat.format(distance).toFloat() + if (formatDistance <= LocaleConstant.MAX_DISTANCE) { + val angle = atan2( + (it.lat.toDouble() - latitude), (it.lng.toDouble() - longitude) + ) + Math.PI + val formatAngle = decimalFormat.format(angle).toDouble() + + "[$longitude, $latitude,$formatDistance, $formatAngle]".writeToFile( + createLogFile() + ) + dataPoints.add(RadarScanView.DataPoint(formatAngle, formatDistance)) + } + } + withContext(Dispatchers.Main) { + binding.radarScanView.renderPointData(dataPoints, + object : RadarScanView.OnGetNearestPointCallback { + override fun getNearestPoint(point: RadarScanView.DataPoint?) { + if (point == null) { + binding.distanceValueView.text = "大于5.5m" + binding.distancePgBar.progress = 100 + } else { + binding.distanceValueView.text = "${point.distance}m" + val progress = + if (point.distance > LocaleConstant.MAX_DISTANCE) { + 100 + } else { + (point.distance / LocaleConstant.MAX_DISTANCE) * 100 + } + binding.distancePgBar.progress = progress.toInt() + } + } + }) } } } @@ -1644,60 +1804,33 @@ isDetectMarker = true - //角度 - degreeCache["lastDegree"] = 0f + if (isExecuteTask) { + binding.taskStateView.visibility = View.GONE + binding.taskStateView.isSelected = false + } else { + binding.taskStateView.visibility = View.VISIBLE + binding.taskStateView.isSelected = true + } } fun bindingValue(hex: String) { if (hex.startsWith("4E")) { try { //4E转为String为N,代表能量值 - //用能量值转动表盘 val energyResponse = hex.take(10).hexToString() val energy = energyResponse.substring(1).toInt() if (energy >= 4000) { - isPlaying = if (!isPlaying) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(fastSoundResourceId) - false - } + soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) } else { - isPlaying = if (!isPlaying) { - soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(slowSoundResourceId) - false - } + soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) } - binding.resultTextView.text = "信号能量值:${energyResponse}" - - //转换为转动的角度 - val degree = (energy.toFloat() / (50 * 100)) * 180 - binding.energyValueView.text = decimal.format(degree) - - degreeCache["lastDegree"]?.apply { - val animation = RotateAnimation( - this, - degree, - Animation.RELATIVE_TO_SELF, - 0.5f, - Animation.RELATIVE_TO_SELF, - 0.5f - ) - animation.duration = 0 - animation.fillAfter = true - binding.needleView.startAnimation(animation) - } - - //保存旋转后的角度 - degreeCache["lastDegree"] = degree + //通过设置进度条表示能量值 + binding.energyPgBar.progress = energy + binding.energyValueView.text = "${energy}dB" if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" + binding.energyTipsView.text = "信号较弱,可能距离较远" binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) @@ -1712,11 +1845,11 @@ binding.searchResultView.setTextColor(Color.parseColor("#8D1717")) binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } else if (energy >= 4100) {//148° - binding.energyTipsView.text = "标识器信号极强,可能在正下方" + binding.energyTipsView.text = "信号极强,接近标识器正上方" binding.energyTipsView.setTextColor(Color.parseColor("#428d00")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" + binding.energyTipsView.text = "已靠近,请继续移动位置" binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } @@ -1757,31 +1890,37 @@ binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) //自动上传标识器 -// taskBean = DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") -// taskBean?.apply { -// /** -// * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 -// * */ -// taskViewModel.uploadMarker(taskCode) -// } + if (isExecuteTask) { + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) + } + } } } } + //更新罗盘角度 + fun updateDegreeValue(degree: Int) { + binding.radarScanView.setDegreeValue(degree) + } + private fun initTimer() { searchMarkerTimer = Timer() signalTask = object : TimerTask() { override fun run() { - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() } } energyTask = object : TimerTask() { override fun run() { - out?.write('6'.code) - out?.flush() + out.write('6'.code) + out.flush() } } @@ -1798,6 +1937,7 @@ gpioManager.setGpioLow("18") isDetectMarker = false soundPool.autoPause() + locationManager.stopLocation() super.dismiss() } } diff --git a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt index f092eb0..040eb10 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt @@ -5,7 +5,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.LabelBean +import com.casic.electric.detector.bean.MarkerLocalBean import com.casic.electric.detector.databinding.ActivityObjectDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.FileType @@ -23,7 +23,7 @@ private val kTag = "ObjectDetailActivity" private val context: Context = this@ObjectDetailActivity private val gson by lazy { Gson() } - private lateinit var labelBean: LabelBean + private lateinit var markerLocalBean: MarkerLocalBean override fun initOnCreate(savedInstanceState: Bundle?) { window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) @@ -36,37 +36,37 @@ val objectJson = intent.getStringExtra(Constant.INTENT_PARAM)!! try { - labelBean = gson.fromJson(objectJson, object : TypeToken() {}.type) + markerLocalBean = gson.fromJson(objectJson, object : TypeToken() {}.type) - binding.markerObjTypeView.text = labelBean.markerObjType - binding.markerNumberView.text = labelBean.markerNumber - binding.objectNameView.text = labelBean.objectName - binding.voltageLevelView.text = labelBean.voltageLevel - binding.transformerModelView.text = labelBean.transformerModel - binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial - binding.sizeView.text = labelBean.size - binding.bottomDepthView.text = labelBean.bottomDepth - binding.jointCountView.text = labelBean.jointCount - binding.casingMaterialView.text = labelBean.casingMaterial - binding.casingSpecView.text = labelBean.casingSpec - binding.constructTimeView.text = labelBean.constructTime - binding.inspectionUnitView.text = labelBean.inspectionUnit - binding.areaView.text = labelBean.area - binding.roadView.text = labelBean.road - binding.memo1View.text = labelBean.memo1 - binding.memo2View.text = labelBean.memo2 - binding.memo3View.text = labelBean.memo3 - binding.markerIdView.text = labelBean.markerId - binding.markerTypeView.text = labelBean.markerType - binding.ownerView.text = labelBean.owner - binding.markerDepthView.text = labelBean.markerDepth - binding.electricTagCountView.text = labelBean.electricTagCount - binding.installedTimeView.text = labelBean.installedTime - binding.longitudeView.text = labelBean.longitude - binding.latitudeView.text = labelBean.latitude - binding.markerMemo1View.text = labelBean.markerMemo1 - binding.markerMemo2View.text = labelBean.markerMemo2 - binding.markerMemo3View.text = labelBean.markerMemo3 +// binding.markerObjTypeView.text = labelBean.markerObjType +// binding.markerNumberView.text = labelBean.markerNumber +// binding.objectNameView.text = labelBean.objectName +// binding.voltageLevelView.text = labelBean.voltageLevel +// binding.transformerModelView.text = labelBean.transformerModel +// binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial +// binding.sizeView.text = labelBean.size +// binding.bottomDepthView.text = labelBean.bottomDepth +// binding.jointCountView.text = labelBean.jointCount +// binding.casingMaterialView.text = labelBean.casingMaterial +// binding.casingSpecView.text = labelBean.casingSpec +// binding.constructTimeView.text = labelBean.constructTime +// binding.inspectionUnitView.text = labelBean.inspectionUnit +// binding.areaView.text = labelBean.area +// binding.roadView.text = labelBean.road +// binding.memo1View.text = labelBean.memo1 +// binding.memo2View.text = labelBean.memo2 +// binding.memo3View.text = labelBean.memo3 +// binding.markerIdView.text = labelBean.markerId +// binding.markerTypeView.text = labelBean.markerType +// binding.ownerView.text = labelBean.owner +// binding.markerDepthView.text = labelBean.markerDepth +// binding.electricTagCountView.text = labelBean.electricTagCount +// binding.installedTimeView.text = labelBean.installedTime +// binding.longitudeView.text = labelBean.longitude +// binding.latitudeView.text = labelBean.latitude +// binding.markerMemo1View.text = labelBean.markerMemo1 +// binding.markerMemo2View.text = labelBean.markerMemo2 +// binding.markerMemo3View.text = labelBean.markerMemo3 } catch (e: NumberFormatException) { e.printStackTrace() } @@ -77,7 +77,7 @@ binding.showImageView.setOnClickListener { //查数据库 - if (labelBean.imagePath.isNullOrEmpty()) { + if (markerLocalBean.imagePath.isNullOrEmpty()) { "此标识器无图片".show(context) } else { val realPaths: ArrayList = ArrayList() //真实图片路径 @@ -85,7 +85,7 @@ /** * /images/markers/202307/0008818922_EVENT_20230704_160349_0_1.jpg,/images/markers/202307/0008818922_EVENT_20230704_160406_0_2.jpg * */ - val imagePath = labelBean.imagePath + val imagePath = markerLocalBean.imagePath if (imagePath.contains(",")) { val list = imagePath.split(",") list.forEach { path -> diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt index 837ae86..2f1bb58 100644 --- a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt @@ -276,7 +276,7 @@ //先存本地 lifecycleScope.launch { withContext(Dispatchers.IO) { - DataBaseManager.get.insertSmallLabel(smallLabelData) +// DataBaseManager.get.insertSmallLabel(smallLabelData) } } @@ -339,7 +339,7 @@ gpioManager.setGpioLow("18") //查本地库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isEmpty()) { binding.objectAttrInclude.markerIdView.text = markerId } else { diff --git a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt index d3ffdd3..a5834bd 100644 --- a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt @@ -6,6 +6,7 @@ import android.app.Dialog import android.content.Context import android.content.DialogInterface +import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable @@ -19,16 +20,16 @@ import android.os.CountDownTimer import android.os.Handler import android.os.Message +import android.util.Log import android.view.KeyEvent import android.view.View -import android.view.animation.Animation -import android.view.animation.RotateAnimation import android.widget.AdapterView import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import com.amap.api.location.AMapLocation import com.amap.api.maps.AMap import com.amap.api.maps.AMapOptions +import com.amap.api.maps.AMapUtils import com.amap.api.maps.CameraUpdateFactory import com.amap.api.maps.CoordinateConverter import com.amap.api.maps.model.BitmapDescriptorFactory @@ -39,8 +40,9 @@ import com.casic.electric.detector.R import com.casic.electric.detector.adapter.EditableImageAdapter import com.casic.electric.detector.base.SerialPortActivity -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.TaskBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean import com.casic.electric.detector.callback.OnGetLocationListener import com.casic.electric.detector.callback.OnImageCompressListener import com.casic.electric.detector.cluster.ClusterItem @@ -49,9 +51,10 @@ import com.casic.electric.detector.databinding.ActivityMainBinding import com.casic.electric.detector.databinding.DialogInstallMarkerBinding import com.casic.electric.detector.databinding.DialogInstallSmallMarkerBinding -import com.casic.electric.detector.databinding.DialogSearchMarkerBinding +import com.casic.electric.detector.databinding.DialogSearchMarkerNewBinding import com.casic.electric.detector.extensions.appendExcelDownloadUrl import com.casic.electric.detector.extensions.compressImage +import com.casic.electric.detector.extensions.createTaskCode import com.casic.electric.detector.extensions.drawCircle import com.casic.electric.detector.extensions.getDefaultValue import com.casic.electric.detector.extensions.hexToString @@ -61,6 +64,7 @@ import com.casic.electric.detector.extensions.setDefaultValue import com.casic.electric.detector.extensions.show import com.casic.electric.detector.extensions.toHex +import com.casic.electric.detector.model.TaskDetailLocalModel import com.casic.electric.detector.model.TaskModel import com.casic.electric.detector.utils.DataBaseManager import com.casic.electric.detector.utils.ExcelHub @@ -70,9 +74,10 @@ import com.casic.electric.detector.utils.LocationHub import com.casic.electric.detector.utils.RouteOnMap import com.casic.electric.detector.vm.TaskViewModel +import com.casic.electric.detector.widgets.MarkerDetailDialog import com.casic.electric.detector.widgets.QueryMarkerDialog +import com.casic.electric.detector.widgets.RadarScanView import com.casic.electric.detector.widgets.SamplePopupWindow -import com.google.gson.Gson import com.luck.picture.lib.basic.PictureSelector import com.luck.picture.lib.config.SelectMimeType import com.luck.picture.lib.entity.LocalMedia @@ -81,8 +86,10 @@ import com.pengxh.kt.lite.extensions.binding import com.pengxh.kt.lite.extensions.convertColor import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.createLogFile import com.pengxh.kt.lite.extensions.dateToTimestamp import com.pengxh.kt.lite.extensions.dp2px +import com.pengxh.kt.lite.extensions.getSystemService import com.pengxh.kt.lite.extensions.initDialogLayoutParams import com.pengxh.kt.lite.extensions.isNetworkConnected import com.pengxh.kt.lite.extensions.navigatePageTo @@ -90,6 +97,7 @@ import com.pengxh.kt.lite.extensions.timestampToCompleteDate import com.pengxh.kt.lite.extensions.timestampToTime import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.extensions.writeToFile import com.pengxh.kt.lite.utils.FileDownloadManager import com.pengxh.kt.lite.utils.LoadState import com.pengxh.kt.lite.utils.LoadingDialogHub @@ -103,47 +111,50 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File +import java.math.RoundingMode import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer import java.util.TimerTask +import kotlin.math.atan2 @SuppressLint("all") class MainActivity : SerialPortActivity(), SensorEventListener, Handler.Callback { private val kTag = "MainActivity" - private val context = this@MainActivity + private val context = this private val samplePopupWindow by lazy { SamplePopupWindow(this) } - private val gson by lazy { Gson() } private val regionRadius by lazy { LocaleConstant.RADIUS_SIZE.dp2px(this) } private val backDrawables by lazy { HashMap() } private val installDialog by lazy { InstallMarkerDialog(this) } - private val searchDialog by lazy { SearchMarkerDialog(this) } + private val searchNewDialog by lazy { SearchMarkerNewDialog(this) } + private val detailDialog by lazy { MarkerDetailDialog(this) } + private val locationHub by lazy { LocationHub(this) } + private val decimalFormat by lazy { DecimalFormat("0.00") } private val sensorMessageCode = 2024022301 private val rotationMatrix = FloatArray(9)//旋转矩阵缓存 private val valueArray = FloatArray(3)//方位角数值 private var clickTime: Long = 0 - private var labelBeans = ArrayList() + private var markers = ArrayList() + private var smallMarkers = ArrayList() private var clusterOverlay: ClusterOverlay? = null - private var latitude: Double = 0.0 - private var longitude: Double = 0.0 private var isFreeTask = false + private var freeTaskTitle = "" private var ids = HashSet() private var signalTask: TimerTask? = null + private var energyTask: TimerTask? = null private var searchMarkerTimer: Timer? = null - private var taskId: String? = null + private var freeTaskId: String? = null private var gravity: FloatArray? = null private var geomagnetic: FloatArray? = null private lateinit var aMap: AMap - private lateinit var task: TaskBean private lateinit var sensorManager: SensorManager private lateinit var weakReferenceHandler: WeakReferenceHandler /***inner class 需要用到*****start*/ private val gpioManager by lazy { GpioManager() } - private val locationHub by lazy { LocationHub(this) } private val taskViewModel by lazy { ViewModelProvider(this)[TaskViewModel::class.java] } private val attr = AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ALARM) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build() @@ -168,6 +179,9 @@ slowSoundResourceId = soundPool.load(this, R.raw.ring4, 1) fastSoundResourceId = soundPool.load(this, R.raw.ring2, 1) + //保留小数2位 + decimalFormat.roundingMode = RoundingMode.HALF_UP + "登录成功".show(this) //地图初始化 @@ -177,12 +191,14 @@ samplePopupWindow.setPopupMenuItem(LocaleConstant.POPUP_TITLES) samplePopupWindow.setBackgroundDrawable(null) + sensorManager = getSystemService()!! + weakReferenceHandler = WeakReferenceHandler(this) + //task网络请求监听 taskViewModel.markerFileResult.observe(this) { if (it.success == "true") { //清空之前的数据 - DataBaseManager.get.clearLabels() - DataBaseManager.get.clearSmallLabels() + DataBaseManager.get.clearMarkers() /** * "data":"/xls/marker1.xls,/xls/smallMarker1.xls" * 有两份excel表格需要下载 @@ -200,10 +216,10 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { - labelBeans = ExcelHub.readLabel(file.absolutePath) + markers = ExcelHub.readLabel(file.absolutePath) withContext(Dispatchers.IO) { - labelBeans.forEach { label -> - DataBaseManager.get.insertLabel(label) + markers.forEach { marker -> + DataBaseManager.get.saveMarkerInLocale(marker) } } LoadingDialogHub.dismiss() @@ -227,12 +243,12 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { -// smallLabels = ExcelHub.readSmallLabel(file.absolutePath) -// withContext(Dispatchers.IO) { -// smallLabels.forEach { label -> -// DataBaseManager.get.insertSmallLabel(label) -// } -// } + smallMarkers = ExcelHub.readSmallLabel(file.absolutePath) + withContext(Dispatchers.IO) { + smallMarkers.forEach { marker -> + DataBaseManager.get.saveSmallMarkerInLocale(marker) + } + } } } @@ -250,18 +266,35 @@ taskViewModel.taskResult.observe(this) { if (it.success == "true") { //清空之前的数据 -// DataBaseManager.get.clearTasks() AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") .setMessage("您有${it.message.size}个新任务!").setPositiveButton("知道了") .setOnDialogButtonClickListener(object : AlertMessageDialog.OnDialogButtonClickListener { override fun onConfirmClick() { - saveTaskInformation(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { + freeTaskId = it + // 自由巡检保存在本地 + val bean = TaskLocalBean() + bean.id = freeTaskId.toString().toLong() + val currentTimeMillis = System.currentTimeMillis() + bean.taskCode = currentTimeMillis.createTaskCode() + bean.description = freeTaskTitle + val time = currentTimeMillis.timestampToCompleteDate() + bean.createTime = time + bean.status = "0" + val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + bean.createUserName = userName + bean.startTime = time + bean.endTime = "" + bean.isFreeTask = "1" + DataBaseManager.get.saveTaskInLocale(bean) + } + taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -290,10 +323,11 @@ }).build().show() } else { lifecycleScope.launch(Dispatchers.Main) { - val labels = withContext(Dispatchers.IO) { - DataBaseManager.get.queryLabelById("0") + val markers = withContext(Dispatchers.IO) { + DataBaseManager.get.queryMarkerByState("0") } - if (labels.isNotEmpty()) { + //如果有需要补全的标识器,Popup右侧会有小圆点提示 + if (markers.isNotEmpty()) { samplePopupWindow.setShowPosition(4) } val x = @@ -307,37 +341,42 @@ SamplePopupWindow.OnPopupWindowClickListener { override fun onPopupItemClicked(position: Int) { when (position) { - 0 -> updateLabels() + 0 -> updateMarkers() 1 -> downloadTask() 2 -> navigatePageTo() 3 -> uploadEvent() -// 4 -> uploadLabel() +// 4 -> completionMarker() } } }) //安装。上传,然后存入本地库 binding.installButton.setOnClickListener { - AlertControlDialog.Builder().setContext(context).setTitle("提示") - .setMessage("请选择安装对象").setPositiveButton("标识器") - .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - //标识器 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installMarkerDialog.show() - } + if (isFreeTask) { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("正在自由巡检任务中,请完成此次任务之后再使用此功能") + .setPositiveButton("好的").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { - override fun onCancelClick() { - //电子标签 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installSmallMarkerDialog.show() - } - }).build().show() + } + }).build().show() + } else { + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择安装对象").setPositiveButton("标识器") + .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + //标识器 +// installMarkerDialog.show() + } + + override fun onCancelClick() { + //电子标签 +// installSmallMarkerDialog.show() + } + }).build().show() + } } //查看 @@ -351,24 +390,24 @@ ) { //查询数据库 lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { + markers = withContext(Dispatchers.IO) { if (contentValue.size == 1) { - DataBaseManager.get.loadLabelByCondition( + DataBaseManager.get.loadMarkerByCondition( selectedCondition, contentValue[0] - ) as ArrayList + ) as ArrayList } else { DataBaseManager.get.loadLabelByDate( contentValue[0], contentValue[1] - ) as ArrayList + ) as ArrayList } } val latitudeList = ArrayList() val longitudeList = ArrayList() - labelBeans.forEach { - val latitude = it.latitude - val longitude = it.longitude + markers.forEach { + val latitude = markers.first().lat + val longitude = markers.first().lng if (latitude.isNotBlank() && longitude.isNotBlank()) { if (CoordinateConverter.isAMapDataAvailable( latitude.toDouble(), longitude.toDouble() @@ -400,52 +439,63 @@ //巡检 binding.inspectionButton.setOnClickListener { -// val task = DataBaseManager.get.queryDistinctTask() -// if (task.isNotEmpty()) { -// val arrayList = ArrayList() -// task.forEachIndexed { index, taskBean -> -// arrayList.add("任务${index + 1}:${taskBean.taskId},${taskBean.desc}") -// } -// -// BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) -// .setActionItemTitle(arrayList) -// .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { -// override fun onActionItemClick(position: Int) { -// val taskBean = task[position] -// SaveKeyValues.putValue(LocaleConstant.TASK_ID, taskBean.taskId) -// AlertControlDialog.Builder().setContext(context).setTitle("提示") -// .setMessage("请选择操作方式").setPositiveButton("执行工单") -// .setNegativeButton("提交工单") -// .setOnDialogButtonClickListener(object : -// AlertControlDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// detectRedrawGraphic(taskBean.taskId) -// -// val latLng = LatLng( -// taskBean.lat.toDouble(), taskBean.lng.toDouble() -// ) -// aMap.moveCamera( -// CameraUpdateFactory.newLatLngZoom(latLng, 16f) -// ) -// uploadTask(taskBean.taskId, "1") -// } -// -// override fun onCancelClick() { -// uploadTask(taskBean.taskId, "2") -// } -// }).build().show() -// } -// }).build().show() -// } else { -// AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") -// .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") -// .setPositiveButton("知道了").setOnDialogButtonClickListener(object : -// AlertMessageDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// startFreeTask() -// } -// }).build().show() -// } + val tasks = DataBaseManager.get.loadLocalTask() + if (tasks.isNotEmpty()) { + val arrayList = ArrayList() + tasks.forEachIndexed { index, task -> + arrayList.add("任务${index + 1}:${task.taskId},${task.description}") + } + + BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) + .setActionItemTitle(arrayList) + .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { + override fun onActionItemClick(position: Int) { + val task = tasks[position] + Log.d(kTag, task.toJson()) + SaveKeyValues.putValue(LocaleConstant.TASK_ID, task.taskId) + SaveKeyValues.putValue(LocaleConstant.TASK_CODE, task.taskCode) + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择操作方式").setPositiveButton("执行工单") + .setNegativeButton("提交工单") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + if (task.markerModels.isNotEmpty()) { + //移到Task下属第一个标识器位置 + val firstMarker = task.markerModels.first() + val latLng = LatLng(firstMarker.lat, firstMarker.lng) + aMap.moveCamera( + CameraUpdateFactory.newLatLngZoom(latLng, 16f) + ) + //执行工单 + uploadTask(task.taskId, task.taskCode, "1") + detectRedrawGraphic(task) + isExecuteTask = true + } else { + "此工单下无标识器,将执行自由巡检任务".show(context) + freeTaskId = task.taskId + openSerialPort() + } + } + + override fun onCancelClick() { + //提交工单 + uploadTask(task.taskId, task.taskCode, "2") + isExecuteTask = false + } + }).build().show() + } + }).build().show() + } else { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") + .setPositiveButton("知道了").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + startFreeTask() + } + }).build().show() + } } //探测 @@ -465,7 +515,7 @@ } }).build().show() } else { - searchDialog.show() + searchNewDialog.show() } } @@ -479,16 +529,21 @@ isFreeTask = false soundPool.autoPause() + //停止信号和ID搜索定时器 + signalTask?.cancel() + energyTask?.cancel() + searchMarkerTimer?.cancel() + //降低串口电位 gpioManager.setGpioLow("18") binding.stopFreeTaskButton.visibility = View.GONE - if (taskId.isNullOrBlank()) { + if (freeTaskId.isNullOrBlank()) { "任务ID异常,无法提交任务,请联系服务器管理员".show(context) return } - taskId?.apply { + freeTaskId?.apply { taskViewModel.uploadTaskMarker(context, this, ArrayList(ids)) } } @@ -497,42 +552,65 @@ } } + private fun uploadTask(taskId: String, taskCode: String, state: String) { + if (isNetworkConnected()) { + val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) + } else { + "网络连接已断开,请检查".show(this) + } + } + private fun startFreeTask() { AlertInputDialog.Builder().setContext(this).setTitle("新建自由巡检任务") .setHintMessage("请输入自由巡检任务简要描述").setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : AlertInputDialog.OnDialogButtonClickListener { override fun onConfirmClick(value: String) { + freeTaskTitle = value val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String taskViewModel.createFreeTask(context, userId, value) - //调高串口电位 - gpioManager.setGpioHigh("18") - - isFreeTask = true - //自由巡检 - signalTask = object : TimerTask() { - override fun run() { - out?.write('2'.code) - out?.flush() - } - } - searchMarkerTimer = Timer() - searchMarkerTimer?.apply { - schedule(signalTask, 0, 100) - } - - binding.stopFreeTaskButton.visibility = View.VISIBLE + openSerialPort() } override fun onCancelClick() {} }).build().show() } + private fun openSerialPort() { + //调高串口电位 + gpioManager.setGpioHigh("18") + + isFreeTask = true + //自由巡检 + signalTask = object : TimerTask() { + override fun run() { + out.write('2'.code) + out.flush() + } + } + + energyTask = object : TimerTask() { + override fun run() { + out.write('6'.code) + out.flush() + } + } + + searchMarkerTimer = Timer() + searchMarkerTimer?.apply { + schedule(signalTask, 0, 200) + schedule(energyTask, 0, 251) + } + + binding.stopFreeTaskButton.visibility = View.VISIBLE + } + override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) + if (searchNewDialog.isDetectMarker) { + searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() if (markerId.isNumber()) { @@ -540,26 +618,47 @@ } } else if (isFreeTask) { val markerId = hex.take(20).hexToString() + if (markerId.isNumber()) { //只响一次,因为探测频率高,所以依旧是连续的报警声 soundPool.play(soundResourceId, 1f, 1f, 0, 0, 1f) - "标识器${markerId}已探测".show(this) //添加地图Marker if (!ids.contains(markerId)) { //根据markerId查询标识器经纬度 - val labels = DataBaseManager.get.queryLabelById(markerId) - if (labels.isNotEmpty()) { - val bean = labels.first() + val markers = DataBaseManager.get.queryMarkerById(markerId) + if (markers.isNotEmpty()) { + val bean = markers.first() aMap.addMarker( MarkerOptions().position( - LatLng( - bean.latitude.toDouble(), bean.longitude.toDouble() - ) + LatLng(bean.lat.toDouble(), bean.lng.toDouble()) ).icon(BitmapDescriptorFactory.fromResource(R.mipmap.label_blue1)) ) } } ids.add(markerId) + + //显示标识器详细信息 + if (!detailDialog.isShowing) { + val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull() + if (markerBean == null) { + "无法查询到此ID【${markerId}】的信息".show(context) + } else { + detailDialog.setMarker(markerBean) + detailDialog.show() + } + } + } + + if (hex.startsWith("4E")) { + val energyResponse = hex.take(10).hexToString() + try { + val energy = energyResponse.substring(1).toInt() + if (energy <= 500 && detailDialog.isShowing) { + detailDialog.dismiss() + } + } catch (e: NumberFormatException) { + e.printStackTrace() + } } } } @@ -570,31 +669,21 @@ LoadState.Loading -> { if (installDialog.isInstallMarker) { LoadingDialogHub.show(this, "标识器安装中,请稍后...") - } else if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - "标识器${this.markerRealId}已探测!".show(context) -// DataBaseManager.get.updateTaskLabel(this) - } } else { LoadingDialogHub.show(this, "提交工单中,请稍后") } } - else -> { + LoadState.Success -> { if (installDialog.isInstallMarker) { -// installDialog.clearDefaultData() + installDialog.clearDefaultData() installDialog.dismiss() - "${installDialog.markerId}安装成功".show(context) + "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } } @@ -618,8 +707,6 @@ aMap.myLocationStyle = locationStyle//设置定位蓝点的Style aMap.isMyLocationEnabled = true//设置是否显示定位小蓝点 aMap.setOnMyLocationChangeListener { - longitude = it.longitude - latitude = it.latitude //经纬度逆编码 locationHub.antiCodingLocation(it) { address -> binding.currentLocationView.text = address @@ -631,19 +718,20 @@ aMap.setOnMapLongClickListener { lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } - //显示标签 - showLabelsOnMap() } //虽然不用显示附属标签,但是需要和标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } + + //显示标签 + showLabelsOnMap() } //自定义定位按钮 @@ -666,39 +754,28 @@ }) } - private fun saveTaskInformation(it: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String - if (it.message.size > 0) { - it.message.forEach { messageModel -> -// val count = DataBaseManager.get.countTaskById(messageModel.id.toString()) -// if (count == 0) { -// messageModel.taskDetailInfos.forEach { info -> -// DataBaseManager.get.insertTaskInformation( -// userName, -// messageModel.description, -// info.taskId.toString(), -// info.id.toString(), -// info.markerId.toString(), -// info.markerIdReal.toString(), -// info.longitude.toString(), -// info.latitude.toString(), -// messageModel.status -// ) -// } -// } + private fun saveUserTasks(task: TaskModel) { + task.message.forEach { model -> + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) + } } - "工单下载成功!".show(context) } + "工单下载成功!".show(this) } private fun showLabelsOnMap() { clusterOverlay?.onDestroy() val clusterItems = ArrayList() - labelBeans.forEach { - if (it.latitude.isNotEmpty() && it.longitude.isNotEmpty()) { - val latitude = it.latitude.toDouble() - val longitude = it.longitude.toDouble() + markers.forEach { + if (it.lat.isNotEmpty() && it.lng.isNotEmpty()) { + val latitude = it.lat.toDouble() + val longitude = it.lng.toDouble() val latLng = LatLng(latitude, longitude, false) val regionItem = RegionItem(latLng, it.id.toString()) @@ -717,7 +794,6 @@ ) backDrawables[0] = bitmapDrawable } - bitmapDrawable } if (clusterNum == 1) { var bitmapDrawable = backDrawables[1] @@ -780,8 +856,8 @@ override fun onActionItemClick(position: Int) { when (position) { 0 -> { - labelBeans.forEach { - if (it.markerId.toString() == item.tag) { + markers.forEach { + if (it.id.toString() == item.tag) { navigatePageTo(it.toJson()) } } @@ -789,11 +865,11 @@ 1 -> { val electricMarkers = ArrayList() -// smallLabels.forEach { -// if (it.markerId.toString() == item.tag) { -// electricMarkers.add(it.electricMarkerId) -// } -// } + smallMarkers.forEach { + if (it.id.toString() == item.tag) { + electricMarkers.add(it.electricMarkerId) + } + } if (electricMarkers.isEmpty()) { "此标识器没有绑定的电子标签".show(context) @@ -818,44 +894,32 @@ }.show() } - private fun detectRedrawGraphic(taskId: String) { -// val tasks = DataBaseManager.get.queryTaskById(taskId) -// if (tasks.isNotEmpty()) { -// tasks.forEach { -// val latLng = LatLng(it.lat.toDouble(), it.lng.toDouble()) -// val otMarkerOptions = MarkerOptions() -// otMarkerOptions.position(latLng) -// otMarkerOptions.visible(true) // 设置可见 -// if (it.state == "未开始") { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_red1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } else { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } -// aMap.addMarker(otMarkerOptions) -// } -// } + private fun detectRedrawGraphic(task: TaskDetailLocalModel) { + task.markerModels.forEach { + val latLng = LatLng(it.lat, it.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (it.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } + aMap.addMarker(otMarkerOptions) + } showLabelsOnMap() } - private fun uploadTask(taskId: String?, state: String) { - if (isNetworkConnected()) { - val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String - taskViewModel.uploadTask(userId, taskId, state) - } else { - "网络连接已断开,请检查".show(this) - } - } - //更新数据 - private fun updateLabels() { + private fun updateMarkers() { AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") .setNegativeButton("取消").setPositiveButton("确定") .setOnDialogButtonClickListener(object : @@ -941,7 +1005,7 @@ SensorManager.getOrientation(rotationMatrix, valueArray) val degree = ((360f + valueArray[0] * 180f / Math.PI) % 360).toInt() -// searchNewDialog.updateDegreeValue(degree) + searchNewDialog.updateDegreeValue(degree) } } return true @@ -953,8 +1017,8 @@ super.onResume() binding.mapView.onResume() lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } //显示标签 showLabelsOnMap() @@ -962,9 +1026,9 @@ //虽然不用显示附属标签,但是需要喝标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } //注册加速度传感器监听 @@ -990,8 +1054,6 @@ override fun onDestroy() { super.onDestroy() binding.mapView.onDestroy() - signalTask?.cancel() - searchMarkerTimer?.cancel() soundPool.release() locationHub.stopLocation() //降低串口电位 @@ -1006,6 +1068,7 @@ private val realPaths = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var countDownTimer: CountDownTimer + private lateinit var locationManager: LocationHub var isReadMarker = false var isInstallMarker = false @@ -1150,8 +1213,8 @@ soundPool.play(soundResourceId, 1f, 1f, 0, -1, 1f) - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() countDownTimer = object : CountDownTimer(5 * 1000, 1000) { override fun onTick(millisUntilFinished: Long) { @@ -1174,6 +1237,21 @@ } } + override fun show() { + super.show() + locationManager = LocationHub(context) + locationManager.getCurrentLocation(true, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + if (location != null) { + binding.markerAttrInclude.lngView.text = location.longitude.toString() + binding.markerAttrInclude.latView.text = location.latitude.toString() + } else { + "当前位置信号差,无法获取定位".show(context) + } + } + }) + } + fun bindingValue(markerId: String) { this.markerId = markerId LoadingDialogHub.dismiss() @@ -1193,6 +1271,7 @@ gpioManager.setGpioLow("18") soundPool.autoPause() isInstallMarker = false + locationManager.stopLocation() super.dismiss() } @@ -1515,6 +1594,21 @@ }) } + //清除默认数据 + fun clearDefaultData() { +// "markerObjectTypeView".setDefaultValue("") +// "pipelineDiameterView".setDefaultValue("") +// "buryDeepView".setDefaultValue("") +// "bottomPipeDiameterView".setDefaultValue("") +// "bottomPointDeepView".setDefaultValue("") +// "areaView".setDefaultValue("") +// "lineView".setDefaultValue("") +// "roadView".setDefaultValue("") +// "ownerView".setDefaultValue("") +// "identifierDeepView".setDefaultValue("") +// "personDeptView".setDefaultValue("") + } + //根据选择类型控制界面某些区域显隐 private fun setLayoutVisibility(vararg args: Int) { binding.objectAttrInclude.objectModeLayout.visibility = args[0] @@ -1566,21 +1660,23 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(context: Context) : Dialog(context) { + /**探测标识器新对话框******************************************************************************/ + inner class SearchMarkerNewDialog(context: Context) : Dialog(context) { - private val binding: DialogSearchMarkerBinding by binding() - private val decimal by lazy { DecimalFormat("0.0") } - private val degreeCache by lazy { HashMap() } - private var isPlaying = false + private val taskId by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String + } + private val taskCode by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_CODE, "") as String + } + private val binding: DialogSearchMarkerNewBinding by binding() private var markerId = "" private lateinit var searchMarkerTimer: Timer private lateinit var signalTask: TimerTask private lateinit var energyTask: TimerTask private lateinit var countDownTimer: CountDownTimer - + private lateinit var locationManager: LocationHub var isDetectMarker = false - var taskBean: TaskBean? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -1590,47 +1686,111 @@ energyTask.cancel() searchMarkerTimer.cancel() - out?.write('3'.code) -// val result = DataBaseManager.get.queryLabelById(markerId) -// if (result.isNotEmpty()) { -// val tag = when (result.first().identifierType) { -// "EM30" -> '7' -// "EM50" -> '8' -// "EM14" -> '9' -// else -> '1' -// } -// if (tag == '1') { -// "此标识器无法读取埋深!".show(context) -// } else { -// // 发送读取标识器埋设深度指令 -// LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") -// out.write(tag.code) -// out.flush() -// countDownTimer = object : CountDownTimer(15 * 1000, 1000) { -// override fun onTick(millisUntilFinished: Long) { -// -// } -// -// override fun onFinish() { -// LoadingDialogHub.dismiss() -// "探测此标识器深度超时,请重试".show(context) -// initTimer() -// } -// } -// countDownTimer.start() -// } -// } else { -// "标识器未安装,安装成功后才可读取埋深!".show(context) -// } + out.write('3'.code) + val result = DataBaseManager.get.queryMarkerById(markerId) + if (result.isNotEmpty()) { + val tag = when (result.first().markerType) { + "EM30" -> '7' + "EM50" -> '8' + "EM14" -> '9' + else -> '1' + } + if (tag == '1') { + "此标识器无法读取埋深!".show(context) + initTimer() + } else { + // 发送读取标识器埋设深度指令 + LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") + out.write(tag.code) + out.flush() + countDownTimer = object : CountDownTimer(15 * 1000, 1000) { + override fun onTick(millisUntilFinished: Long) { + + } + + override fun onFinish() { + LoadingDialogHub.dismiss() + "探测此标识器深度超时,请重试".show(context) + initTimer() + } + } + countDownTimer.start() + } + } else { + "标识器未安装,安装成功后才可读取埋深!".show(context) + initTimer() + } } binding.markerInfoButton.setOnClickListener { //查库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isNotEmpty()) { -// context.navigatePageTo(result.first().toJson()) + context.navigatePageTo(result.first().toJson()) } else { -// context.navigatePageTo(markerId) + context.navigatePageTo(markerId) + } + } + } + + override fun show() { + super.show() + locationManager = LocationHub(context) + //点位渲染,每次定位都计算当前位置与符合条件的点距离 + locationManager.getCurrentLocation(false, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + location?.apply { + renderDataPoint(this) + } + } + }) + } + + /** + * 计算并渲染数据点。点太多采用协程计算,不然会有点卡顿 + * @param location 定位点(天宝RTK获取) + * */ + private fun renderDataPoint(location: AMapLocation) { + val longitude = location.longitude + val latitude = location.latitude + lifecycleScope.launch(Dispatchers.IO) { + val dataPoints = ArrayList() + DataBaseManager.get.loadMarkers().forEach { + val distance = AMapUtils.calculateLineDistance( + LatLng(it.lat.toDouble(), it.lng.toDouble()), LatLng(latitude, longitude) + ) + val formatDistance = decimalFormat.format(distance).toFloat() + if (formatDistance <= LocaleConstant.MAX_DISTANCE) { + val angle = atan2( + (it.lat.toDouble() - latitude), (it.lng.toDouble() - longitude) + ) + Math.PI + val formatAngle = decimalFormat.format(angle).toDouble() + + "[$longitude, $latitude,$formatDistance, $formatAngle]".writeToFile( + createLogFile() + ) + dataPoints.add(RadarScanView.DataPoint(formatAngle, formatDistance)) + } + } + withContext(Dispatchers.Main) { + binding.radarScanView.renderPointData(dataPoints, + object : RadarScanView.OnGetNearestPointCallback { + override fun getNearestPoint(point: RadarScanView.DataPoint?) { + if (point == null) { + binding.distanceValueView.text = "大于5.5m" + binding.distancePgBar.progress = 100 + } else { + binding.distanceValueView.text = "${point.distance}m" + val progress = + if (point.distance > LocaleConstant.MAX_DISTANCE) { + 100 + } else { + (point.distance / LocaleConstant.MAX_DISTANCE) * 100 + } + binding.distancePgBar.progress = progress.toInt() + } + } + }) } } } @@ -1644,60 +1804,33 @@ isDetectMarker = true - //角度 - degreeCache["lastDegree"] = 0f + if (isExecuteTask) { + binding.taskStateView.visibility = View.GONE + binding.taskStateView.isSelected = false + } else { + binding.taskStateView.visibility = View.VISIBLE + binding.taskStateView.isSelected = true + } } fun bindingValue(hex: String) { if (hex.startsWith("4E")) { try { //4E转为String为N,代表能量值 - //用能量值转动表盘 val energyResponse = hex.take(10).hexToString() val energy = energyResponse.substring(1).toInt() if (energy >= 4000) { - isPlaying = if (!isPlaying) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(fastSoundResourceId) - false - } + soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) } else { - isPlaying = if (!isPlaying) { - soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(slowSoundResourceId) - false - } + soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) } - binding.resultTextView.text = "信号能量值:${energyResponse}" - - //转换为转动的角度 - val degree = (energy.toFloat() / (50 * 100)) * 180 - binding.energyValueView.text = decimal.format(degree) - - degreeCache["lastDegree"]?.apply { - val animation = RotateAnimation( - this, - degree, - Animation.RELATIVE_TO_SELF, - 0.5f, - Animation.RELATIVE_TO_SELF, - 0.5f - ) - animation.duration = 0 - animation.fillAfter = true - binding.needleView.startAnimation(animation) - } - - //保存旋转后的角度 - degreeCache["lastDegree"] = degree + //通过设置进度条表示能量值 + binding.energyPgBar.progress = energy + binding.energyValueView.text = "${energy}dB" if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" + binding.energyTipsView.text = "信号较弱,可能距离较远" binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) @@ -1712,11 +1845,11 @@ binding.searchResultView.setTextColor(Color.parseColor("#8D1717")) binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } else if (energy >= 4100) {//148° - binding.energyTipsView.text = "标识器信号极强,可能在正下方" + binding.energyTipsView.text = "信号极强,接近标识器正上方" binding.energyTipsView.setTextColor(Color.parseColor("#428d00")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" + binding.energyTipsView.text = "已靠近,请继续移动位置" binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } @@ -1757,31 +1890,37 @@ binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) //自动上传标识器 -// taskBean = DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") -// taskBean?.apply { -// /** -// * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 -// * */ -// taskViewModel.uploadMarker(taskCode) -// } + if (isExecuteTask) { + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) + } + } } } } + //更新罗盘角度 + fun updateDegreeValue(degree: Int) { + binding.radarScanView.setDegreeValue(degree) + } + private fun initTimer() { searchMarkerTimer = Timer() signalTask = object : TimerTask() { override fun run() { - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() } } energyTask = object : TimerTask() { override fun run() { - out?.write('6'.code) - out?.flush() + out.write('6'.code) + out.flush() } } @@ -1798,6 +1937,7 @@ gpioManager.setGpioLow("18") isDetectMarker = false soundPool.autoPause() + locationManager.stopLocation() super.dismiss() } } diff --git a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt index f092eb0..040eb10 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt @@ -5,7 +5,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.LabelBean +import com.casic.electric.detector.bean.MarkerLocalBean import com.casic.electric.detector.databinding.ActivityObjectDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.FileType @@ -23,7 +23,7 @@ private val kTag = "ObjectDetailActivity" private val context: Context = this@ObjectDetailActivity private val gson by lazy { Gson() } - private lateinit var labelBean: LabelBean + private lateinit var markerLocalBean: MarkerLocalBean override fun initOnCreate(savedInstanceState: Bundle?) { window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) @@ -36,37 +36,37 @@ val objectJson = intent.getStringExtra(Constant.INTENT_PARAM)!! try { - labelBean = gson.fromJson(objectJson, object : TypeToken() {}.type) + markerLocalBean = gson.fromJson(objectJson, object : TypeToken() {}.type) - binding.markerObjTypeView.text = labelBean.markerObjType - binding.markerNumberView.text = labelBean.markerNumber - binding.objectNameView.text = labelBean.objectName - binding.voltageLevelView.text = labelBean.voltageLevel - binding.transformerModelView.text = labelBean.transformerModel - binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial - binding.sizeView.text = labelBean.size - binding.bottomDepthView.text = labelBean.bottomDepth - binding.jointCountView.text = labelBean.jointCount - binding.casingMaterialView.text = labelBean.casingMaterial - binding.casingSpecView.text = labelBean.casingSpec - binding.constructTimeView.text = labelBean.constructTime - binding.inspectionUnitView.text = labelBean.inspectionUnit - binding.areaView.text = labelBean.area - binding.roadView.text = labelBean.road - binding.memo1View.text = labelBean.memo1 - binding.memo2View.text = labelBean.memo2 - binding.memo3View.text = labelBean.memo3 - binding.markerIdView.text = labelBean.markerId - binding.markerTypeView.text = labelBean.markerType - binding.ownerView.text = labelBean.owner - binding.markerDepthView.text = labelBean.markerDepth - binding.electricTagCountView.text = labelBean.electricTagCount - binding.installedTimeView.text = labelBean.installedTime - binding.longitudeView.text = labelBean.longitude - binding.latitudeView.text = labelBean.latitude - binding.markerMemo1View.text = labelBean.markerMemo1 - binding.markerMemo2View.text = labelBean.markerMemo2 - binding.markerMemo3View.text = labelBean.markerMemo3 +// binding.markerObjTypeView.text = labelBean.markerObjType +// binding.markerNumberView.text = labelBean.markerNumber +// binding.objectNameView.text = labelBean.objectName +// binding.voltageLevelView.text = labelBean.voltageLevel +// binding.transformerModelView.text = labelBean.transformerModel +// binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial +// binding.sizeView.text = labelBean.size +// binding.bottomDepthView.text = labelBean.bottomDepth +// binding.jointCountView.text = labelBean.jointCount +// binding.casingMaterialView.text = labelBean.casingMaterial +// binding.casingSpecView.text = labelBean.casingSpec +// binding.constructTimeView.text = labelBean.constructTime +// binding.inspectionUnitView.text = labelBean.inspectionUnit +// binding.areaView.text = labelBean.area +// binding.roadView.text = labelBean.road +// binding.memo1View.text = labelBean.memo1 +// binding.memo2View.text = labelBean.memo2 +// binding.memo3View.text = labelBean.memo3 +// binding.markerIdView.text = labelBean.markerId +// binding.markerTypeView.text = labelBean.markerType +// binding.ownerView.text = labelBean.owner +// binding.markerDepthView.text = labelBean.markerDepth +// binding.electricTagCountView.text = labelBean.electricTagCount +// binding.installedTimeView.text = labelBean.installedTime +// binding.longitudeView.text = labelBean.longitude +// binding.latitudeView.text = labelBean.latitude +// binding.markerMemo1View.text = labelBean.markerMemo1 +// binding.markerMemo2View.text = labelBean.markerMemo2 +// binding.markerMemo3View.text = labelBean.markerMemo3 } catch (e: NumberFormatException) { e.printStackTrace() } @@ -77,7 +77,7 @@ binding.showImageView.setOnClickListener { //查数据库 - if (labelBean.imagePath.isNullOrEmpty()) { + if (markerLocalBean.imagePath.isNullOrEmpty()) { "此标识器无图片".show(context) } else { val realPaths: ArrayList = ArrayList() //真实图片路径 @@ -85,7 +85,7 @@ /** * /images/markers/202307/0008818922_EVENT_20230704_160349_0_1.jpg,/images/markers/202307/0008818922_EVENT_20230704_160406_0_2.jpg * */ - val imagePath = labelBean.imagePath + val imagePath = markerLocalBean.imagePath if (imagePath.contains(",")) { val list = imagePath.split(",") list.forEach { path -> diff --git a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt index ea74e8a..57c93fe 100644 --- a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt +++ b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt @@ -1,8 +1,10 @@ package com.casic.electric.detector.vm import android.content.Context +import android.util.Log import androidx.lifecycle.MutableLiveData import com.casic.electric.detector.base.BaseApplication +import com.casic.electric.detector.bean.TaskMarkerLocalBean import com.casic.electric.detector.extensions.getResponseMessage import com.casic.electric.detector.extensions.getResponseState import com.casic.electric.detector.model.MarkerFileModel @@ -21,6 +23,8 @@ import com.pengxh.kt.lite.utils.SaveKeyValues class TaskViewModel : BaseViewModel() { + + private val kTag = "TaskViewModel" private val gson by lazy { Gson() } val markerFileResult = MutableLiveData() val taskResult = MutableLiveData() @@ -165,40 +169,25 @@ loadState.value = LoadState.Fail }) - fun uploadTask(userId: String, taskId: String?, state: String) = launch({ + fun uploadTask( + context: Context, userId: String, taskId: String, taskCode: String, state: String + ) = launch({ loadState.value = LoadState.Loading val response = RetrofitServiceManager.uploadTask(userId, taskId, state) if (response.getResponseState()) { loadState.value = LoadState.Success - if (state == "2") { - "工单${taskId}已提交!".show(BaseApplication.get()) - //删除本地数据库 -// DataBaseManager.get.deleteTaskById(taskId) - SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") - } - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(BaseApplication.get()) - } - }, { - it.printStackTrace() - loadState.value = LoadState.Fail - }) - - fun uploadTask(context: Context, userId: String, taskId: String?, state: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadTask(userId, taskId, state) - if (response.getResponseState()) { - loadState.value = LoadState.Success + //工单提交之后,并且状态是2,删除本地Task记录 if (state == "2") { "工单${taskId}已提交!".show(context) //删除本地数据库 - DataBaseManager.get.deleteTaskById(taskId) + DataBaseManager.get.deleteLocalTaskById(taskId, taskCode) SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") val element = JsonParser.parseString(response) val jsonObject = element.asJsonObject executeTaskResult.value = jsonObject.get("success").asString + } else { + Log.d(kTag, "uploadTask: 仅执行工单,不删除本地工单数据") } } else { loadState.value = LoadState.Fail @@ -225,17 +214,12 @@ loadState.value = LoadState.Fail }) - fun uploadMarker(context: Context, taskDetailId: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadMarker(taskDetailId) - if (response.getResponseState()) { - loadState.value = LoadState.Success - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(context) - } + fun uploadMarker(context: Context, marker: TaskMarkerLocalBean) = launch({ + //主键ID代替MarkerId + RetrofitServiceManager.uploadMarker(marker.id.toString()) + "标识器${marker.markerId}已探测!".show(context) + DataBaseManager.get.updateLocalTaskMarkerState(marker) }, { it.printStackTrace() - loadState.value = LoadState.Fail }) } \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt index 837ae86..2f1bb58 100644 --- a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt @@ -276,7 +276,7 @@ //先存本地 lifecycleScope.launch { withContext(Dispatchers.IO) { - DataBaseManager.get.insertSmallLabel(smallLabelData) +// DataBaseManager.get.insertSmallLabel(smallLabelData) } } @@ -339,7 +339,7 @@ gpioManager.setGpioLow("18") //查本地库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isEmpty()) { binding.objectAttrInclude.markerIdView.text = markerId } else { diff --git a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt index d3ffdd3..a5834bd 100644 --- a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt @@ -6,6 +6,7 @@ import android.app.Dialog import android.content.Context import android.content.DialogInterface +import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable @@ -19,16 +20,16 @@ import android.os.CountDownTimer import android.os.Handler import android.os.Message +import android.util.Log import android.view.KeyEvent import android.view.View -import android.view.animation.Animation -import android.view.animation.RotateAnimation import android.widget.AdapterView import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import com.amap.api.location.AMapLocation import com.amap.api.maps.AMap import com.amap.api.maps.AMapOptions +import com.amap.api.maps.AMapUtils import com.amap.api.maps.CameraUpdateFactory import com.amap.api.maps.CoordinateConverter import com.amap.api.maps.model.BitmapDescriptorFactory @@ -39,8 +40,9 @@ import com.casic.electric.detector.R import com.casic.electric.detector.adapter.EditableImageAdapter import com.casic.electric.detector.base.SerialPortActivity -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.TaskBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean import com.casic.electric.detector.callback.OnGetLocationListener import com.casic.electric.detector.callback.OnImageCompressListener import com.casic.electric.detector.cluster.ClusterItem @@ -49,9 +51,10 @@ import com.casic.electric.detector.databinding.ActivityMainBinding import com.casic.electric.detector.databinding.DialogInstallMarkerBinding import com.casic.electric.detector.databinding.DialogInstallSmallMarkerBinding -import com.casic.electric.detector.databinding.DialogSearchMarkerBinding +import com.casic.electric.detector.databinding.DialogSearchMarkerNewBinding import com.casic.electric.detector.extensions.appendExcelDownloadUrl import com.casic.electric.detector.extensions.compressImage +import com.casic.electric.detector.extensions.createTaskCode import com.casic.electric.detector.extensions.drawCircle import com.casic.electric.detector.extensions.getDefaultValue import com.casic.electric.detector.extensions.hexToString @@ -61,6 +64,7 @@ import com.casic.electric.detector.extensions.setDefaultValue import com.casic.electric.detector.extensions.show import com.casic.electric.detector.extensions.toHex +import com.casic.electric.detector.model.TaskDetailLocalModel import com.casic.electric.detector.model.TaskModel import com.casic.electric.detector.utils.DataBaseManager import com.casic.electric.detector.utils.ExcelHub @@ -70,9 +74,10 @@ import com.casic.electric.detector.utils.LocationHub import com.casic.electric.detector.utils.RouteOnMap import com.casic.electric.detector.vm.TaskViewModel +import com.casic.electric.detector.widgets.MarkerDetailDialog import com.casic.electric.detector.widgets.QueryMarkerDialog +import com.casic.electric.detector.widgets.RadarScanView import com.casic.electric.detector.widgets.SamplePopupWindow -import com.google.gson.Gson import com.luck.picture.lib.basic.PictureSelector import com.luck.picture.lib.config.SelectMimeType import com.luck.picture.lib.entity.LocalMedia @@ -81,8 +86,10 @@ import com.pengxh.kt.lite.extensions.binding import com.pengxh.kt.lite.extensions.convertColor import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.createLogFile import com.pengxh.kt.lite.extensions.dateToTimestamp import com.pengxh.kt.lite.extensions.dp2px +import com.pengxh.kt.lite.extensions.getSystemService import com.pengxh.kt.lite.extensions.initDialogLayoutParams import com.pengxh.kt.lite.extensions.isNetworkConnected import com.pengxh.kt.lite.extensions.navigatePageTo @@ -90,6 +97,7 @@ import com.pengxh.kt.lite.extensions.timestampToCompleteDate import com.pengxh.kt.lite.extensions.timestampToTime import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.extensions.writeToFile import com.pengxh.kt.lite.utils.FileDownloadManager import com.pengxh.kt.lite.utils.LoadState import com.pengxh.kt.lite.utils.LoadingDialogHub @@ -103,47 +111,50 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File +import java.math.RoundingMode import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer import java.util.TimerTask +import kotlin.math.atan2 @SuppressLint("all") class MainActivity : SerialPortActivity(), SensorEventListener, Handler.Callback { private val kTag = "MainActivity" - private val context = this@MainActivity + private val context = this private val samplePopupWindow by lazy { SamplePopupWindow(this) } - private val gson by lazy { Gson() } private val regionRadius by lazy { LocaleConstant.RADIUS_SIZE.dp2px(this) } private val backDrawables by lazy { HashMap() } private val installDialog by lazy { InstallMarkerDialog(this) } - private val searchDialog by lazy { SearchMarkerDialog(this) } + private val searchNewDialog by lazy { SearchMarkerNewDialog(this) } + private val detailDialog by lazy { MarkerDetailDialog(this) } + private val locationHub by lazy { LocationHub(this) } + private val decimalFormat by lazy { DecimalFormat("0.00") } private val sensorMessageCode = 2024022301 private val rotationMatrix = FloatArray(9)//旋转矩阵缓存 private val valueArray = FloatArray(3)//方位角数值 private var clickTime: Long = 0 - private var labelBeans = ArrayList() + private var markers = ArrayList() + private var smallMarkers = ArrayList() private var clusterOverlay: ClusterOverlay? = null - private var latitude: Double = 0.0 - private var longitude: Double = 0.0 private var isFreeTask = false + private var freeTaskTitle = "" private var ids = HashSet() private var signalTask: TimerTask? = null + private var energyTask: TimerTask? = null private var searchMarkerTimer: Timer? = null - private var taskId: String? = null + private var freeTaskId: String? = null private var gravity: FloatArray? = null private var geomagnetic: FloatArray? = null private lateinit var aMap: AMap - private lateinit var task: TaskBean private lateinit var sensorManager: SensorManager private lateinit var weakReferenceHandler: WeakReferenceHandler /***inner class 需要用到*****start*/ private val gpioManager by lazy { GpioManager() } - private val locationHub by lazy { LocationHub(this) } private val taskViewModel by lazy { ViewModelProvider(this)[TaskViewModel::class.java] } private val attr = AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ALARM) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build() @@ -168,6 +179,9 @@ slowSoundResourceId = soundPool.load(this, R.raw.ring4, 1) fastSoundResourceId = soundPool.load(this, R.raw.ring2, 1) + //保留小数2位 + decimalFormat.roundingMode = RoundingMode.HALF_UP + "登录成功".show(this) //地图初始化 @@ -177,12 +191,14 @@ samplePopupWindow.setPopupMenuItem(LocaleConstant.POPUP_TITLES) samplePopupWindow.setBackgroundDrawable(null) + sensorManager = getSystemService()!! + weakReferenceHandler = WeakReferenceHandler(this) + //task网络请求监听 taskViewModel.markerFileResult.observe(this) { if (it.success == "true") { //清空之前的数据 - DataBaseManager.get.clearLabels() - DataBaseManager.get.clearSmallLabels() + DataBaseManager.get.clearMarkers() /** * "data":"/xls/marker1.xls,/xls/smallMarker1.xls" * 有两份excel表格需要下载 @@ -200,10 +216,10 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { - labelBeans = ExcelHub.readLabel(file.absolutePath) + markers = ExcelHub.readLabel(file.absolutePath) withContext(Dispatchers.IO) { - labelBeans.forEach { label -> - DataBaseManager.get.insertLabel(label) + markers.forEach { marker -> + DataBaseManager.get.saveMarkerInLocale(marker) } } LoadingDialogHub.dismiss() @@ -227,12 +243,12 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { -// smallLabels = ExcelHub.readSmallLabel(file.absolutePath) -// withContext(Dispatchers.IO) { -// smallLabels.forEach { label -> -// DataBaseManager.get.insertSmallLabel(label) -// } -// } + smallMarkers = ExcelHub.readSmallLabel(file.absolutePath) + withContext(Dispatchers.IO) { + smallMarkers.forEach { marker -> + DataBaseManager.get.saveSmallMarkerInLocale(marker) + } + } } } @@ -250,18 +266,35 @@ taskViewModel.taskResult.observe(this) { if (it.success == "true") { //清空之前的数据 -// DataBaseManager.get.clearTasks() AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") .setMessage("您有${it.message.size}个新任务!").setPositiveButton("知道了") .setOnDialogButtonClickListener(object : AlertMessageDialog.OnDialogButtonClickListener { override fun onConfirmClick() { - saveTaskInformation(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { + freeTaskId = it + // 自由巡检保存在本地 + val bean = TaskLocalBean() + bean.id = freeTaskId.toString().toLong() + val currentTimeMillis = System.currentTimeMillis() + bean.taskCode = currentTimeMillis.createTaskCode() + bean.description = freeTaskTitle + val time = currentTimeMillis.timestampToCompleteDate() + bean.createTime = time + bean.status = "0" + val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + bean.createUserName = userName + bean.startTime = time + bean.endTime = "" + bean.isFreeTask = "1" + DataBaseManager.get.saveTaskInLocale(bean) + } + taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -290,10 +323,11 @@ }).build().show() } else { lifecycleScope.launch(Dispatchers.Main) { - val labels = withContext(Dispatchers.IO) { - DataBaseManager.get.queryLabelById("0") + val markers = withContext(Dispatchers.IO) { + DataBaseManager.get.queryMarkerByState("0") } - if (labels.isNotEmpty()) { + //如果有需要补全的标识器,Popup右侧会有小圆点提示 + if (markers.isNotEmpty()) { samplePopupWindow.setShowPosition(4) } val x = @@ -307,37 +341,42 @@ SamplePopupWindow.OnPopupWindowClickListener { override fun onPopupItemClicked(position: Int) { when (position) { - 0 -> updateLabels() + 0 -> updateMarkers() 1 -> downloadTask() 2 -> navigatePageTo() 3 -> uploadEvent() -// 4 -> uploadLabel() +// 4 -> completionMarker() } } }) //安装。上传,然后存入本地库 binding.installButton.setOnClickListener { - AlertControlDialog.Builder().setContext(context).setTitle("提示") - .setMessage("请选择安装对象").setPositiveButton("标识器") - .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - //标识器 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installMarkerDialog.show() - } + if (isFreeTask) { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("正在自由巡检任务中,请完成此次任务之后再使用此功能") + .setPositiveButton("好的").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { - override fun onCancelClick() { - //电子标签 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installSmallMarkerDialog.show() - } - }).build().show() + } + }).build().show() + } else { + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择安装对象").setPositiveButton("标识器") + .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + //标识器 +// installMarkerDialog.show() + } + + override fun onCancelClick() { + //电子标签 +// installSmallMarkerDialog.show() + } + }).build().show() + } } //查看 @@ -351,24 +390,24 @@ ) { //查询数据库 lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { + markers = withContext(Dispatchers.IO) { if (contentValue.size == 1) { - DataBaseManager.get.loadLabelByCondition( + DataBaseManager.get.loadMarkerByCondition( selectedCondition, contentValue[0] - ) as ArrayList + ) as ArrayList } else { DataBaseManager.get.loadLabelByDate( contentValue[0], contentValue[1] - ) as ArrayList + ) as ArrayList } } val latitudeList = ArrayList() val longitudeList = ArrayList() - labelBeans.forEach { - val latitude = it.latitude - val longitude = it.longitude + markers.forEach { + val latitude = markers.first().lat + val longitude = markers.first().lng if (latitude.isNotBlank() && longitude.isNotBlank()) { if (CoordinateConverter.isAMapDataAvailable( latitude.toDouble(), longitude.toDouble() @@ -400,52 +439,63 @@ //巡检 binding.inspectionButton.setOnClickListener { -// val task = DataBaseManager.get.queryDistinctTask() -// if (task.isNotEmpty()) { -// val arrayList = ArrayList() -// task.forEachIndexed { index, taskBean -> -// arrayList.add("任务${index + 1}:${taskBean.taskId},${taskBean.desc}") -// } -// -// BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) -// .setActionItemTitle(arrayList) -// .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { -// override fun onActionItemClick(position: Int) { -// val taskBean = task[position] -// SaveKeyValues.putValue(LocaleConstant.TASK_ID, taskBean.taskId) -// AlertControlDialog.Builder().setContext(context).setTitle("提示") -// .setMessage("请选择操作方式").setPositiveButton("执行工单") -// .setNegativeButton("提交工单") -// .setOnDialogButtonClickListener(object : -// AlertControlDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// detectRedrawGraphic(taskBean.taskId) -// -// val latLng = LatLng( -// taskBean.lat.toDouble(), taskBean.lng.toDouble() -// ) -// aMap.moveCamera( -// CameraUpdateFactory.newLatLngZoom(latLng, 16f) -// ) -// uploadTask(taskBean.taskId, "1") -// } -// -// override fun onCancelClick() { -// uploadTask(taskBean.taskId, "2") -// } -// }).build().show() -// } -// }).build().show() -// } else { -// AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") -// .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") -// .setPositiveButton("知道了").setOnDialogButtonClickListener(object : -// AlertMessageDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// startFreeTask() -// } -// }).build().show() -// } + val tasks = DataBaseManager.get.loadLocalTask() + if (tasks.isNotEmpty()) { + val arrayList = ArrayList() + tasks.forEachIndexed { index, task -> + arrayList.add("任务${index + 1}:${task.taskId},${task.description}") + } + + BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) + .setActionItemTitle(arrayList) + .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { + override fun onActionItemClick(position: Int) { + val task = tasks[position] + Log.d(kTag, task.toJson()) + SaveKeyValues.putValue(LocaleConstant.TASK_ID, task.taskId) + SaveKeyValues.putValue(LocaleConstant.TASK_CODE, task.taskCode) + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择操作方式").setPositiveButton("执行工单") + .setNegativeButton("提交工单") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + if (task.markerModels.isNotEmpty()) { + //移到Task下属第一个标识器位置 + val firstMarker = task.markerModels.first() + val latLng = LatLng(firstMarker.lat, firstMarker.lng) + aMap.moveCamera( + CameraUpdateFactory.newLatLngZoom(latLng, 16f) + ) + //执行工单 + uploadTask(task.taskId, task.taskCode, "1") + detectRedrawGraphic(task) + isExecuteTask = true + } else { + "此工单下无标识器,将执行自由巡检任务".show(context) + freeTaskId = task.taskId + openSerialPort() + } + } + + override fun onCancelClick() { + //提交工单 + uploadTask(task.taskId, task.taskCode, "2") + isExecuteTask = false + } + }).build().show() + } + }).build().show() + } else { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") + .setPositiveButton("知道了").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + startFreeTask() + } + }).build().show() + } } //探测 @@ -465,7 +515,7 @@ } }).build().show() } else { - searchDialog.show() + searchNewDialog.show() } } @@ -479,16 +529,21 @@ isFreeTask = false soundPool.autoPause() + //停止信号和ID搜索定时器 + signalTask?.cancel() + energyTask?.cancel() + searchMarkerTimer?.cancel() + //降低串口电位 gpioManager.setGpioLow("18") binding.stopFreeTaskButton.visibility = View.GONE - if (taskId.isNullOrBlank()) { + if (freeTaskId.isNullOrBlank()) { "任务ID异常,无法提交任务,请联系服务器管理员".show(context) return } - taskId?.apply { + freeTaskId?.apply { taskViewModel.uploadTaskMarker(context, this, ArrayList(ids)) } } @@ -497,42 +552,65 @@ } } + private fun uploadTask(taskId: String, taskCode: String, state: String) { + if (isNetworkConnected()) { + val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) + } else { + "网络连接已断开,请检查".show(this) + } + } + private fun startFreeTask() { AlertInputDialog.Builder().setContext(this).setTitle("新建自由巡检任务") .setHintMessage("请输入自由巡检任务简要描述").setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : AlertInputDialog.OnDialogButtonClickListener { override fun onConfirmClick(value: String) { + freeTaskTitle = value val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String taskViewModel.createFreeTask(context, userId, value) - //调高串口电位 - gpioManager.setGpioHigh("18") - - isFreeTask = true - //自由巡检 - signalTask = object : TimerTask() { - override fun run() { - out?.write('2'.code) - out?.flush() - } - } - searchMarkerTimer = Timer() - searchMarkerTimer?.apply { - schedule(signalTask, 0, 100) - } - - binding.stopFreeTaskButton.visibility = View.VISIBLE + openSerialPort() } override fun onCancelClick() {} }).build().show() } + private fun openSerialPort() { + //调高串口电位 + gpioManager.setGpioHigh("18") + + isFreeTask = true + //自由巡检 + signalTask = object : TimerTask() { + override fun run() { + out.write('2'.code) + out.flush() + } + } + + energyTask = object : TimerTask() { + override fun run() { + out.write('6'.code) + out.flush() + } + } + + searchMarkerTimer = Timer() + searchMarkerTimer?.apply { + schedule(signalTask, 0, 200) + schedule(energyTask, 0, 251) + } + + binding.stopFreeTaskButton.visibility = View.VISIBLE + } + override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) + if (searchNewDialog.isDetectMarker) { + searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() if (markerId.isNumber()) { @@ -540,26 +618,47 @@ } } else if (isFreeTask) { val markerId = hex.take(20).hexToString() + if (markerId.isNumber()) { //只响一次,因为探测频率高,所以依旧是连续的报警声 soundPool.play(soundResourceId, 1f, 1f, 0, 0, 1f) - "标识器${markerId}已探测".show(this) //添加地图Marker if (!ids.contains(markerId)) { //根据markerId查询标识器经纬度 - val labels = DataBaseManager.get.queryLabelById(markerId) - if (labels.isNotEmpty()) { - val bean = labels.first() + val markers = DataBaseManager.get.queryMarkerById(markerId) + if (markers.isNotEmpty()) { + val bean = markers.first() aMap.addMarker( MarkerOptions().position( - LatLng( - bean.latitude.toDouble(), bean.longitude.toDouble() - ) + LatLng(bean.lat.toDouble(), bean.lng.toDouble()) ).icon(BitmapDescriptorFactory.fromResource(R.mipmap.label_blue1)) ) } } ids.add(markerId) + + //显示标识器详细信息 + if (!detailDialog.isShowing) { + val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull() + if (markerBean == null) { + "无法查询到此ID【${markerId}】的信息".show(context) + } else { + detailDialog.setMarker(markerBean) + detailDialog.show() + } + } + } + + if (hex.startsWith("4E")) { + val energyResponse = hex.take(10).hexToString() + try { + val energy = energyResponse.substring(1).toInt() + if (energy <= 500 && detailDialog.isShowing) { + detailDialog.dismiss() + } + } catch (e: NumberFormatException) { + e.printStackTrace() + } } } } @@ -570,31 +669,21 @@ LoadState.Loading -> { if (installDialog.isInstallMarker) { LoadingDialogHub.show(this, "标识器安装中,请稍后...") - } else if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - "标识器${this.markerRealId}已探测!".show(context) -// DataBaseManager.get.updateTaskLabel(this) - } } else { LoadingDialogHub.show(this, "提交工单中,请稍后") } } - else -> { + LoadState.Success -> { if (installDialog.isInstallMarker) { -// installDialog.clearDefaultData() + installDialog.clearDefaultData() installDialog.dismiss() - "${installDialog.markerId}安装成功".show(context) + "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } } @@ -618,8 +707,6 @@ aMap.myLocationStyle = locationStyle//设置定位蓝点的Style aMap.isMyLocationEnabled = true//设置是否显示定位小蓝点 aMap.setOnMyLocationChangeListener { - longitude = it.longitude - latitude = it.latitude //经纬度逆编码 locationHub.antiCodingLocation(it) { address -> binding.currentLocationView.text = address @@ -631,19 +718,20 @@ aMap.setOnMapLongClickListener { lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } - //显示标签 - showLabelsOnMap() } //虽然不用显示附属标签,但是需要和标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } + + //显示标签 + showLabelsOnMap() } //自定义定位按钮 @@ -666,39 +754,28 @@ }) } - private fun saveTaskInformation(it: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String - if (it.message.size > 0) { - it.message.forEach { messageModel -> -// val count = DataBaseManager.get.countTaskById(messageModel.id.toString()) -// if (count == 0) { -// messageModel.taskDetailInfos.forEach { info -> -// DataBaseManager.get.insertTaskInformation( -// userName, -// messageModel.description, -// info.taskId.toString(), -// info.id.toString(), -// info.markerId.toString(), -// info.markerIdReal.toString(), -// info.longitude.toString(), -// info.latitude.toString(), -// messageModel.status -// ) -// } -// } + private fun saveUserTasks(task: TaskModel) { + task.message.forEach { model -> + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) + } } - "工单下载成功!".show(context) } + "工单下载成功!".show(this) } private fun showLabelsOnMap() { clusterOverlay?.onDestroy() val clusterItems = ArrayList() - labelBeans.forEach { - if (it.latitude.isNotEmpty() && it.longitude.isNotEmpty()) { - val latitude = it.latitude.toDouble() - val longitude = it.longitude.toDouble() + markers.forEach { + if (it.lat.isNotEmpty() && it.lng.isNotEmpty()) { + val latitude = it.lat.toDouble() + val longitude = it.lng.toDouble() val latLng = LatLng(latitude, longitude, false) val regionItem = RegionItem(latLng, it.id.toString()) @@ -717,7 +794,6 @@ ) backDrawables[0] = bitmapDrawable } - bitmapDrawable } if (clusterNum == 1) { var bitmapDrawable = backDrawables[1] @@ -780,8 +856,8 @@ override fun onActionItemClick(position: Int) { when (position) { 0 -> { - labelBeans.forEach { - if (it.markerId.toString() == item.tag) { + markers.forEach { + if (it.id.toString() == item.tag) { navigatePageTo(it.toJson()) } } @@ -789,11 +865,11 @@ 1 -> { val electricMarkers = ArrayList() -// smallLabels.forEach { -// if (it.markerId.toString() == item.tag) { -// electricMarkers.add(it.electricMarkerId) -// } -// } + smallMarkers.forEach { + if (it.id.toString() == item.tag) { + electricMarkers.add(it.electricMarkerId) + } + } if (electricMarkers.isEmpty()) { "此标识器没有绑定的电子标签".show(context) @@ -818,44 +894,32 @@ }.show() } - private fun detectRedrawGraphic(taskId: String) { -// val tasks = DataBaseManager.get.queryTaskById(taskId) -// if (tasks.isNotEmpty()) { -// tasks.forEach { -// val latLng = LatLng(it.lat.toDouble(), it.lng.toDouble()) -// val otMarkerOptions = MarkerOptions() -// otMarkerOptions.position(latLng) -// otMarkerOptions.visible(true) // 设置可见 -// if (it.state == "未开始") { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_red1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } else { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } -// aMap.addMarker(otMarkerOptions) -// } -// } + private fun detectRedrawGraphic(task: TaskDetailLocalModel) { + task.markerModels.forEach { + val latLng = LatLng(it.lat, it.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (it.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } + aMap.addMarker(otMarkerOptions) + } showLabelsOnMap() } - private fun uploadTask(taskId: String?, state: String) { - if (isNetworkConnected()) { - val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String - taskViewModel.uploadTask(userId, taskId, state) - } else { - "网络连接已断开,请检查".show(this) - } - } - //更新数据 - private fun updateLabels() { + private fun updateMarkers() { AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") .setNegativeButton("取消").setPositiveButton("确定") .setOnDialogButtonClickListener(object : @@ -941,7 +1005,7 @@ SensorManager.getOrientation(rotationMatrix, valueArray) val degree = ((360f + valueArray[0] * 180f / Math.PI) % 360).toInt() -// searchNewDialog.updateDegreeValue(degree) + searchNewDialog.updateDegreeValue(degree) } } return true @@ -953,8 +1017,8 @@ super.onResume() binding.mapView.onResume() lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } //显示标签 showLabelsOnMap() @@ -962,9 +1026,9 @@ //虽然不用显示附属标签,但是需要喝标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } //注册加速度传感器监听 @@ -990,8 +1054,6 @@ override fun onDestroy() { super.onDestroy() binding.mapView.onDestroy() - signalTask?.cancel() - searchMarkerTimer?.cancel() soundPool.release() locationHub.stopLocation() //降低串口电位 @@ -1006,6 +1068,7 @@ private val realPaths = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var countDownTimer: CountDownTimer + private lateinit var locationManager: LocationHub var isReadMarker = false var isInstallMarker = false @@ -1150,8 +1213,8 @@ soundPool.play(soundResourceId, 1f, 1f, 0, -1, 1f) - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() countDownTimer = object : CountDownTimer(5 * 1000, 1000) { override fun onTick(millisUntilFinished: Long) { @@ -1174,6 +1237,21 @@ } } + override fun show() { + super.show() + locationManager = LocationHub(context) + locationManager.getCurrentLocation(true, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + if (location != null) { + binding.markerAttrInclude.lngView.text = location.longitude.toString() + binding.markerAttrInclude.latView.text = location.latitude.toString() + } else { + "当前位置信号差,无法获取定位".show(context) + } + } + }) + } + fun bindingValue(markerId: String) { this.markerId = markerId LoadingDialogHub.dismiss() @@ -1193,6 +1271,7 @@ gpioManager.setGpioLow("18") soundPool.autoPause() isInstallMarker = false + locationManager.stopLocation() super.dismiss() } @@ -1515,6 +1594,21 @@ }) } + //清除默认数据 + fun clearDefaultData() { +// "markerObjectTypeView".setDefaultValue("") +// "pipelineDiameterView".setDefaultValue("") +// "buryDeepView".setDefaultValue("") +// "bottomPipeDiameterView".setDefaultValue("") +// "bottomPointDeepView".setDefaultValue("") +// "areaView".setDefaultValue("") +// "lineView".setDefaultValue("") +// "roadView".setDefaultValue("") +// "ownerView".setDefaultValue("") +// "identifierDeepView".setDefaultValue("") +// "personDeptView".setDefaultValue("") + } + //根据选择类型控制界面某些区域显隐 private fun setLayoutVisibility(vararg args: Int) { binding.objectAttrInclude.objectModeLayout.visibility = args[0] @@ -1566,21 +1660,23 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(context: Context) : Dialog(context) { + /**探测标识器新对话框******************************************************************************/ + inner class SearchMarkerNewDialog(context: Context) : Dialog(context) { - private val binding: DialogSearchMarkerBinding by binding() - private val decimal by lazy { DecimalFormat("0.0") } - private val degreeCache by lazy { HashMap() } - private var isPlaying = false + private val taskId by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String + } + private val taskCode by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_CODE, "") as String + } + private val binding: DialogSearchMarkerNewBinding by binding() private var markerId = "" private lateinit var searchMarkerTimer: Timer private lateinit var signalTask: TimerTask private lateinit var energyTask: TimerTask private lateinit var countDownTimer: CountDownTimer - + private lateinit var locationManager: LocationHub var isDetectMarker = false - var taskBean: TaskBean? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -1590,47 +1686,111 @@ energyTask.cancel() searchMarkerTimer.cancel() - out?.write('3'.code) -// val result = DataBaseManager.get.queryLabelById(markerId) -// if (result.isNotEmpty()) { -// val tag = when (result.first().identifierType) { -// "EM30" -> '7' -// "EM50" -> '8' -// "EM14" -> '9' -// else -> '1' -// } -// if (tag == '1') { -// "此标识器无法读取埋深!".show(context) -// } else { -// // 发送读取标识器埋设深度指令 -// LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") -// out.write(tag.code) -// out.flush() -// countDownTimer = object : CountDownTimer(15 * 1000, 1000) { -// override fun onTick(millisUntilFinished: Long) { -// -// } -// -// override fun onFinish() { -// LoadingDialogHub.dismiss() -// "探测此标识器深度超时,请重试".show(context) -// initTimer() -// } -// } -// countDownTimer.start() -// } -// } else { -// "标识器未安装,安装成功后才可读取埋深!".show(context) -// } + out.write('3'.code) + val result = DataBaseManager.get.queryMarkerById(markerId) + if (result.isNotEmpty()) { + val tag = when (result.first().markerType) { + "EM30" -> '7' + "EM50" -> '8' + "EM14" -> '9' + else -> '1' + } + if (tag == '1') { + "此标识器无法读取埋深!".show(context) + initTimer() + } else { + // 发送读取标识器埋设深度指令 + LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") + out.write(tag.code) + out.flush() + countDownTimer = object : CountDownTimer(15 * 1000, 1000) { + override fun onTick(millisUntilFinished: Long) { + + } + + override fun onFinish() { + LoadingDialogHub.dismiss() + "探测此标识器深度超时,请重试".show(context) + initTimer() + } + } + countDownTimer.start() + } + } else { + "标识器未安装,安装成功后才可读取埋深!".show(context) + initTimer() + } } binding.markerInfoButton.setOnClickListener { //查库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isNotEmpty()) { -// context.navigatePageTo(result.first().toJson()) + context.navigatePageTo(result.first().toJson()) } else { -// context.navigatePageTo(markerId) + context.navigatePageTo(markerId) + } + } + } + + override fun show() { + super.show() + locationManager = LocationHub(context) + //点位渲染,每次定位都计算当前位置与符合条件的点距离 + locationManager.getCurrentLocation(false, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + location?.apply { + renderDataPoint(this) + } + } + }) + } + + /** + * 计算并渲染数据点。点太多采用协程计算,不然会有点卡顿 + * @param location 定位点(天宝RTK获取) + * */ + private fun renderDataPoint(location: AMapLocation) { + val longitude = location.longitude + val latitude = location.latitude + lifecycleScope.launch(Dispatchers.IO) { + val dataPoints = ArrayList() + DataBaseManager.get.loadMarkers().forEach { + val distance = AMapUtils.calculateLineDistance( + LatLng(it.lat.toDouble(), it.lng.toDouble()), LatLng(latitude, longitude) + ) + val formatDistance = decimalFormat.format(distance).toFloat() + if (formatDistance <= LocaleConstant.MAX_DISTANCE) { + val angle = atan2( + (it.lat.toDouble() - latitude), (it.lng.toDouble() - longitude) + ) + Math.PI + val formatAngle = decimalFormat.format(angle).toDouble() + + "[$longitude, $latitude,$formatDistance, $formatAngle]".writeToFile( + createLogFile() + ) + dataPoints.add(RadarScanView.DataPoint(formatAngle, formatDistance)) + } + } + withContext(Dispatchers.Main) { + binding.radarScanView.renderPointData(dataPoints, + object : RadarScanView.OnGetNearestPointCallback { + override fun getNearestPoint(point: RadarScanView.DataPoint?) { + if (point == null) { + binding.distanceValueView.text = "大于5.5m" + binding.distancePgBar.progress = 100 + } else { + binding.distanceValueView.text = "${point.distance}m" + val progress = + if (point.distance > LocaleConstant.MAX_DISTANCE) { + 100 + } else { + (point.distance / LocaleConstant.MAX_DISTANCE) * 100 + } + binding.distancePgBar.progress = progress.toInt() + } + } + }) } } } @@ -1644,60 +1804,33 @@ isDetectMarker = true - //角度 - degreeCache["lastDegree"] = 0f + if (isExecuteTask) { + binding.taskStateView.visibility = View.GONE + binding.taskStateView.isSelected = false + } else { + binding.taskStateView.visibility = View.VISIBLE + binding.taskStateView.isSelected = true + } } fun bindingValue(hex: String) { if (hex.startsWith("4E")) { try { //4E转为String为N,代表能量值 - //用能量值转动表盘 val energyResponse = hex.take(10).hexToString() val energy = energyResponse.substring(1).toInt() if (energy >= 4000) { - isPlaying = if (!isPlaying) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(fastSoundResourceId) - false - } + soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) } else { - isPlaying = if (!isPlaying) { - soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(slowSoundResourceId) - false - } + soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) } - binding.resultTextView.text = "信号能量值:${energyResponse}" - - //转换为转动的角度 - val degree = (energy.toFloat() / (50 * 100)) * 180 - binding.energyValueView.text = decimal.format(degree) - - degreeCache["lastDegree"]?.apply { - val animation = RotateAnimation( - this, - degree, - Animation.RELATIVE_TO_SELF, - 0.5f, - Animation.RELATIVE_TO_SELF, - 0.5f - ) - animation.duration = 0 - animation.fillAfter = true - binding.needleView.startAnimation(animation) - } - - //保存旋转后的角度 - degreeCache["lastDegree"] = degree + //通过设置进度条表示能量值 + binding.energyPgBar.progress = energy + binding.energyValueView.text = "${energy}dB" if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" + binding.energyTipsView.text = "信号较弱,可能距离较远" binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) @@ -1712,11 +1845,11 @@ binding.searchResultView.setTextColor(Color.parseColor("#8D1717")) binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } else if (energy >= 4100) {//148° - binding.energyTipsView.text = "标识器信号极强,可能在正下方" + binding.energyTipsView.text = "信号极强,接近标识器正上方" binding.energyTipsView.setTextColor(Color.parseColor("#428d00")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" + binding.energyTipsView.text = "已靠近,请继续移动位置" binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } @@ -1757,31 +1890,37 @@ binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) //自动上传标识器 -// taskBean = DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") -// taskBean?.apply { -// /** -// * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 -// * */ -// taskViewModel.uploadMarker(taskCode) -// } + if (isExecuteTask) { + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) + } + } } } } + //更新罗盘角度 + fun updateDegreeValue(degree: Int) { + binding.radarScanView.setDegreeValue(degree) + } + private fun initTimer() { searchMarkerTimer = Timer() signalTask = object : TimerTask() { override fun run() { - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() } } energyTask = object : TimerTask() { override fun run() { - out?.write('6'.code) - out?.flush() + out.write('6'.code) + out.flush() } } @@ -1798,6 +1937,7 @@ gpioManager.setGpioLow("18") isDetectMarker = false soundPool.autoPause() + locationManager.stopLocation() super.dismiss() } } diff --git a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt index f092eb0..040eb10 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt @@ -5,7 +5,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.LabelBean +import com.casic.electric.detector.bean.MarkerLocalBean import com.casic.electric.detector.databinding.ActivityObjectDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.FileType @@ -23,7 +23,7 @@ private val kTag = "ObjectDetailActivity" private val context: Context = this@ObjectDetailActivity private val gson by lazy { Gson() } - private lateinit var labelBean: LabelBean + private lateinit var markerLocalBean: MarkerLocalBean override fun initOnCreate(savedInstanceState: Bundle?) { window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) @@ -36,37 +36,37 @@ val objectJson = intent.getStringExtra(Constant.INTENT_PARAM)!! try { - labelBean = gson.fromJson(objectJson, object : TypeToken() {}.type) + markerLocalBean = gson.fromJson(objectJson, object : TypeToken() {}.type) - binding.markerObjTypeView.text = labelBean.markerObjType - binding.markerNumberView.text = labelBean.markerNumber - binding.objectNameView.text = labelBean.objectName - binding.voltageLevelView.text = labelBean.voltageLevel - binding.transformerModelView.text = labelBean.transformerModel - binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial - binding.sizeView.text = labelBean.size - binding.bottomDepthView.text = labelBean.bottomDepth - binding.jointCountView.text = labelBean.jointCount - binding.casingMaterialView.text = labelBean.casingMaterial - binding.casingSpecView.text = labelBean.casingSpec - binding.constructTimeView.text = labelBean.constructTime - binding.inspectionUnitView.text = labelBean.inspectionUnit - binding.areaView.text = labelBean.area - binding.roadView.text = labelBean.road - binding.memo1View.text = labelBean.memo1 - binding.memo2View.text = labelBean.memo2 - binding.memo3View.text = labelBean.memo3 - binding.markerIdView.text = labelBean.markerId - binding.markerTypeView.text = labelBean.markerType - binding.ownerView.text = labelBean.owner - binding.markerDepthView.text = labelBean.markerDepth - binding.electricTagCountView.text = labelBean.electricTagCount - binding.installedTimeView.text = labelBean.installedTime - binding.longitudeView.text = labelBean.longitude - binding.latitudeView.text = labelBean.latitude - binding.markerMemo1View.text = labelBean.markerMemo1 - binding.markerMemo2View.text = labelBean.markerMemo2 - binding.markerMemo3View.text = labelBean.markerMemo3 +// binding.markerObjTypeView.text = labelBean.markerObjType +// binding.markerNumberView.text = labelBean.markerNumber +// binding.objectNameView.text = labelBean.objectName +// binding.voltageLevelView.text = labelBean.voltageLevel +// binding.transformerModelView.text = labelBean.transformerModel +// binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial +// binding.sizeView.text = labelBean.size +// binding.bottomDepthView.text = labelBean.bottomDepth +// binding.jointCountView.text = labelBean.jointCount +// binding.casingMaterialView.text = labelBean.casingMaterial +// binding.casingSpecView.text = labelBean.casingSpec +// binding.constructTimeView.text = labelBean.constructTime +// binding.inspectionUnitView.text = labelBean.inspectionUnit +// binding.areaView.text = labelBean.area +// binding.roadView.text = labelBean.road +// binding.memo1View.text = labelBean.memo1 +// binding.memo2View.text = labelBean.memo2 +// binding.memo3View.text = labelBean.memo3 +// binding.markerIdView.text = labelBean.markerId +// binding.markerTypeView.text = labelBean.markerType +// binding.ownerView.text = labelBean.owner +// binding.markerDepthView.text = labelBean.markerDepth +// binding.electricTagCountView.text = labelBean.electricTagCount +// binding.installedTimeView.text = labelBean.installedTime +// binding.longitudeView.text = labelBean.longitude +// binding.latitudeView.text = labelBean.latitude +// binding.markerMemo1View.text = labelBean.markerMemo1 +// binding.markerMemo2View.text = labelBean.markerMemo2 +// binding.markerMemo3View.text = labelBean.markerMemo3 } catch (e: NumberFormatException) { e.printStackTrace() } @@ -77,7 +77,7 @@ binding.showImageView.setOnClickListener { //查数据库 - if (labelBean.imagePath.isNullOrEmpty()) { + if (markerLocalBean.imagePath.isNullOrEmpty()) { "此标识器无图片".show(context) } else { val realPaths: ArrayList = ArrayList() //真实图片路径 @@ -85,7 +85,7 @@ /** * /images/markers/202307/0008818922_EVENT_20230704_160349_0_1.jpg,/images/markers/202307/0008818922_EVENT_20230704_160406_0_2.jpg * */ - val imagePath = labelBean.imagePath + val imagePath = markerLocalBean.imagePath if (imagePath.contains(",")) { val list = imagePath.split(",") list.forEach { path -> diff --git a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt index ea74e8a..57c93fe 100644 --- a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt +++ b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt @@ -1,8 +1,10 @@ package com.casic.electric.detector.vm import android.content.Context +import android.util.Log import androidx.lifecycle.MutableLiveData import com.casic.electric.detector.base.BaseApplication +import com.casic.electric.detector.bean.TaskMarkerLocalBean import com.casic.electric.detector.extensions.getResponseMessage import com.casic.electric.detector.extensions.getResponseState import com.casic.electric.detector.model.MarkerFileModel @@ -21,6 +23,8 @@ import com.pengxh.kt.lite.utils.SaveKeyValues class TaskViewModel : BaseViewModel() { + + private val kTag = "TaskViewModel" private val gson by lazy { Gson() } val markerFileResult = MutableLiveData() val taskResult = MutableLiveData() @@ -165,40 +169,25 @@ loadState.value = LoadState.Fail }) - fun uploadTask(userId: String, taskId: String?, state: String) = launch({ + fun uploadTask( + context: Context, userId: String, taskId: String, taskCode: String, state: String + ) = launch({ loadState.value = LoadState.Loading val response = RetrofitServiceManager.uploadTask(userId, taskId, state) if (response.getResponseState()) { loadState.value = LoadState.Success - if (state == "2") { - "工单${taskId}已提交!".show(BaseApplication.get()) - //删除本地数据库 -// DataBaseManager.get.deleteTaskById(taskId) - SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") - } - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(BaseApplication.get()) - } - }, { - it.printStackTrace() - loadState.value = LoadState.Fail - }) - - fun uploadTask(context: Context, userId: String, taskId: String?, state: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadTask(userId, taskId, state) - if (response.getResponseState()) { - loadState.value = LoadState.Success + //工单提交之后,并且状态是2,删除本地Task记录 if (state == "2") { "工单${taskId}已提交!".show(context) //删除本地数据库 - DataBaseManager.get.deleteTaskById(taskId) + DataBaseManager.get.deleteLocalTaskById(taskId, taskCode) SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") val element = JsonParser.parseString(response) val jsonObject = element.asJsonObject executeTaskResult.value = jsonObject.get("success").asString + } else { + Log.d(kTag, "uploadTask: 仅执行工单,不删除本地工单数据") } } else { loadState.value = LoadState.Fail @@ -225,17 +214,12 @@ loadState.value = LoadState.Fail }) - fun uploadMarker(context: Context, taskDetailId: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadMarker(taskDetailId) - if (response.getResponseState()) { - loadState.value = LoadState.Success - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(context) - } + fun uploadMarker(context: Context, marker: TaskMarkerLocalBean) = launch({ + //主键ID代替MarkerId + RetrofitServiceManager.uploadMarker(marker.id.toString()) + "标识器${marker.markerId}已探测!".show(context) + DataBaseManager.get.updateLocalTaskMarkerState(marker) }, { it.printStackTrace() - loadState.value = LoadState.Fail }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt new file mode 100644 index 0000000..e3831d6 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt @@ -0,0 +1,60 @@ +package com.casic.electric.detector.widgets + +import android.app.Dialog +import android.content.Context +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Bundle +import com.casic.electric.detector.R +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.databinding.DialogMarkerDetailBinding +import com.casic.electric.detector.utils.LocaleConstant +import com.pengxh.kt.lite.extensions.binding +import com.pengxh.kt.lite.extensions.getScreenHeight +import com.pengxh.kt.lite.extensions.getScreenWidth + +class MarkerDetailDialog constructor(context: Context) : + Dialog(context, R.style.UserDefinedDialogStyle) { + + private lateinit var marker: MarkerLocalBean + + fun setMarker(marker: MarkerLocalBean) { + this.marker = marker + } + + private val binding: DialogMarkerDetailBinding by binding() + + private fun Dialog.initDialogLayoutParams() { + val window = this.window ?: return + window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + window.decorView.setBackgroundColor(Color.TRANSPARENT) + val params = window.attributes + params.width = ((context.getScreenWidth() * 0.8).toInt()) + params.height = ((context.getScreenHeight() * 0.7).toInt()) + window.attributes = params + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.initDialogLayoutParams() + setCanceledOnTouchOutside(true) + + binding.objectTypeView.text = LocaleConstant.POINT_TYPE_ARRAY[marker.objectType.toInt() - 1] + binding.pipelineTypeView.text = marker.pipelineType + binding.pipelineDiameterView.text = marker.pipelineDiameter + binding.pipelineMaterialView.text = marker.pipelineMaterial + binding.buryMethodView.text = marker.buryMethod + binding.buryDeepView.text = marker.buryDepth + binding.areaView.text = marker.area + binding.lineView.text = marker.line + binding.roadView.text = marker.road + binding.constructTimeView.text = marker.constructTime + binding.ownerView.text = marker.owner + binding.identifierIdView.text = marker.markerId + binding.identifierTypeView.text = marker.markerType + binding.identifierDeepView.text = marker.markerDepth + binding.personView.text = marker.installationDept + binding.installTimeView.text = marker.updateTime + binding.remarkView.text = marker.remark + } +} \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt index 837ae86..2f1bb58 100644 --- a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt @@ -276,7 +276,7 @@ //先存本地 lifecycleScope.launch { withContext(Dispatchers.IO) { - DataBaseManager.get.insertSmallLabel(smallLabelData) +// DataBaseManager.get.insertSmallLabel(smallLabelData) } } @@ -339,7 +339,7 @@ gpioManager.setGpioLow("18") //查本地库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isEmpty()) { binding.objectAttrInclude.markerIdView.text = markerId } else { diff --git a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt index d3ffdd3..a5834bd 100644 --- a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt @@ -6,6 +6,7 @@ import android.app.Dialog import android.content.Context import android.content.DialogInterface +import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable @@ -19,16 +20,16 @@ import android.os.CountDownTimer import android.os.Handler import android.os.Message +import android.util.Log import android.view.KeyEvent import android.view.View -import android.view.animation.Animation -import android.view.animation.RotateAnimation import android.widget.AdapterView import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import com.amap.api.location.AMapLocation import com.amap.api.maps.AMap import com.amap.api.maps.AMapOptions +import com.amap.api.maps.AMapUtils import com.amap.api.maps.CameraUpdateFactory import com.amap.api.maps.CoordinateConverter import com.amap.api.maps.model.BitmapDescriptorFactory @@ -39,8 +40,9 @@ import com.casic.electric.detector.R import com.casic.electric.detector.adapter.EditableImageAdapter import com.casic.electric.detector.base.SerialPortActivity -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.TaskBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean import com.casic.electric.detector.callback.OnGetLocationListener import com.casic.electric.detector.callback.OnImageCompressListener import com.casic.electric.detector.cluster.ClusterItem @@ -49,9 +51,10 @@ import com.casic.electric.detector.databinding.ActivityMainBinding import com.casic.electric.detector.databinding.DialogInstallMarkerBinding import com.casic.electric.detector.databinding.DialogInstallSmallMarkerBinding -import com.casic.electric.detector.databinding.DialogSearchMarkerBinding +import com.casic.electric.detector.databinding.DialogSearchMarkerNewBinding import com.casic.electric.detector.extensions.appendExcelDownloadUrl import com.casic.electric.detector.extensions.compressImage +import com.casic.electric.detector.extensions.createTaskCode import com.casic.electric.detector.extensions.drawCircle import com.casic.electric.detector.extensions.getDefaultValue import com.casic.electric.detector.extensions.hexToString @@ -61,6 +64,7 @@ import com.casic.electric.detector.extensions.setDefaultValue import com.casic.electric.detector.extensions.show import com.casic.electric.detector.extensions.toHex +import com.casic.electric.detector.model.TaskDetailLocalModel import com.casic.electric.detector.model.TaskModel import com.casic.electric.detector.utils.DataBaseManager import com.casic.electric.detector.utils.ExcelHub @@ -70,9 +74,10 @@ import com.casic.electric.detector.utils.LocationHub import com.casic.electric.detector.utils.RouteOnMap import com.casic.electric.detector.vm.TaskViewModel +import com.casic.electric.detector.widgets.MarkerDetailDialog import com.casic.electric.detector.widgets.QueryMarkerDialog +import com.casic.electric.detector.widgets.RadarScanView import com.casic.electric.detector.widgets.SamplePopupWindow -import com.google.gson.Gson import com.luck.picture.lib.basic.PictureSelector import com.luck.picture.lib.config.SelectMimeType import com.luck.picture.lib.entity.LocalMedia @@ -81,8 +86,10 @@ import com.pengxh.kt.lite.extensions.binding import com.pengxh.kt.lite.extensions.convertColor import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.createLogFile import com.pengxh.kt.lite.extensions.dateToTimestamp import com.pengxh.kt.lite.extensions.dp2px +import com.pengxh.kt.lite.extensions.getSystemService import com.pengxh.kt.lite.extensions.initDialogLayoutParams import com.pengxh.kt.lite.extensions.isNetworkConnected import com.pengxh.kt.lite.extensions.navigatePageTo @@ -90,6 +97,7 @@ import com.pengxh.kt.lite.extensions.timestampToCompleteDate import com.pengxh.kt.lite.extensions.timestampToTime import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.extensions.writeToFile import com.pengxh.kt.lite.utils.FileDownloadManager import com.pengxh.kt.lite.utils.LoadState import com.pengxh.kt.lite.utils.LoadingDialogHub @@ -103,47 +111,50 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File +import java.math.RoundingMode import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer import java.util.TimerTask +import kotlin.math.atan2 @SuppressLint("all") class MainActivity : SerialPortActivity(), SensorEventListener, Handler.Callback { private val kTag = "MainActivity" - private val context = this@MainActivity + private val context = this private val samplePopupWindow by lazy { SamplePopupWindow(this) } - private val gson by lazy { Gson() } private val regionRadius by lazy { LocaleConstant.RADIUS_SIZE.dp2px(this) } private val backDrawables by lazy { HashMap() } private val installDialog by lazy { InstallMarkerDialog(this) } - private val searchDialog by lazy { SearchMarkerDialog(this) } + private val searchNewDialog by lazy { SearchMarkerNewDialog(this) } + private val detailDialog by lazy { MarkerDetailDialog(this) } + private val locationHub by lazy { LocationHub(this) } + private val decimalFormat by lazy { DecimalFormat("0.00") } private val sensorMessageCode = 2024022301 private val rotationMatrix = FloatArray(9)//旋转矩阵缓存 private val valueArray = FloatArray(3)//方位角数值 private var clickTime: Long = 0 - private var labelBeans = ArrayList() + private var markers = ArrayList() + private var smallMarkers = ArrayList() private var clusterOverlay: ClusterOverlay? = null - private var latitude: Double = 0.0 - private var longitude: Double = 0.0 private var isFreeTask = false + private var freeTaskTitle = "" private var ids = HashSet() private var signalTask: TimerTask? = null + private var energyTask: TimerTask? = null private var searchMarkerTimer: Timer? = null - private var taskId: String? = null + private var freeTaskId: String? = null private var gravity: FloatArray? = null private var geomagnetic: FloatArray? = null private lateinit var aMap: AMap - private lateinit var task: TaskBean private lateinit var sensorManager: SensorManager private lateinit var weakReferenceHandler: WeakReferenceHandler /***inner class 需要用到*****start*/ private val gpioManager by lazy { GpioManager() } - private val locationHub by lazy { LocationHub(this) } private val taskViewModel by lazy { ViewModelProvider(this)[TaskViewModel::class.java] } private val attr = AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ALARM) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build() @@ -168,6 +179,9 @@ slowSoundResourceId = soundPool.load(this, R.raw.ring4, 1) fastSoundResourceId = soundPool.load(this, R.raw.ring2, 1) + //保留小数2位 + decimalFormat.roundingMode = RoundingMode.HALF_UP + "登录成功".show(this) //地图初始化 @@ -177,12 +191,14 @@ samplePopupWindow.setPopupMenuItem(LocaleConstant.POPUP_TITLES) samplePopupWindow.setBackgroundDrawable(null) + sensorManager = getSystemService()!! + weakReferenceHandler = WeakReferenceHandler(this) + //task网络请求监听 taskViewModel.markerFileResult.observe(this) { if (it.success == "true") { //清空之前的数据 - DataBaseManager.get.clearLabels() - DataBaseManager.get.clearSmallLabels() + DataBaseManager.get.clearMarkers() /** * "data":"/xls/marker1.xls,/xls/smallMarker1.xls" * 有两份excel表格需要下载 @@ -200,10 +216,10 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { - labelBeans = ExcelHub.readLabel(file.absolutePath) + markers = ExcelHub.readLabel(file.absolutePath) withContext(Dispatchers.IO) { - labelBeans.forEach { label -> - DataBaseManager.get.insertLabel(label) + markers.forEach { marker -> + DataBaseManager.get.saveMarkerInLocale(marker) } } LoadingDialogHub.dismiss() @@ -227,12 +243,12 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { -// smallLabels = ExcelHub.readSmallLabel(file.absolutePath) -// withContext(Dispatchers.IO) { -// smallLabels.forEach { label -> -// DataBaseManager.get.insertSmallLabel(label) -// } -// } + smallMarkers = ExcelHub.readSmallLabel(file.absolutePath) + withContext(Dispatchers.IO) { + smallMarkers.forEach { marker -> + DataBaseManager.get.saveSmallMarkerInLocale(marker) + } + } } } @@ -250,18 +266,35 @@ taskViewModel.taskResult.observe(this) { if (it.success == "true") { //清空之前的数据 -// DataBaseManager.get.clearTasks() AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") .setMessage("您有${it.message.size}个新任务!").setPositiveButton("知道了") .setOnDialogButtonClickListener(object : AlertMessageDialog.OnDialogButtonClickListener { override fun onConfirmClick() { - saveTaskInformation(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { + freeTaskId = it + // 自由巡检保存在本地 + val bean = TaskLocalBean() + bean.id = freeTaskId.toString().toLong() + val currentTimeMillis = System.currentTimeMillis() + bean.taskCode = currentTimeMillis.createTaskCode() + bean.description = freeTaskTitle + val time = currentTimeMillis.timestampToCompleteDate() + bean.createTime = time + bean.status = "0" + val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + bean.createUserName = userName + bean.startTime = time + bean.endTime = "" + bean.isFreeTask = "1" + DataBaseManager.get.saveTaskInLocale(bean) + } + taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -290,10 +323,11 @@ }).build().show() } else { lifecycleScope.launch(Dispatchers.Main) { - val labels = withContext(Dispatchers.IO) { - DataBaseManager.get.queryLabelById("0") + val markers = withContext(Dispatchers.IO) { + DataBaseManager.get.queryMarkerByState("0") } - if (labels.isNotEmpty()) { + //如果有需要补全的标识器,Popup右侧会有小圆点提示 + if (markers.isNotEmpty()) { samplePopupWindow.setShowPosition(4) } val x = @@ -307,37 +341,42 @@ SamplePopupWindow.OnPopupWindowClickListener { override fun onPopupItemClicked(position: Int) { when (position) { - 0 -> updateLabels() + 0 -> updateMarkers() 1 -> downloadTask() 2 -> navigatePageTo() 3 -> uploadEvent() -// 4 -> uploadLabel() +// 4 -> completionMarker() } } }) //安装。上传,然后存入本地库 binding.installButton.setOnClickListener { - AlertControlDialog.Builder().setContext(context).setTitle("提示") - .setMessage("请选择安装对象").setPositiveButton("标识器") - .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - //标识器 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installMarkerDialog.show() - } + if (isFreeTask) { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("正在自由巡检任务中,请完成此次任务之后再使用此功能") + .setPositiveButton("好的").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { - override fun onCancelClick() { - //电子标签 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installSmallMarkerDialog.show() - } - }).build().show() + } + }).build().show() + } else { + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择安装对象").setPositiveButton("标识器") + .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + //标识器 +// installMarkerDialog.show() + } + + override fun onCancelClick() { + //电子标签 +// installSmallMarkerDialog.show() + } + }).build().show() + } } //查看 @@ -351,24 +390,24 @@ ) { //查询数据库 lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { + markers = withContext(Dispatchers.IO) { if (contentValue.size == 1) { - DataBaseManager.get.loadLabelByCondition( + DataBaseManager.get.loadMarkerByCondition( selectedCondition, contentValue[0] - ) as ArrayList + ) as ArrayList } else { DataBaseManager.get.loadLabelByDate( contentValue[0], contentValue[1] - ) as ArrayList + ) as ArrayList } } val latitudeList = ArrayList() val longitudeList = ArrayList() - labelBeans.forEach { - val latitude = it.latitude - val longitude = it.longitude + markers.forEach { + val latitude = markers.first().lat + val longitude = markers.first().lng if (latitude.isNotBlank() && longitude.isNotBlank()) { if (CoordinateConverter.isAMapDataAvailable( latitude.toDouble(), longitude.toDouble() @@ -400,52 +439,63 @@ //巡检 binding.inspectionButton.setOnClickListener { -// val task = DataBaseManager.get.queryDistinctTask() -// if (task.isNotEmpty()) { -// val arrayList = ArrayList() -// task.forEachIndexed { index, taskBean -> -// arrayList.add("任务${index + 1}:${taskBean.taskId},${taskBean.desc}") -// } -// -// BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) -// .setActionItemTitle(arrayList) -// .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { -// override fun onActionItemClick(position: Int) { -// val taskBean = task[position] -// SaveKeyValues.putValue(LocaleConstant.TASK_ID, taskBean.taskId) -// AlertControlDialog.Builder().setContext(context).setTitle("提示") -// .setMessage("请选择操作方式").setPositiveButton("执行工单") -// .setNegativeButton("提交工单") -// .setOnDialogButtonClickListener(object : -// AlertControlDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// detectRedrawGraphic(taskBean.taskId) -// -// val latLng = LatLng( -// taskBean.lat.toDouble(), taskBean.lng.toDouble() -// ) -// aMap.moveCamera( -// CameraUpdateFactory.newLatLngZoom(latLng, 16f) -// ) -// uploadTask(taskBean.taskId, "1") -// } -// -// override fun onCancelClick() { -// uploadTask(taskBean.taskId, "2") -// } -// }).build().show() -// } -// }).build().show() -// } else { -// AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") -// .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") -// .setPositiveButton("知道了").setOnDialogButtonClickListener(object : -// AlertMessageDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// startFreeTask() -// } -// }).build().show() -// } + val tasks = DataBaseManager.get.loadLocalTask() + if (tasks.isNotEmpty()) { + val arrayList = ArrayList() + tasks.forEachIndexed { index, task -> + arrayList.add("任务${index + 1}:${task.taskId},${task.description}") + } + + BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) + .setActionItemTitle(arrayList) + .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { + override fun onActionItemClick(position: Int) { + val task = tasks[position] + Log.d(kTag, task.toJson()) + SaveKeyValues.putValue(LocaleConstant.TASK_ID, task.taskId) + SaveKeyValues.putValue(LocaleConstant.TASK_CODE, task.taskCode) + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择操作方式").setPositiveButton("执行工单") + .setNegativeButton("提交工单") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + if (task.markerModels.isNotEmpty()) { + //移到Task下属第一个标识器位置 + val firstMarker = task.markerModels.first() + val latLng = LatLng(firstMarker.lat, firstMarker.lng) + aMap.moveCamera( + CameraUpdateFactory.newLatLngZoom(latLng, 16f) + ) + //执行工单 + uploadTask(task.taskId, task.taskCode, "1") + detectRedrawGraphic(task) + isExecuteTask = true + } else { + "此工单下无标识器,将执行自由巡检任务".show(context) + freeTaskId = task.taskId + openSerialPort() + } + } + + override fun onCancelClick() { + //提交工单 + uploadTask(task.taskId, task.taskCode, "2") + isExecuteTask = false + } + }).build().show() + } + }).build().show() + } else { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") + .setPositiveButton("知道了").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + startFreeTask() + } + }).build().show() + } } //探测 @@ -465,7 +515,7 @@ } }).build().show() } else { - searchDialog.show() + searchNewDialog.show() } } @@ -479,16 +529,21 @@ isFreeTask = false soundPool.autoPause() + //停止信号和ID搜索定时器 + signalTask?.cancel() + energyTask?.cancel() + searchMarkerTimer?.cancel() + //降低串口电位 gpioManager.setGpioLow("18") binding.stopFreeTaskButton.visibility = View.GONE - if (taskId.isNullOrBlank()) { + if (freeTaskId.isNullOrBlank()) { "任务ID异常,无法提交任务,请联系服务器管理员".show(context) return } - taskId?.apply { + freeTaskId?.apply { taskViewModel.uploadTaskMarker(context, this, ArrayList(ids)) } } @@ -497,42 +552,65 @@ } } + private fun uploadTask(taskId: String, taskCode: String, state: String) { + if (isNetworkConnected()) { + val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) + } else { + "网络连接已断开,请检查".show(this) + } + } + private fun startFreeTask() { AlertInputDialog.Builder().setContext(this).setTitle("新建自由巡检任务") .setHintMessage("请输入自由巡检任务简要描述").setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : AlertInputDialog.OnDialogButtonClickListener { override fun onConfirmClick(value: String) { + freeTaskTitle = value val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String taskViewModel.createFreeTask(context, userId, value) - //调高串口电位 - gpioManager.setGpioHigh("18") - - isFreeTask = true - //自由巡检 - signalTask = object : TimerTask() { - override fun run() { - out?.write('2'.code) - out?.flush() - } - } - searchMarkerTimer = Timer() - searchMarkerTimer?.apply { - schedule(signalTask, 0, 100) - } - - binding.stopFreeTaskButton.visibility = View.VISIBLE + openSerialPort() } override fun onCancelClick() {} }).build().show() } + private fun openSerialPort() { + //调高串口电位 + gpioManager.setGpioHigh("18") + + isFreeTask = true + //自由巡检 + signalTask = object : TimerTask() { + override fun run() { + out.write('2'.code) + out.flush() + } + } + + energyTask = object : TimerTask() { + override fun run() { + out.write('6'.code) + out.flush() + } + } + + searchMarkerTimer = Timer() + searchMarkerTimer?.apply { + schedule(signalTask, 0, 200) + schedule(energyTask, 0, 251) + } + + binding.stopFreeTaskButton.visibility = View.VISIBLE + } + override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) + if (searchNewDialog.isDetectMarker) { + searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() if (markerId.isNumber()) { @@ -540,26 +618,47 @@ } } else if (isFreeTask) { val markerId = hex.take(20).hexToString() + if (markerId.isNumber()) { //只响一次,因为探测频率高,所以依旧是连续的报警声 soundPool.play(soundResourceId, 1f, 1f, 0, 0, 1f) - "标识器${markerId}已探测".show(this) //添加地图Marker if (!ids.contains(markerId)) { //根据markerId查询标识器经纬度 - val labels = DataBaseManager.get.queryLabelById(markerId) - if (labels.isNotEmpty()) { - val bean = labels.first() + val markers = DataBaseManager.get.queryMarkerById(markerId) + if (markers.isNotEmpty()) { + val bean = markers.first() aMap.addMarker( MarkerOptions().position( - LatLng( - bean.latitude.toDouble(), bean.longitude.toDouble() - ) + LatLng(bean.lat.toDouble(), bean.lng.toDouble()) ).icon(BitmapDescriptorFactory.fromResource(R.mipmap.label_blue1)) ) } } ids.add(markerId) + + //显示标识器详细信息 + if (!detailDialog.isShowing) { + val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull() + if (markerBean == null) { + "无法查询到此ID【${markerId}】的信息".show(context) + } else { + detailDialog.setMarker(markerBean) + detailDialog.show() + } + } + } + + if (hex.startsWith("4E")) { + val energyResponse = hex.take(10).hexToString() + try { + val energy = energyResponse.substring(1).toInt() + if (energy <= 500 && detailDialog.isShowing) { + detailDialog.dismiss() + } + } catch (e: NumberFormatException) { + e.printStackTrace() + } } } } @@ -570,31 +669,21 @@ LoadState.Loading -> { if (installDialog.isInstallMarker) { LoadingDialogHub.show(this, "标识器安装中,请稍后...") - } else if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - "标识器${this.markerRealId}已探测!".show(context) -// DataBaseManager.get.updateTaskLabel(this) - } } else { LoadingDialogHub.show(this, "提交工单中,请稍后") } } - else -> { + LoadState.Success -> { if (installDialog.isInstallMarker) { -// installDialog.clearDefaultData() + installDialog.clearDefaultData() installDialog.dismiss() - "${installDialog.markerId}安装成功".show(context) + "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } } @@ -618,8 +707,6 @@ aMap.myLocationStyle = locationStyle//设置定位蓝点的Style aMap.isMyLocationEnabled = true//设置是否显示定位小蓝点 aMap.setOnMyLocationChangeListener { - longitude = it.longitude - latitude = it.latitude //经纬度逆编码 locationHub.antiCodingLocation(it) { address -> binding.currentLocationView.text = address @@ -631,19 +718,20 @@ aMap.setOnMapLongClickListener { lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } - //显示标签 - showLabelsOnMap() } //虽然不用显示附属标签,但是需要和标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } + + //显示标签 + showLabelsOnMap() } //自定义定位按钮 @@ -666,39 +754,28 @@ }) } - private fun saveTaskInformation(it: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String - if (it.message.size > 0) { - it.message.forEach { messageModel -> -// val count = DataBaseManager.get.countTaskById(messageModel.id.toString()) -// if (count == 0) { -// messageModel.taskDetailInfos.forEach { info -> -// DataBaseManager.get.insertTaskInformation( -// userName, -// messageModel.description, -// info.taskId.toString(), -// info.id.toString(), -// info.markerId.toString(), -// info.markerIdReal.toString(), -// info.longitude.toString(), -// info.latitude.toString(), -// messageModel.status -// ) -// } -// } + private fun saveUserTasks(task: TaskModel) { + task.message.forEach { model -> + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) + } } - "工单下载成功!".show(context) } + "工单下载成功!".show(this) } private fun showLabelsOnMap() { clusterOverlay?.onDestroy() val clusterItems = ArrayList() - labelBeans.forEach { - if (it.latitude.isNotEmpty() && it.longitude.isNotEmpty()) { - val latitude = it.latitude.toDouble() - val longitude = it.longitude.toDouble() + markers.forEach { + if (it.lat.isNotEmpty() && it.lng.isNotEmpty()) { + val latitude = it.lat.toDouble() + val longitude = it.lng.toDouble() val latLng = LatLng(latitude, longitude, false) val regionItem = RegionItem(latLng, it.id.toString()) @@ -717,7 +794,6 @@ ) backDrawables[0] = bitmapDrawable } - bitmapDrawable } if (clusterNum == 1) { var bitmapDrawable = backDrawables[1] @@ -780,8 +856,8 @@ override fun onActionItemClick(position: Int) { when (position) { 0 -> { - labelBeans.forEach { - if (it.markerId.toString() == item.tag) { + markers.forEach { + if (it.id.toString() == item.tag) { navigatePageTo(it.toJson()) } } @@ -789,11 +865,11 @@ 1 -> { val electricMarkers = ArrayList() -// smallLabels.forEach { -// if (it.markerId.toString() == item.tag) { -// electricMarkers.add(it.electricMarkerId) -// } -// } + smallMarkers.forEach { + if (it.id.toString() == item.tag) { + electricMarkers.add(it.electricMarkerId) + } + } if (electricMarkers.isEmpty()) { "此标识器没有绑定的电子标签".show(context) @@ -818,44 +894,32 @@ }.show() } - private fun detectRedrawGraphic(taskId: String) { -// val tasks = DataBaseManager.get.queryTaskById(taskId) -// if (tasks.isNotEmpty()) { -// tasks.forEach { -// val latLng = LatLng(it.lat.toDouble(), it.lng.toDouble()) -// val otMarkerOptions = MarkerOptions() -// otMarkerOptions.position(latLng) -// otMarkerOptions.visible(true) // 设置可见 -// if (it.state == "未开始") { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_red1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } else { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } -// aMap.addMarker(otMarkerOptions) -// } -// } + private fun detectRedrawGraphic(task: TaskDetailLocalModel) { + task.markerModels.forEach { + val latLng = LatLng(it.lat, it.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (it.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } + aMap.addMarker(otMarkerOptions) + } showLabelsOnMap() } - private fun uploadTask(taskId: String?, state: String) { - if (isNetworkConnected()) { - val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String - taskViewModel.uploadTask(userId, taskId, state) - } else { - "网络连接已断开,请检查".show(this) - } - } - //更新数据 - private fun updateLabels() { + private fun updateMarkers() { AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") .setNegativeButton("取消").setPositiveButton("确定") .setOnDialogButtonClickListener(object : @@ -941,7 +1005,7 @@ SensorManager.getOrientation(rotationMatrix, valueArray) val degree = ((360f + valueArray[0] * 180f / Math.PI) % 360).toInt() -// searchNewDialog.updateDegreeValue(degree) + searchNewDialog.updateDegreeValue(degree) } } return true @@ -953,8 +1017,8 @@ super.onResume() binding.mapView.onResume() lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } //显示标签 showLabelsOnMap() @@ -962,9 +1026,9 @@ //虽然不用显示附属标签,但是需要喝标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } //注册加速度传感器监听 @@ -990,8 +1054,6 @@ override fun onDestroy() { super.onDestroy() binding.mapView.onDestroy() - signalTask?.cancel() - searchMarkerTimer?.cancel() soundPool.release() locationHub.stopLocation() //降低串口电位 @@ -1006,6 +1068,7 @@ private val realPaths = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var countDownTimer: CountDownTimer + private lateinit var locationManager: LocationHub var isReadMarker = false var isInstallMarker = false @@ -1150,8 +1213,8 @@ soundPool.play(soundResourceId, 1f, 1f, 0, -1, 1f) - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() countDownTimer = object : CountDownTimer(5 * 1000, 1000) { override fun onTick(millisUntilFinished: Long) { @@ -1174,6 +1237,21 @@ } } + override fun show() { + super.show() + locationManager = LocationHub(context) + locationManager.getCurrentLocation(true, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + if (location != null) { + binding.markerAttrInclude.lngView.text = location.longitude.toString() + binding.markerAttrInclude.latView.text = location.latitude.toString() + } else { + "当前位置信号差,无法获取定位".show(context) + } + } + }) + } + fun bindingValue(markerId: String) { this.markerId = markerId LoadingDialogHub.dismiss() @@ -1193,6 +1271,7 @@ gpioManager.setGpioLow("18") soundPool.autoPause() isInstallMarker = false + locationManager.stopLocation() super.dismiss() } @@ -1515,6 +1594,21 @@ }) } + //清除默认数据 + fun clearDefaultData() { +// "markerObjectTypeView".setDefaultValue("") +// "pipelineDiameterView".setDefaultValue("") +// "buryDeepView".setDefaultValue("") +// "bottomPipeDiameterView".setDefaultValue("") +// "bottomPointDeepView".setDefaultValue("") +// "areaView".setDefaultValue("") +// "lineView".setDefaultValue("") +// "roadView".setDefaultValue("") +// "ownerView".setDefaultValue("") +// "identifierDeepView".setDefaultValue("") +// "personDeptView".setDefaultValue("") + } + //根据选择类型控制界面某些区域显隐 private fun setLayoutVisibility(vararg args: Int) { binding.objectAttrInclude.objectModeLayout.visibility = args[0] @@ -1566,21 +1660,23 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(context: Context) : Dialog(context) { + /**探测标识器新对话框******************************************************************************/ + inner class SearchMarkerNewDialog(context: Context) : Dialog(context) { - private val binding: DialogSearchMarkerBinding by binding() - private val decimal by lazy { DecimalFormat("0.0") } - private val degreeCache by lazy { HashMap() } - private var isPlaying = false + private val taskId by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String + } + private val taskCode by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_CODE, "") as String + } + private val binding: DialogSearchMarkerNewBinding by binding() private var markerId = "" private lateinit var searchMarkerTimer: Timer private lateinit var signalTask: TimerTask private lateinit var energyTask: TimerTask private lateinit var countDownTimer: CountDownTimer - + private lateinit var locationManager: LocationHub var isDetectMarker = false - var taskBean: TaskBean? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -1590,47 +1686,111 @@ energyTask.cancel() searchMarkerTimer.cancel() - out?.write('3'.code) -// val result = DataBaseManager.get.queryLabelById(markerId) -// if (result.isNotEmpty()) { -// val tag = when (result.first().identifierType) { -// "EM30" -> '7' -// "EM50" -> '8' -// "EM14" -> '9' -// else -> '1' -// } -// if (tag == '1') { -// "此标识器无法读取埋深!".show(context) -// } else { -// // 发送读取标识器埋设深度指令 -// LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") -// out.write(tag.code) -// out.flush() -// countDownTimer = object : CountDownTimer(15 * 1000, 1000) { -// override fun onTick(millisUntilFinished: Long) { -// -// } -// -// override fun onFinish() { -// LoadingDialogHub.dismiss() -// "探测此标识器深度超时,请重试".show(context) -// initTimer() -// } -// } -// countDownTimer.start() -// } -// } else { -// "标识器未安装,安装成功后才可读取埋深!".show(context) -// } + out.write('3'.code) + val result = DataBaseManager.get.queryMarkerById(markerId) + if (result.isNotEmpty()) { + val tag = when (result.first().markerType) { + "EM30" -> '7' + "EM50" -> '8' + "EM14" -> '9' + else -> '1' + } + if (tag == '1') { + "此标识器无法读取埋深!".show(context) + initTimer() + } else { + // 发送读取标识器埋设深度指令 + LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") + out.write(tag.code) + out.flush() + countDownTimer = object : CountDownTimer(15 * 1000, 1000) { + override fun onTick(millisUntilFinished: Long) { + + } + + override fun onFinish() { + LoadingDialogHub.dismiss() + "探测此标识器深度超时,请重试".show(context) + initTimer() + } + } + countDownTimer.start() + } + } else { + "标识器未安装,安装成功后才可读取埋深!".show(context) + initTimer() + } } binding.markerInfoButton.setOnClickListener { //查库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isNotEmpty()) { -// context.navigatePageTo(result.first().toJson()) + context.navigatePageTo(result.first().toJson()) } else { -// context.navigatePageTo(markerId) + context.navigatePageTo(markerId) + } + } + } + + override fun show() { + super.show() + locationManager = LocationHub(context) + //点位渲染,每次定位都计算当前位置与符合条件的点距离 + locationManager.getCurrentLocation(false, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + location?.apply { + renderDataPoint(this) + } + } + }) + } + + /** + * 计算并渲染数据点。点太多采用协程计算,不然会有点卡顿 + * @param location 定位点(天宝RTK获取) + * */ + private fun renderDataPoint(location: AMapLocation) { + val longitude = location.longitude + val latitude = location.latitude + lifecycleScope.launch(Dispatchers.IO) { + val dataPoints = ArrayList() + DataBaseManager.get.loadMarkers().forEach { + val distance = AMapUtils.calculateLineDistance( + LatLng(it.lat.toDouble(), it.lng.toDouble()), LatLng(latitude, longitude) + ) + val formatDistance = decimalFormat.format(distance).toFloat() + if (formatDistance <= LocaleConstant.MAX_DISTANCE) { + val angle = atan2( + (it.lat.toDouble() - latitude), (it.lng.toDouble() - longitude) + ) + Math.PI + val formatAngle = decimalFormat.format(angle).toDouble() + + "[$longitude, $latitude,$formatDistance, $formatAngle]".writeToFile( + createLogFile() + ) + dataPoints.add(RadarScanView.DataPoint(formatAngle, formatDistance)) + } + } + withContext(Dispatchers.Main) { + binding.radarScanView.renderPointData(dataPoints, + object : RadarScanView.OnGetNearestPointCallback { + override fun getNearestPoint(point: RadarScanView.DataPoint?) { + if (point == null) { + binding.distanceValueView.text = "大于5.5m" + binding.distancePgBar.progress = 100 + } else { + binding.distanceValueView.text = "${point.distance}m" + val progress = + if (point.distance > LocaleConstant.MAX_DISTANCE) { + 100 + } else { + (point.distance / LocaleConstant.MAX_DISTANCE) * 100 + } + binding.distancePgBar.progress = progress.toInt() + } + } + }) } } } @@ -1644,60 +1804,33 @@ isDetectMarker = true - //角度 - degreeCache["lastDegree"] = 0f + if (isExecuteTask) { + binding.taskStateView.visibility = View.GONE + binding.taskStateView.isSelected = false + } else { + binding.taskStateView.visibility = View.VISIBLE + binding.taskStateView.isSelected = true + } } fun bindingValue(hex: String) { if (hex.startsWith("4E")) { try { //4E转为String为N,代表能量值 - //用能量值转动表盘 val energyResponse = hex.take(10).hexToString() val energy = energyResponse.substring(1).toInt() if (energy >= 4000) { - isPlaying = if (!isPlaying) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(fastSoundResourceId) - false - } + soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) } else { - isPlaying = if (!isPlaying) { - soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(slowSoundResourceId) - false - } + soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) } - binding.resultTextView.text = "信号能量值:${energyResponse}" - - //转换为转动的角度 - val degree = (energy.toFloat() / (50 * 100)) * 180 - binding.energyValueView.text = decimal.format(degree) - - degreeCache["lastDegree"]?.apply { - val animation = RotateAnimation( - this, - degree, - Animation.RELATIVE_TO_SELF, - 0.5f, - Animation.RELATIVE_TO_SELF, - 0.5f - ) - animation.duration = 0 - animation.fillAfter = true - binding.needleView.startAnimation(animation) - } - - //保存旋转后的角度 - degreeCache["lastDegree"] = degree + //通过设置进度条表示能量值 + binding.energyPgBar.progress = energy + binding.energyValueView.text = "${energy}dB" if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" + binding.energyTipsView.text = "信号较弱,可能距离较远" binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) @@ -1712,11 +1845,11 @@ binding.searchResultView.setTextColor(Color.parseColor("#8D1717")) binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } else if (energy >= 4100) {//148° - binding.energyTipsView.text = "标识器信号极强,可能在正下方" + binding.energyTipsView.text = "信号极强,接近标识器正上方" binding.energyTipsView.setTextColor(Color.parseColor("#428d00")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" + binding.energyTipsView.text = "已靠近,请继续移动位置" binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } @@ -1757,31 +1890,37 @@ binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) //自动上传标识器 -// taskBean = DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") -// taskBean?.apply { -// /** -// * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 -// * */ -// taskViewModel.uploadMarker(taskCode) -// } + if (isExecuteTask) { + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) + } + } } } } + //更新罗盘角度 + fun updateDegreeValue(degree: Int) { + binding.radarScanView.setDegreeValue(degree) + } + private fun initTimer() { searchMarkerTimer = Timer() signalTask = object : TimerTask() { override fun run() { - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() } } energyTask = object : TimerTask() { override fun run() { - out?.write('6'.code) - out?.flush() + out.write('6'.code) + out.flush() } } @@ -1798,6 +1937,7 @@ gpioManager.setGpioLow("18") isDetectMarker = false soundPool.autoPause() + locationManager.stopLocation() super.dismiss() } } diff --git a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt index f092eb0..040eb10 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt @@ -5,7 +5,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.LabelBean +import com.casic.electric.detector.bean.MarkerLocalBean import com.casic.electric.detector.databinding.ActivityObjectDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.FileType @@ -23,7 +23,7 @@ private val kTag = "ObjectDetailActivity" private val context: Context = this@ObjectDetailActivity private val gson by lazy { Gson() } - private lateinit var labelBean: LabelBean + private lateinit var markerLocalBean: MarkerLocalBean override fun initOnCreate(savedInstanceState: Bundle?) { window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) @@ -36,37 +36,37 @@ val objectJson = intent.getStringExtra(Constant.INTENT_PARAM)!! try { - labelBean = gson.fromJson(objectJson, object : TypeToken() {}.type) + markerLocalBean = gson.fromJson(objectJson, object : TypeToken() {}.type) - binding.markerObjTypeView.text = labelBean.markerObjType - binding.markerNumberView.text = labelBean.markerNumber - binding.objectNameView.text = labelBean.objectName - binding.voltageLevelView.text = labelBean.voltageLevel - binding.transformerModelView.text = labelBean.transformerModel - binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial - binding.sizeView.text = labelBean.size - binding.bottomDepthView.text = labelBean.bottomDepth - binding.jointCountView.text = labelBean.jointCount - binding.casingMaterialView.text = labelBean.casingMaterial - binding.casingSpecView.text = labelBean.casingSpec - binding.constructTimeView.text = labelBean.constructTime - binding.inspectionUnitView.text = labelBean.inspectionUnit - binding.areaView.text = labelBean.area - binding.roadView.text = labelBean.road - binding.memo1View.text = labelBean.memo1 - binding.memo2View.text = labelBean.memo2 - binding.memo3View.text = labelBean.memo3 - binding.markerIdView.text = labelBean.markerId - binding.markerTypeView.text = labelBean.markerType - binding.ownerView.text = labelBean.owner - binding.markerDepthView.text = labelBean.markerDepth - binding.electricTagCountView.text = labelBean.electricTagCount - binding.installedTimeView.text = labelBean.installedTime - binding.longitudeView.text = labelBean.longitude - binding.latitudeView.text = labelBean.latitude - binding.markerMemo1View.text = labelBean.markerMemo1 - binding.markerMemo2View.text = labelBean.markerMemo2 - binding.markerMemo3View.text = labelBean.markerMemo3 +// binding.markerObjTypeView.text = labelBean.markerObjType +// binding.markerNumberView.text = labelBean.markerNumber +// binding.objectNameView.text = labelBean.objectName +// binding.voltageLevelView.text = labelBean.voltageLevel +// binding.transformerModelView.text = labelBean.transformerModel +// binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial +// binding.sizeView.text = labelBean.size +// binding.bottomDepthView.text = labelBean.bottomDepth +// binding.jointCountView.text = labelBean.jointCount +// binding.casingMaterialView.text = labelBean.casingMaterial +// binding.casingSpecView.text = labelBean.casingSpec +// binding.constructTimeView.text = labelBean.constructTime +// binding.inspectionUnitView.text = labelBean.inspectionUnit +// binding.areaView.text = labelBean.area +// binding.roadView.text = labelBean.road +// binding.memo1View.text = labelBean.memo1 +// binding.memo2View.text = labelBean.memo2 +// binding.memo3View.text = labelBean.memo3 +// binding.markerIdView.text = labelBean.markerId +// binding.markerTypeView.text = labelBean.markerType +// binding.ownerView.text = labelBean.owner +// binding.markerDepthView.text = labelBean.markerDepth +// binding.electricTagCountView.text = labelBean.electricTagCount +// binding.installedTimeView.text = labelBean.installedTime +// binding.longitudeView.text = labelBean.longitude +// binding.latitudeView.text = labelBean.latitude +// binding.markerMemo1View.text = labelBean.markerMemo1 +// binding.markerMemo2View.text = labelBean.markerMemo2 +// binding.markerMemo3View.text = labelBean.markerMemo3 } catch (e: NumberFormatException) { e.printStackTrace() } @@ -77,7 +77,7 @@ binding.showImageView.setOnClickListener { //查数据库 - if (labelBean.imagePath.isNullOrEmpty()) { + if (markerLocalBean.imagePath.isNullOrEmpty()) { "此标识器无图片".show(context) } else { val realPaths: ArrayList = ArrayList() //真实图片路径 @@ -85,7 +85,7 @@ /** * /images/markers/202307/0008818922_EVENT_20230704_160349_0_1.jpg,/images/markers/202307/0008818922_EVENT_20230704_160406_0_2.jpg * */ - val imagePath = labelBean.imagePath + val imagePath = markerLocalBean.imagePath if (imagePath.contains(",")) { val list = imagePath.split(",") list.forEach { path -> diff --git a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt index ea74e8a..57c93fe 100644 --- a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt +++ b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt @@ -1,8 +1,10 @@ package com.casic.electric.detector.vm import android.content.Context +import android.util.Log import androidx.lifecycle.MutableLiveData import com.casic.electric.detector.base.BaseApplication +import com.casic.electric.detector.bean.TaskMarkerLocalBean import com.casic.electric.detector.extensions.getResponseMessage import com.casic.electric.detector.extensions.getResponseState import com.casic.electric.detector.model.MarkerFileModel @@ -21,6 +23,8 @@ import com.pengxh.kt.lite.utils.SaveKeyValues class TaskViewModel : BaseViewModel() { + + private val kTag = "TaskViewModel" private val gson by lazy { Gson() } val markerFileResult = MutableLiveData() val taskResult = MutableLiveData() @@ -165,40 +169,25 @@ loadState.value = LoadState.Fail }) - fun uploadTask(userId: String, taskId: String?, state: String) = launch({ + fun uploadTask( + context: Context, userId: String, taskId: String, taskCode: String, state: String + ) = launch({ loadState.value = LoadState.Loading val response = RetrofitServiceManager.uploadTask(userId, taskId, state) if (response.getResponseState()) { loadState.value = LoadState.Success - if (state == "2") { - "工单${taskId}已提交!".show(BaseApplication.get()) - //删除本地数据库 -// DataBaseManager.get.deleteTaskById(taskId) - SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") - } - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(BaseApplication.get()) - } - }, { - it.printStackTrace() - loadState.value = LoadState.Fail - }) - - fun uploadTask(context: Context, userId: String, taskId: String?, state: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadTask(userId, taskId, state) - if (response.getResponseState()) { - loadState.value = LoadState.Success + //工单提交之后,并且状态是2,删除本地Task记录 if (state == "2") { "工单${taskId}已提交!".show(context) //删除本地数据库 - DataBaseManager.get.deleteTaskById(taskId) + DataBaseManager.get.deleteLocalTaskById(taskId, taskCode) SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") val element = JsonParser.parseString(response) val jsonObject = element.asJsonObject executeTaskResult.value = jsonObject.get("success").asString + } else { + Log.d(kTag, "uploadTask: 仅执行工单,不删除本地工单数据") } } else { loadState.value = LoadState.Fail @@ -225,17 +214,12 @@ loadState.value = LoadState.Fail }) - fun uploadMarker(context: Context, taskDetailId: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadMarker(taskDetailId) - if (response.getResponseState()) { - loadState.value = LoadState.Success - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(context) - } + fun uploadMarker(context: Context, marker: TaskMarkerLocalBean) = launch({ + //主键ID代替MarkerId + RetrofitServiceManager.uploadMarker(marker.id.toString()) + "标识器${marker.markerId}已探测!".show(context) + DataBaseManager.get.updateLocalTaskMarkerState(marker) }, { it.printStackTrace() - loadState.value = LoadState.Fail }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt new file mode 100644 index 0000000..e3831d6 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt @@ -0,0 +1,60 @@ +package com.casic.electric.detector.widgets + +import android.app.Dialog +import android.content.Context +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Bundle +import com.casic.electric.detector.R +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.databinding.DialogMarkerDetailBinding +import com.casic.electric.detector.utils.LocaleConstant +import com.pengxh.kt.lite.extensions.binding +import com.pengxh.kt.lite.extensions.getScreenHeight +import com.pengxh.kt.lite.extensions.getScreenWidth + +class MarkerDetailDialog constructor(context: Context) : + Dialog(context, R.style.UserDefinedDialogStyle) { + + private lateinit var marker: MarkerLocalBean + + fun setMarker(marker: MarkerLocalBean) { + this.marker = marker + } + + private val binding: DialogMarkerDetailBinding by binding() + + private fun Dialog.initDialogLayoutParams() { + val window = this.window ?: return + window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + window.decorView.setBackgroundColor(Color.TRANSPARENT) + val params = window.attributes + params.width = ((context.getScreenWidth() * 0.8).toInt()) + params.height = ((context.getScreenHeight() * 0.7).toInt()) + window.attributes = params + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.initDialogLayoutParams() + setCanceledOnTouchOutside(true) + + binding.objectTypeView.text = LocaleConstant.POINT_TYPE_ARRAY[marker.objectType.toInt() - 1] + binding.pipelineTypeView.text = marker.pipelineType + binding.pipelineDiameterView.text = marker.pipelineDiameter + binding.pipelineMaterialView.text = marker.pipelineMaterial + binding.buryMethodView.text = marker.buryMethod + binding.buryDeepView.text = marker.buryDepth + binding.areaView.text = marker.area + binding.lineView.text = marker.line + binding.roadView.text = marker.road + binding.constructTimeView.text = marker.constructTime + binding.ownerView.text = marker.owner + binding.identifierIdView.text = marker.markerId + binding.identifierTypeView.text = marker.markerType + binding.identifierDeepView.text = marker.markerDepth + binding.personView.text = marker.installationDept + binding.installTimeView.text = marker.updateTime + binding.remarkView.text = marker.remark + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt index 169147b..b6b710b 100644 --- a/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt +++ b/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt @@ -223,18 +223,18 @@ //查库 val autoCompleteData = HashSet() CoroutineScope(Dispatchers.Main).launch { - val labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabelByCondition(conditionArray[position], null) + val makers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkerByCondition(conditionArray[position], null) } - for (labelBean in labelBeans) { + for (marker in makers) { when (position) { - 1 -> autoCompleteData.add(labelBean.markerNumber) - 2 -> autoCompleteData.add(labelBean.objectName) - 3 -> autoCompleteData.add(labelBean.area) - 4 -> autoCompleteData.add(labelBean.road) - 5 -> autoCompleteData.add(labelBean.inspectionUnit) - 6 -> autoCompleteData.add(labelBean.owner) - 8 -> autoCompleteData.add(labelBean.markerId) +// 1 -> autoCompleteData.add(marker.markerNumber) +// 2 -> autoCompleteData.add(marker.objectName) + 3 -> autoCompleteData.add(marker.area) + 4 -> autoCompleteData.add(marker.road) + 5 -> autoCompleteData.add(marker.installationDept) + 6 -> autoCompleteData.add(marker.owner) + 8 -> autoCompleteData.add(marker.markerId) } } diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt index 837ae86..2f1bb58 100644 --- a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt @@ -276,7 +276,7 @@ //先存本地 lifecycleScope.launch { withContext(Dispatchers.IO) { - DataBaseManager.get.insertSmallLabel(smallLabelData) +// DataBaseManager.get.insertSmallLabel(smallLabelData) } } @@ -339,7 +339,7 @@ gpioManager.setGpioLow("18") //查本地库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isEmpty()) { binding.objectAttrInclude.markerIdView.text = markerId } else { diff --git a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt index d3ffdd3..a5834bd 100644 --- a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt @@ -6,6 +6,7 @@ import android.app.Dialog import android.content.Context import android.content.DialogInterface +import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable @@ -19,16 +20,16 @@ import android.os.CountDownTimer import android.os.Handler import android.os.Message +import android.util.Log import android.view.KeyEvent import android.view.View -import android.view.animation.Animation -import android.view.animation.RotateAnimation import android.widget.AdapterView import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import com.amap.api.location.AMapLocation import com.amap.api.maps.AMap import com.amap.api.maps.AMapOptions +import com.amap.api.maps.AMapUtils import com.amap.api.maps.CameraUpdateFactory import com.amap.api.maps.CoordinateConverter import com.amap.api.maps.model.BitmapDescriptorFactory @@ -39,8 +40,9 @@ import com.casic.electric.detector.R import com.casic.electric.detector.adapter.EditableImageAdapter import com.casic.electric.detector.base.SerialPortActivity -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.TaskBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean import com.casic.electric.detector.callback.OnGetLocationListener import com.casic.electric.detector.callback.OnImageCompressListener import com.casic.electric.detector.cluster.ClusterItem @@ -49,9 +51,10 @@ import com.casic.electric.detector.databinding.ActivityMainBinding import com.casic.electric.detector.databinding.DialogInstallMarkerBinding import com.casic.electric.detector.databinding.DialogInstallSmallMarkerBinding -import com.casic.electric.detector.databinding.DialogSearchMarkerBinding +import com.casic.electric.detector.databinding.DialogSearchMarkerNewBinding import com.casic.electric.detector.extensions.appendExcelDownloadUrl import com.casic.electric.detector.extensions.compressImage +import com.casic.electric.detector.extensions.createTaskCode import com.casic.electric.detector.extensions.drawCircle import com.casic.electric.detector.extensions.getDefaultValue import com.casic.electric.detector.extensions.hexToString @@ -61,6 +64,7 @@ import com.casic.electric.detector.extensions.setDefaultValue import com.casic.electric.detector.extensions.show import com.casic.electric.detector.extensions.toHex +import com.casic.electric.detector.model.TaskDetailLocalModel import com.casic.electric.detector.model.TaskModel import com.casic.electric.detector.utils.DataBaseManager import com.casic.electric.detector.utils.ExcelHub @@ -70,9 +74,10 @@ import com.casic.electric.detector.utils.LocationHub import com.casic.electric.detector.utils.RouteOnMap import com.casic.electric.detector.vm.TaskViewModel +import com.casic.electric.detector.widgets.MarkerDetailDialog import com.casic.electric.detector.widgets.QueryMarkerDialog +import com.casic.electric.detector.widgets.RadarScanView import com.casic.electric.detector.widgets.SamplePopupWindow -import com.google.gson.Gson import com.luck.picture.lib.basic.PictureSelector import com.luck.picture.lib.config.SelectMimeType import com.luck.picture.lib.entity.LocalMedia @@ -81,8 +86,10 @@ import com.pengxh.kt.lite.extensions.binding import com.pengxh.kt.lite.extensions.convertColor import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.createLogFile import com.pengxh.kt.lite.extensions.dateToTimestamp import com.pengxh.kt.lite.extensions.dp2px +import com.pengxh.kt.lite.extensions.getSystemService import com.pengxh.kt.lite.extensions.initDialogLayoutParams import com.pengxh.kt.lite.extensions.isNetworkConnected import com.pengxh.kt.lite.extensions.navigatePageTo @@ -90,6 +97,7 @@ import com.pengxh.kt.lite.extensions.timestampToCompleteDate import com.pengxh.kt.lite.extensions.timestampToTime import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.extensions.writeToFile import com.pengxh.kt.lite.utils.FileDownloadManager import com.pengxh.kt.lite.utils.LoadState import com.pengxh.kt.lite.utils.LoadingDialogHub @@ -103,47 +111,50 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File +import java.math.RoundingMode import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer import java.util.TimerTask +import kotlin.math.atan2 @SuppressLint("all") class MainActivity : SerialPortActivity(), SensorEventListener, Handler.Callback { private val kTag = "MainActivity" - private val context = this@MainActivity + private val context = this private val samplePopupWindow by lazy { SamplePopupWindow(this) } - private val gson by lazy { Gson() } private val regionRadius by lazy { LocaleConstant.RADIUS_SIZE.dp2px(this) } private val backDrawables by lazy { HashMap() } private val installDialog by lazy { InstallMarkerDialog(this) } - private val searchDialog by lazy { SearchMarkerDialog(this) } + private val searchNewDialog by lazy { SearchMarkerNewDialog(this) } + private val detailDialog by lazy { MarkerDetailDialog(this) } + private val locationHub by lazy { LocationHub(this) } + private val decimalFormat by lazy { DecimalFormat("0.00") } private val sensorMessageCode = 2024022301 private val rotationMatrix = FloatArray(9)//旋转矩阵缓存 private val valueArray = FloatArray(3)//方位角数值 private var clickTime: Long = 0 - private var labelBeans = ArrayList() + private var markers = ArrayList() + private var smallMarkers = ArrayList() private var clusterOverlay: ClusterOverlay? = null - private var latitude: Double = 0.0 - private var longitude: Double = 0.0 private var isFreeTask = false + private var freeTaskTitle = "" private var ids = HashSet() private var signalTask: TimerTask? = null + private var energyTask: TimerTask? = null private var searchMarkerTimer: Timer? = null - private var taskId: String? = null + private var freeTaskId: String? = null private var gravity: FloatArray? = null private var geomagnetic: FloatArray? = null private lateinit var aMap: AMap - private lateinit var task: TaskBean private lateinit var sensorManager: SensorManager private lateinit var weakReferenceHandler: WeakReferenceHandler /***inner class 需要用到*****start*/ private val gpioManager by lazy { GpioManager() } - private val locationHub by lazy { LocationHub(this) } private val taskViewModel by lazy { ViewModelProvider(this)[TaskViewModel::class.java] } private val attr = AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ALARM) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build() @@ -168,6 +179,9 @@ slowSoundResourceId = soundPool.load(this, R.raw.ring4, 1) fastSoundResourceId = soundPool.load(this, R.raw.ring2, 1) + //保留小数2位 + decimalFormat.roundingMode = RoundingMode.HALF_UP + "登录成功".show(this) //地图初始化 @@ -177,12 +191,14 @@ samplePopupWindow.setPopupMenuItem(LocaleConstant.POPUP_TITLES) samplePopupWindow.setBackgroundDrawable(null) + sensorManager = getSystemService()!! + weakReferenceHandler = WeakReferenceHandler(this) + //task网络请求监听 taskViewModel.markerFileResult.observe(this) { if (it.success == "true") { //清空之前的数据 - DataBaseManager.get.clearLabels() - DataBaseManager.get.clearSmallLabels() + DataBaseManager.get.clearMarkers() /** * "data":"/xls/marker1.xls,/xls/smallMarker1.xls" * 有两份excel表格需要下载 @@ -200,10 +216,10 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { - labelBeans = ExcelHub.readLabel(file.absolutePath) + markers = ExcelHub.readLabel(file.absolutePath) withContext(Dispatchers.IO) { - labelBeans.forEach { label -> - DataBaseManager.get.insertLabel(label) + markers.forEach { marker -> + DataBaseManager.get.saveMarkerInLocale(marker) } } LoadingDialogHub.dismiss() @@ -227,12 +243,12 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { -// smallLabels = ExcelHub.readSmallLabel(file.absolutePath) -// withContext(Dispatchers.IO) { -// smallLabels.forEach { label -> -// DataBaseManager.get.insertSmallLabel(label) -// } -// } + smallMarkers = ExcelHub.readSmallLabel(file.absolutePath) + withContext(Dispatchers.IO) { + smallMarkers.forEach { marker -> + DataBaseManager.get.saveSmallMarkerInLocale(marker) + } + } } } @@ -250,18 +266,35 @@ taskViewModel.taskResult.observe(this) { if (it.success == "true") { //清空之前的数据 -// DataBaseManager.get.clearTasks() AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") .setMessage("您有${it.message.size}个新任务!").setPositiveButton("知道了") .setOnDialogButtonClickListener(object : AlertMessageDialog.OnDialogButtonClickListener { override fun onConfirmClick() { - saveTaskInformation(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { + freeTaskId = it + // 自由巡检保存在本地 + val bean = TaskLocalBean() + bean.id = freeTaskId.toString().toLong() + val currentTimeMillis = System.currentTimeMillis() + bean.taskCode = currentTimeMillis.createTaskCode() + bean.description = freeTaskTitle + val time = currentTimeMillis.timestampToCompleteDate() + bean.createTime = time + bean.status = "0" + val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + bean.createUserName = userName + bean.startTime = time + bean.endTime = "" + bean.isFreeTask = "1" + DataBaseManager.get.saveTaskInLocale(bean) + } + taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -290,10 +323,11 @@ }).build().show() } else { lifecycleScope.launch(Dispatchers.Main) { - val labels = withContext(Dispatchers.IO) { - DataBaseManager.get.queryLabelById("0") + val markers = withContext(Dispatchers.IO) { + DataBaseManager.get.queryMarkerByState("0") } - if (labels.isNotEmpty()) { + //如果有需要补全的标识器,Popup右侧会有小圆点提示 + if (markers.isNotEmpty()) { samplePopupWindow.setShowPosition(4) } val x = @@ -307,37 +341,42 @@ SamplePopupWindow.OnPopupWindowClickListener { override fun onPopupItemClicked(position: Int) { when (position) { - 0 -> updateLabels() + 0 -> updateMarkers() 1 -> downloadTask() 2 -> navigatePageTo() 3 -> uploadEvent() -// 4 -> uploadLabel() +// 4 -> completionMarker() } } }) //安装。上传,然后存入本地库 binding.installButton.setOnClickListener { - AlertControlDialog.Builder().setContext(context).setTitle("提示") - .setMessage("请选择安装对象").setPositiveButton("标识器") - .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - //标识器 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installMarkerDialog.show() - } + if (isFreeTask) { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("正在自由巡检任务中,请完成此次任务之后再使用此功能") + .setPositiveButton("好的").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { - override fun onCancelClick() { - //电子标签 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installSmallMarkerDialog.show() - } - }).build().show() + } + }).build().show() + } else { + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择安装对象").setPositiveButton("标识器") + .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + //标识器 +// installMarkerDialog.show() + } + + override fun onCancelClick() { + //电子标签 +// installSmallMarkerDialog.show() + } + }).build().show() + } } //查看 @@ -351,24 +390,24 @@ ) { //查询数据库 lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { + markers = withContext(Dispatchers.IO) { if (contentValue.size == 1) { - DataBaseManager.get.loadLabelByCondition( + DataBaseManager.get.loadMarkerByCondition( selectedCondition, contentValue[0] - ) as ArrayList + ) as ArrayList } else { DataBaseManager.get.loadLabelByDate( contentValue[0], contentValue[1] - ) as ArrayList + ) as ArrayList } } val latitudeList = ArrayList() val longitudeList = ArrayList() - labelBeans.forEach { - val latitude = it.latitude - val longitude = it.longitude + markers.forEach { + val latitude = markers.first().lat + val longitude = markers.first().lng if (latitude.isNotBlank() && longitude.isNotBlank()) { if (CoordinateConverter.isAMapDataAvailable( latitude.toDouble(), longitude.toDouble() @@ -400,52 +439,63 @@ //巡检 binding.inspectionButton.setOnClickListener { -// val task = DataBaseManager.get.queryDistinctTask() -// if (task.isNotEmpty()) { -// val arrayList = ArrayList() -// task.forEachIndexed { index, taskBean -> -// arrayList.add("任务${index + 1}:${taskBean.taskId},${taskBean.desc}") -// } -// -// BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) -// .setActionItemTitle(arrayList) -// .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { -// override fun onActionItemClick(position: Int) { -// val taskBean = task[position] -// SaveKeyValues.putValue(LocaleConstant.TASK_ID, taskBean.taskId) -// AlertControlDialog.Builder().setContext(context).setTitle("提示") -// .setMessage("请选择操作方式").setPositiveButton("执行工单") -// .setNegativeButton("提交工单") -// .setOnDialogButtonClickListener(object : -// AlertControlDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// detectRedrawGraphic(taskBean.taskId) -// -// val latLng = LatLng( -// taskBean.lat.toDouble(), taskBean.lng.toDouble() -// ) -// aMap.moveCamera( -// CameraUpdateFactory.newLatLngZoom(latLng, 16f) -// ) -// uploadTask(taskBean.taskId, "1") -// } -// -// override fun onCancelClick() { -// uploadTask(taskBean.taskId, "2") -// } -// }).build().show() -// } -// }).build().show() -// } else { -// AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") -// .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") -// .setPositiveButton("知道了").setOnDialogButtonClickListener(object : -// AlertMessageDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// startFreeTask() -// } -// }).build().show() -// } + val tasks = DataBaseManager.get.loadLocalTask() + if (tasks.isNotEmpty()) { + val arrayList = ArrayList() + tasks.forEachIndexed { index, task -> + arrayList.add("任务${index + 1}:${task.taskId},${task.description}") + } + + BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) + .setActionItemTitle(arrayList) + .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { + override fun onActionItemClick(position: Int) { + val task = tasks[position] + Log.d(kTag, task.toJson()) + SaveKeyValues.putValue(LocaleConstant.TASK_ID, task.taskId) + SaveKeyValues.putValue(LocaleConstant.TASK_CODE, task.taskCode) + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择操作方式").setPositiveButton("执行工单") + .setNegativeButton("提交工单") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + if (task.markerModels.isNotEmpty()) { + //移到Task下属第一个标识器位置 + val firstMarker = task.markerModels.first() + val latLng = LatLng(firstMarker.lat, firstMarker.lng) + aMap.moveCamera( + CameraUpdateFactory.newLatLngZoom(latLng, 16f) + ) + //执行工单 + uploadTask(task.taskId, task.taskCode, "1") + detectRedrawGraphic(task) + isExecuteTask = true + } else { + "此工单下无标识器,将执行自由巡检任务".show(context) + freeTaskId = task.taskId + openSerialPort() + } + } + + override fun onCancelClick() { + //提交工单 + uploadTask(task.taskId, task.taskCode, "2") + isExecuteTask = false + } + }).build().show() + } + }).build().show() + } else { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") + .setPositiveButton("知道了").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + startFreeTask() + } + }).build().show() + } } //探测 @@ -465,7 +515,7 @@ } }).build().show() } else { - searchDialog.show() + searchNewDialog.show() } } @@ -479,16 +529,21 @@ isFreeTask = false soundPool.autoPause() + //停止信号和ID搜索定时器 + signalTask?.cancel() + energyTask?.cancel() + searchMarkerTimer?.cancel() + //降低串口电位 gpioManager.setGpioLow("18") binding.stopFreeTaskButton.visibility = View.GONE - if (taskId.isNullOrBlank()) { + if (freeTaskId.isNullOrBlank()) { "任务ID异常,无法提交任务,请联系服务器管理员".show(context) return } - taskId?.apply { + freeTaskId?.apply { taskViewModel.uploadTaskMarker(context, this, ArrayList(ids)) } } @@ -497,42 +552,65 @@ } } + private fun uploadTask(taskId: String, taskCode: String, state: String) { + if (isNetworkConnected()) { + val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) + } else { + "网络连接已断开,请检查".show(this) + } + } + private fun startFreeTask() { AlertInputDialog.Builder().setContext(this).setTitle("新建自由巡检任务") .setHintMessage("请输入自由巡检任务简要描述").setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : AlertInputDialog.OnDialogButtonClickListener { override fun onConfirmClick(value: String) { + freeTaskTitle = value val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String taskViewModel.createFreeTask(context, userId, value) - //调高串口电位 - gpioManager.setGpioHigh("18") - - isFreeTask = true - //自由巡检 - signalTask = object : TimerTask() { - override fun run() { - out?.write('2'.code) - out?.flush() - } - } - searchMarkerTimer = Timer() - searchMarkerTimer?.apply { - schedule(signalTask, 0, 100) - } - - binding.stopFreeTaskButton.visibility = View.VISIBLE + openSerialPort() } override fun onCancelClick() {} }).build().show() } + private fun openSerialPort() { + //调高串口电位 + gpioManager.setGpioHigh("18") + + isFreeTask = true + //自由巡检 + signalTask = object : TimerTask() { + override fun run() { + out.write('2'.code) + out.flush() + } + } + + energyTask = object : TimerTask() { + override fun run() { + out.write('6'.code) + out.flush() + } + } + + searchMarkerTimer = Timer() + searchMarkerTimer?.apply { + schedule(signalTask, 0, 200) + schedule(energyTask, 0, 251) + } + + binding.stopFreeTaskButton.visibility = View.VISIBLE + } + override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) + if (searchNewDialog.isDetectMarker) { + searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() if (markerId.isNumber()) { @@ -540,26 +618,47 @@ } } else if (isFreeTask) { val markerId = hex.take(20).hexToString() + if (markerId.isNumber()) { //只响一次,因为探测频率高,所以依旧是连续的报警声 soundPool.play(soundResourceId, 1f, 1f, 0, 0, 1f) - "标识器${markerId}已探测".show(this) //添加地图Marker if (!ids.contains(markerId)) { //根据markerId查询标识器经纬度 - val labels = DataBaseManager.get.queryLabelById(markerId) - if (labels.isNotEmpty()) { - val bean = labels.first() + val markers = DataBaseManager.get.queryMarkerById(markerId) + if (markers.isNotEmpty()) { + val bean = markers.first() aMap.addMarker( MarkerOptions().position( - LatLng( - bean.latitude.toDouble(), bean.longitude.toDouble() - ) + LatLng(bean.lat.toDouble(), bean.lng.toDouble()) ).icon(BitmapDescriptorFactory.fromResource(R.mipmap.label_blue1)) ) } } ids.add(markerId) + + //显示标识器详细信息 + if (!detailDialog.isShowing) { + val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull() + if (markerBean == null) { + "无法查询到此ID【${markerId}】的信息".show(context) + } else { + detailDialog.setMarker(markerBean) + detailDialog.show() + } + } + } + + if (hex.startsWith("4E")) { + val energyResponse = hex.take(10).hexToString() + try { + val energy = energyResponse.substring(1).toInt() + if (energy <= 500 && detailDialog.isShowing) { + detailDialog.dismiss() + } + } catch (e: NumberFormatException) { + e.printStackTrace() + } } } } @@ -570,31 +669,21 @@ LoadState.Loading -> { if (installDialog.isInstallMarker) { LoadingDialogHub.show(this, "标识器安装中,请稍后...") - } else if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - "标识器${this.markerRealId}已探测!".show(context) -// DataBaseManager.get.updateTaskLabel(this) - } } else { LoadingDialogHub.show(this, "提交工单中,请稍后") } } - else -> { + LoadState.Success -> { if (installDialog.isInstallMarker) { -// installDialog.clearDefaultData() + installDialog.clearDefaultData() installDialog.dismiss() - "${installDialog.markerId}安装成功".show(context) + "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } } @@ -618,8 +707,6 @@ aMap.myLocationStyle = locationStyle//设置定位蓝点的Style aMap.isMyLocationEnabled = true//设置是否显示定位小蓝点 aMap.setOnMyLocationChangeListener { - longitude = it.longitude - latitude = it.latitude //经纬度逆编码 locationHub.antiCodingLocation(it) { address -> binding.currentLocationView.text = address @@ -631,19 +718,20 @@ aMap.setOnMapLongClickListener { lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } - //显示标签 - showLabelsOnMap() } //虽然不用显示附属标签,但是需要和标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } + + //显示标签 + showLabelsOnMap() } //自定义定位按钮 @@ -666,39 +754,28 @@ }) } - private fun saveTaskInformation(it: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String - if (it.message.size > 0) { - it.message.forEach { messageModel -> -// val count = DataBaseManager.get.countTaskById(messageModel.id.toString()) -// if (count == 0) { -// messageModel.taskDetailInfos.forEach { info -> -// DataBaseManager.get.insertTaskInformation( -// userName, -// messageModel.description, -// info.taskId.toString(), -// info.id.toString(), -// info.markerId.toString(), -// info.markerIdReal.toString(), -// info.longitude.toString(), -// info.latitude.toString(), -// messageModel.status -// ) -// } -// } + private fun saveUserTasks(task: TaskModel) { + task.message.forEach { model -> + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) + } } - "工单下载成功!".show(context) } + "工单下载成功!".show(this) } private fun showLabelsOnMap() { clusterOverlay?.onDestroy() val clusterItems = ArrayList() - labelBeans.forEach { - if (it.latitude.isNotEmpty() && it.longitude.isNotEmpty()) { - val latitude = it.latitude.toDouble() - val longitude = it.longitude.toDouble() + markers.forEach { + if (it.lat.isNotEmpty() && it.lng.isNotEmpty()) { + val latitude = it.lat.toDouble() + val longitude = it.lng.toDouble() val latLng = LatLng(latitude, longitude, false) val regionItem = RegionItem(latLng, it.id.toString()) @@ -717,7 +794,6 @@ ) backDrawables[0] = bitmapDrawable } - bitmapDrawable } if (clusterNum == 1) { var bitmapDrawable = backDrawables[1] @@ -780,8 +856,8 @@ override fun onActionItemClick(position: Int) { when (position) { 0 -> { - labelBeans.forEach { - if (it.markerId.toString() == item.tag) { + markers.forEach { + if (it.id.toString() == item.tag) { navigatePageTo(it.toJson()) } } @@ -789,11 +865,11 @@ 1 -> { val electricMarkers = ArrayList() -// smallLabels.forEach { -// if (it.markerId.toString() == item.tag) { -// electricMarkers.add(it.electricMarkerId) -// } -// } + smallMarkers.forEach { + if (it.id.toString() == item.tag) { + electricMarkers.add(it.electricMarkerId) + } + } if (electricMarkers.isEmpty()) { "此标识器没有绑定的电子标签".show(context) @@ -818,44 +894,32 @@ }.show() } - private fun detectRedrawGraphic(taskId: String) { -// val tasks = DataBaseManager.get.queryTaskById(taskId) -// if (tasks.isNotEmpty()) { -// tasks.forEach { -// val latLng = LatLng(it.lat.toDouble(), it.lng.toDouble()) -// val otMarkerOptions = MarkerOptions() -// otMarkerOptions.position(latLng) -// otMarkerOptions.visible(true) // 设置可见 -// if (it.state == "未开始") { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_red1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } else { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } -// aMap.addMarker(otMarkerOptions) -// } -// } + private fun detectRedrawGraphic(task: TaskDetailLocalModel) { + task.markerModels.forEach { + val latLng = LatLng(it.lat, it.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (it.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } + aMap.addMarker(otMarkerOptions) + } showLabelsOnMap() } - private fun uploadTask(taskId: String?, state: String) { - if (isNetworkConnected()) { - val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String - taskViewModel.uploadTask(userId, taskId, state) - } else { - "网络连接已断开,请检查".show(this) - } - } - //更新数据 - private fun updateLabels() { + private fun updateMarkers() { AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") .setNegativeButton("取消").setPositiveButton("确定") .setOnDialogButtonClickListener(object : @@ -941,7 +1005,7 @@ SensorManager.getOrientation(rotationMatrix, valueArray) val degree = ((360f + valueArray[0] * 180f / Math.PI) % 360).toInt() -// searchNewDialog.updateDegreeValue(degree) + searchNewDialog.updateDegreeValue(degree) } } return true @@ -953,8 +1017,8 @@ super.onResume() binding.mapView.onResume() lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } //显示标签 showLabelsOnMap() @@ -962,9 +1026,9 @@ //虽然不用显示附属标签,但是需要喝标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } //注册加速度传感器监听 @@ -990,8 +1054,6 @@ override fun onDestroy() { super.onDestroy() binding.mapView.onDestroy() - signalTask?.cancel() - searchMarkerTimer?.cancel() soundPool.release() locationHub.stopLocation() //降低串口电位 @@ -1006,6 +1068,7 @@ private val realPaths = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var countDownTimer: CountDownTimer + private lateinit var locationManager: LocationHub var isReadMarker = false var isInstallMarker = false @@ -1150,8 +1213,8 @@ soundPool.play(soundResourceId, 1f, 1f, 0, -1, 1f) - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() countDownTimer = object : CountDownTimer(5 * 1000, 1000) { override fun onTick(millisUntilFinished: Long) { @@ -1174,6 +1237,21 @@ } } + override fun show() { + super.show() + locationManager = LocationHub(context) + locationManager.getCurrentLocation(true, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + if (location != null) { + binding.markerAttrInclude.lngView.text = location.longitude.toString() + binding.markerAttrInclude.latView.text = location.latitude.toString() + } else { + "当前位置信号差,无法获取定位".show(context) + } + } + }) + } + fun bindingValue(markerId: String) { this.markerId = markerId LoadingDialogHub.dismiss() @@ -1193,6 +1271,7 @@ gpioManager.setGpioLow("18") soundPool.autoPause() isInstallMarker = false + locationManager.stopLocation() super.dismiss() } @@ -1515,6 +1594,21 @@ }) } + //清除默认数据 + fun clearDefaultData() { +// "markerObjectTypeView".setDefaultValue("") +// "pipelineDiameterView".setDefaultValue("") +// "buryDeepView".setDefaultValue("") +// "bottomPipeDiameterView".setDefaultValue("") +// "bottomPointDeepView".setDefaultValue("") +// "areaView".setDefaultValue("") +// "lineView".setDefaultValue("") +// "roadView".setDefaultValue("") +// "ownerView".setDefaultValue("") +// "identifierDeepView".setDefaultValue("") +// "personDeptView".setDefaultValue("") + } + //根据选择类型控制界面某些区域显隐 private fun setLayoutVisibility(vararg args: Int) { binding.objectAttrInclude.objectModeLayout.visibility = args[0] @@ -1566,21 +1660,23 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(context: Context) : Dialog(context) { + /**探测标识器新对话框******************************************************************************/ + inner class SearchMarkerNewDialog(context: Context) : Dialog(context) { - private val binding: DialogSearchMarkerBinding by binding() - private val decimal by lazy { DecimalFormat("0.0") } - private val degreeCache by lazy { HashMap() } - private var isPlaying = false + private val taskId by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String + } + private val taskCode by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_CODE, "") as String + } + private val binding: DialogSearchMarkerNewBinding by binding() private var markerId = "" private lateinit var searchMarkerTimer: Timer private lateinit var signalTask: TimerTask private lateinit var energyTask: TimerTask private lateinit var countDownTimer: CountDownTimer - + private lateinit var locationManager: LocationHub var isDetectMarker = false - var taskBean: TaskBean? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -1590,47 +1686,111 @@ energyTask.cancel() searchMarkerTimer.cancel() - out?.write('3'.code) -// val result = DataBaseManager.get.queryLabelById(markerId) -// if (result.isNotEmpty()) { -// val tag = when (result.first().identifierType) { -// "EM30" -> '7' -// "EM50" -> '8' -// "EM14" -> '9' -// else -> '1' -// } -// if (tag == '1') { -// "此标识器无法读取埋深!".show(context) -// } else { -// // 发送读取标识器埋设深度指令 -// LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") -// out.write(tag.code) -// out.flush() -// countDownTimer = object : CountDownTimer(15 * 1000, 1000) { -// override fun onTick(millisUntilFinished: Long) { -// -// } -// -// override fun onFinish() { -// LoadingDialogHub.dismiss() -// "探测此标识器深度超时,请重试".show(context) -// initTimer() -// } -// } -// countDownTimer.start() -// } -// } else { -// "标识器未安装,安装成功后才可读取埋深!".show(context) -// } + out.write('3'.code) + val result = DataBaseManager.get.queryMarkerById(markerId) + if (result.isNotEmpty()) { + val tag = when (result.first().markerType) { + "EM30" -> '7' + "EM50" -> '8' + "EM14" -> '9' + else -> '1' + } + if (tag == '1') { + "此标识器无法读取埋深!".show(context) + initTimer() + } else { + // 发送读取标识器埋设深度指令 + LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") + out.write(tag.code) + out.flush() + countDownTimer = object : CountDownTimer(15 * 1000, 1000) { + override fun onTick(millisUntilFinished: Long) { + + } + + override fun onFinish() { + LoadingDialogHub.dismiss() + "探测此标识器深度超时,请重试".show(context) + initTimer() + } + } + countDownTimer.start() + } + } else { + "标识器未安装,安装成功后才可读取埋深!".show(context) + initTimer() + } } binding.markerInfoButton.setOnClickListener { //查库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isNotEmpty()) { -// context.navigatePageTo(result.first().toJson()) + context.navigatePageTo(result.first().toJson()) } else { -// context.navigatePageTo(markerId) + context.navigatePageTo(markerId) + } + } + } + + override fun show() { + super.show() + locationManager = LocationHub(context) + //点位渲染,每次定位都计算当前位置与符合条件的点距离 + locationManager.getCurrentLocation(false, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + location?.apply { + renderDataPoint(this) + } + } + }) + } + + /** + * 计算并渲染数据点。点太多采用协程计算,不然会有点卡顿 + * @param location 定位点(天宝RTK获取) + * */ + private fun renderDataPoint(location: AMapLocation) { + val longitude = location.longitude + val latitude = location.latitude + lifecycleScope.launch(Dispatchers.IO) { + val dataPoints = ArrayList() + DataBaseManager.get.loadMarkers().forEach { + val distance = AMapUtils.calculateLineDistance( + LatLng(it.lat.toDouble(), it.lng.toDouble()), LatLng(latitude, longitude) + ) + val formatDistance = decimalFormat.format(distance).toFloat() + if (formatDistance <= LocaleConstant.MAX_DISTANCE) { + val angle = atan2( + (it.lat.toDouble() - latitude), (it.lng.toDouble() - longitude) + ) + Math.PI + val formatAngle = decimalFormat.format(angle).toDouble() + + "[$longitude, $latitude,$formatDistance, $formatAngle]".writeToFile( + createLogFile() + ) + dataPoints.add(RadarScanView.DataPoint(formatAngle, formatDistance)) + } + } + withContext(Dispatchers.Main) { + binding.radarScanView.renderPointData(dataPoints, + object : RadarScanView.OnGetNearestPointCallback { + override fun getNearestPoint(point: RadarScanView.DataPoint?) { + if (point == null) { + binding.distanceValueView.text = "大于5.5m" + binding.distancePgBar.progress = 100 + } else { + binding.distanceValueView.text = "${point.distance}m" + val progress = + if (point.distance > LocaleConstant.MAX_DISTANCE) { + 100 + } else { + (point.distance / LocaleConstant.MAX_DISTANCE) * 100 + } + binding.distancePgBar.progress = progress.toInt() + } + } + }) } } } @@ -1644,60 +1804,33 @@ isDetectMarker = true - //角度 - degreeCache["lastDegree"] = 0f + if (isExecuteTask) { + binding.taskStateView.visibility = View.GONE + binding.taskStateView.isSelected = false + } else { + binding.taskStateView.visibility = View.VISIBLE + binding.taskStateView.isSelected = true + } } fun bindingValue(hex: String) { if (hex.startsWith("4E")) { try { //4E转为String为N,代表能量值 - //用能量值转动表盘 val energyResponse = hex.take(10).hexToString() val energy = energyResponse.substring(1).toInt() if (energy >= 4000) { - isPlaying = if (!isPlaying) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(fastSoundResourceId) - false - } + soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) } else { - isPlaying = if (!isPlaying) { - soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(slowSoundResourceId) - false - } + soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) } - binding.resultTextView.text = "信号能量值:${energyResponse}" - - //转换为转动的角度 - val degree = (energy.toFloat() / (50 * 100)) * 180 - binding.energyValueView.text = decimal.format(degree) - - degreeCache["lastDegree"]?.apply { - val animation = RotateAnimation( - this, - degree, - Animation.RELATIVE_TO_SELF, - 0.5f, - Animation.RELATIVE_TO_SELF, - 0.5f - ) - animation.duration = 0 - animation.fillAfter = true - binding.needleView.startAnimation(animation) - } - - //保存旋转后的角度 - degreeCache["lastDegree"] = degree + //通过设置进度条表示能量值 + binding.energyPgBar.progress = energy + binding.energyValueView.text = "${energy}dB" if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" + binding.energyTipsView.text = "信号较弱,可能距离较远" binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) @@ -1712,11 +1845,11 @@ binding.searchResultView.setTextColor(Color.parseColor("#8D1717")) binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } else if (energy >= 4100) {//148° - binding.energyTipsView.text = "标识器信号极强,可能在正下方" + binding.energyTipsView.text = "信号极强,接近标识器正上方" binding.energyTipsView.setTextColor(Color.parseColor("#428d00")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" + binding.energyTipsView.text = "已靠近,请继续移动位置" binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } @@ -1757,31 +1890,37 @@ binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) //自动上传标识器 -// taskBean = DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") -// taskBean?.apply { -// /** -// * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 -// * */ -// taskViewModel.uploadMarker(taskCode) -// } + if (isExecuteTask) { + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) + } + } } } } + //更新罗盘角度 + fun updateDegreeValue(degree: Int) { + binding.radarScanView.setDegreeValue(degree) + } + private fun initTimer() { searchMarkerTimer = Timer() signalTask = object : TimerTask() { override fun run() { - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() } } energyTask = object : TimerTask() { override fun run() { - out?.write('6'.code) - out?.flush() + out.write('6'.code) + out.flush() } } @@ -1798,6 +1937,7 @@ gpioManager.setGpioLow("18") isDetectMarker = false soundPool.autoPause() + locationManager.stopLocation() super.dismiss() } } diff --git a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt index f092eb0..040eb10 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt @@ -5,7 +5,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.LabelBean +import com.casic.electric.detector.bean.MarkerLocalBean import com.casic.electric.detector.databinding.ActivityObjectDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.FileType @@ -23,7 +23,7 @@ private val kTag = "ObjectDetailActivity" private val context: Context = this@ObjectDetailActivity private val gson by lazy { Gson() } - private lateinit var labelBean: LabelBean + private lateinit var markerLocalBean: MarkerLocalBean override fun initOnCreate(savedInstanceState: Bundle?) { window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) @@ -36,37 +36,37 @@ val objectJson = intent.getStringExtra(Constant.INTENT_PARAM)!! try { - labelBean = gson.fromJson(objectJson, object : TypeToken() {}.type) + markerLocalBean = gson.fromJson(objectJson, object : TypeToken() {}.type) - binding.markerObjTypeView.text = labelBean.markerObjType - binding.markerNumberView.text = labelBean.markerNumber - binding.objectNameView.text = labelBean.objectName - binding.voltageLevelView.text = labelBean.voltageLevel - binding.transformerModelView.text = labelBean.transformerModel - binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial - binding.sizeView.text = labelBean.size - binding.bottomDepthView.text = labelBean.bottomDepth - binding.jointCountView.text = labelBean.jointCount - binding.casingMaterialView.text = labelBean.casingMaterial - binding.casingSpecView.text = labelBean.casingSpec - binding.constructTimeView.text = labelBean.constructTime - binding.inspectionUnitView.text = labelBean.inspectionUnit - binding.areaView.text = labelBean.area - binding.roadView.text = labelBean.road - binding.memo1View.text = labelBean.memo1 - binding.memo2View.text = labelBean.memo2 - binding.memo3View.text = labelBean.memo3 - binding.markerIdView.text = labelBean.markerId - binding.markerTypeView.text = labelBean.markerType - binding.ownerView.text = labelBean.owner - binding.markerDepthView.text = labelBean.markerDepth - binding.electricTagCountView.text = labelBean.electricTagCount - binding.installedTimeView.text = labelBean.installedTime - binding.longitudeView.text = labelBean.longitude - binding.latitudeView.text = labelBean.latitude - binding.markerMemo1View.text = labelBean.markerMemo1 - binding.markerMemo2View.text = labelBean.markerMemo2 - binding.markerMemo3View.text = labelBean.markerMemo3 +// binding.markerObjTypeView.text = labelBean.markerObjType +// binding.markerNumberView.text = labelBean.markerNumber +// binding.objectNameView.text = labelBean.objectName +// binding.voltageLevelView.text = labelBean.voltageLevel +// binding.transformerModelView.text = labelBean.transformerModel +// binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial +// binding.sizeView.text = labelBean.size +// binding.bottomDepthView.text = labelBean.bottomDepth +// binding.jointCountView.text = labelBean.jointCount +// binding.casingMaterialView.text = labelBean.casingMaterial +// binding.casingSpecView.text = labelBean.casingSpec +// binding.constructTimeView.text = labelBean.constructTime +// binding.inspectionUnitView.text = labelBean.inspectionUnit +// binding.areaView.text = labelBean.area +// binding.roadView.text = labelBean.road +// binding.memo1View.text = labelBean.memo1 +// binding.memo2View.text = labelBean.memo2 +// binding.memo3View.text = labelBean.memo3 +// binding.markerIdView.text = labelBean.markerId +// binding.markerTypeView.text = labelBean.markerType +// binding.ownerView.text = labelBean.owner +// binding.markerDepthView.text = labelBean.markerDepth +// binding.electricTagCountView.text = labelBean.electricTagCount +// binding.installedTimeView.text = labelBean.installedTime +// binding.longitudeView.text = labelBean.longitude +// binding.latitudeView.text = labelBean.latitude +// binding.markerMemo1View.text = labelBean.markerMemo1 +// binding.markerMemo2View.text = labelBean.markerMemo2 +// binding.markerMemo3View.text = labelBean.markerMemo3 } catch (e: NumberFormatException) { e.printStackTrace() } @@ -77,7 +77,7 @@ binding.showImageView.setOnClickListener { //查数据库 - if (labelBean.imagePath.isNullOrEmpty()) { + if (markerLocalBean.imagePath.isNullOrEmpty()) { "此标识器无图片".show(context) } else { val realPaths: ArrayList = ArrayList() //真实图片路径 @@ -85,7 +85,7 @@ /** * /images/markers/202307/0008818922_EVENT_20230704_160349_0_1.jpg,/images/markers/202307/0008818922_EVENT_20230704_160406_0_2.jpg * */ - val imagePath = labelBean.imagePath + val imagePath = markerLocalBean.imagePath if (imagePath.contains(",")) { val list = imagePath.split(",") list.forEach { path -> diff --git a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt index ea74e8a..57c93fe 100644 --- a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt +++ b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt @@ -1,8 +1,10 @@ package com.casic.electric.detector.vm import android.content.Context +import android.util.Log import androidx.lifecycle.MutableLiveData import com.casic.electric.detector.base.BaseApplication +import com.casic.electric.detector.bean.TaskMarkerLocalBean import com.casic.electric.detector.extensions.getResponseMessage import com.casic.electric.detector.extensions.getResponseState import com.casic.electric.detector.model.MarkerFileModel @@ -21,6 +23,8 @@ import com.pengxh.kt.lite.utils.SaveKeyValues class TaskViewModel : BaseViewModel() { + + private val kTag = "TaskViewModel" private val gson by lazy { Gson() } val markerFileResult = MutableLiveData() val taskResult = MutableLiveData() @@ -165,40 +169,25 @@ loadState.value = LoadState.Fail }) - fun uploadTask(userId: String, taskId: String?, state: String) = launch({ + fun uploadTask( + context: Context, userId: String, taskId: String, taskCode: String, state: String + ) = launch({ loadState.value = LoadState.Loading val response = RetrofitServiceManager.uploadTask(userId, taskId, state) if (response.getResponseState()) { loadState.value = LoadState.Success - if (state == "2") { - "工单${taskId}已提交!".show(BaseApplication.get()) - //删除本地数据库 -// DataBaseManager.get.deleteTaskById(taskId) - SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") - } - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(BaseApplication.get()) - } - }, { - it.printStackTrace() - loadState.value = LoadState.Fail - }) - - fun uploadTask(context: Context, userId: String, taskId: String?, state: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadTask(userId, taskId, state) - if (response.getResponseState()) { - loadState.value = LoadState.Success + //工单提交之后,并且状态是2,删除本地Task记录 if (state == "2") { "工单${taskId}已提交!".show(context) //删除本地数据库 - DataBaseManager.get.deleteTaskById(taskId) + DataBaseManager.get.deleteLocalTaskById(taskId, taskCode) SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") val element = JsonParser.parseString(response) val jsonObject = element.asJsonObject executeTaskResult.value = jsonObject.get("success").asString + } else { + Log.d(kTag, "uploadTask: 仅执行工单,不删除本地工单数据") } } else { loadState.value = LoadState.Fail @@ -225,17 +214,12 @@ loadState.value = LoadState.Fail }) - fun uploadMarker(context: Context, taskDetailId: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadMarker(taskDetailId) - if (response.getResponseState()) { - loadState.value = LoadState.Success - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(context) - } + fun uploadMarker(context: Context, marker: TaskMarkerLocalBean) = launch({ + //主键ID代替MarkerId + RetrofitServiceManager.uploadMarker(marker.id.toString()) + "标识器${marker.markerId}已探测!".show(context) + DataBaseManager.get.updateLocalTaskMarkerState(marker) }, { it.printStackTrace() - loadState.value = LoadState.Fail }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt new file mode 100644 index 0000000..e3831d6 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt @@ -0,0 +1,60 @@ +package com.casic.electric.detector.widgets + +import android.app.Dialog +import android.content.Context +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Bundle +import com.casic.electric.detector.R +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.databinding.DialogMarkerDetailBinding +import com.casic.electric.detector.utils.LocaleConstant +import com.pengxh.kt.lite.extensions.binding +import com.pengxh.kt.lite.extensions.getScreenHeight +import com.pengxh.kt.lite.extensions.getScreenWidth + +class MarkerDetailDialog constructor(context: Context) : + Dialog(context, R.style.UserDefinedDialogStyle) { + + private lateinit var marker: MarkerLocalBean + + fun setMarker(marker: MarkerLocalBean) { + this.marker = marker + } + + private val binding: DialogMarkerDetailBinding by binding() + + private fun Dialog.initDialogLayoutParams() { + val window = this.window ?: return + window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + window.decorView.setBackgroundColor(Color.TRANSPARENT) + val params = window.attributes + params.width = ((context.getScreenWidth() * 0.8).toInt()) + params.height = ((context.getScreenHeight() * 0.7).toInt()) + window.attributes = params + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.initDialogLayoutParams() + setCanceledOnTouchOutside(true) + + binding.objectTypeView.text = LocaleConstant.POINT_TYPE_ARRAY[marker.objectType.toInt() - 1] + binding.pipelineTypeView.text = marker.pipelineType + binding.pipelineDiameterView.text = marker.pipelineDiameter + binding.pipelineMaterialView.text = marker.pipelineMaterial + binding.buryMethodView.text = marker.buryMethod + binding.buryDeepView.text = marker.buryDepth + binding.areaView.text = marker.area + binding.lineView.text = marker.line + binding.roadView.text = marker.road + binding.constructTimeView.text = marker.constructTime + binding.ownerView.text = marker.owner + binding.identifierIdView.text = marker.markerId + binding.identifierTypeView.text = marker.markerType + binding.identifierDeepView.text = marker.markerDepth + binding.personView.text = marker.installationDept + binding.installTimeView.text = marker.updateTime + binding.remarkView.text = marker.remark + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt index 169147b..b6b710b 100644 --- a/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt +++ b/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt @@ -223,18 +223,18 @@ //查库 val autoCompleteData = HashSet() CoroutineScope(Dispatchers.Main).launch { - val labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabelByCondition(conditionArray[position], null) + val makers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkerByCondition(conditionArray[position], null) } - for (labelBean in labelBeans) { + for (marker in makers) { when (position) { - 1 -> autoCompleteData.add(labelBean.markerNumber) - 2 -> autoCompleteData.add(labelBean.objectName) - 3 -> autoCompleteData.add(labelBean.area) - 4 -> autoCompleteData.add(labelBean.road) - 5 -> autoCompleteData.add(labelBean.inspectionUnit) - 6 -> autoCompleteData.add(labelBean.owner) - 8 -> autoCompleteData.add(labelBean.markerId) +// 1 -> autoCompleteData.add(marker.markerNumber) +// 2 -> autoCompleteData.add(marker.objectName) + 3 -> autoCompleteData.add(marker.area) + 4 -> autoCompleteData.add(marker.road) + 5 -> autoCompleteData.add(marker.installationDept) + 6 -> autoCompleteData.add(marker.owner) + 8 -> autoCompleteData.add(marker.markerId) } } diff --git a/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt b/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt index 372d973..7c74215 100644 --- a/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt +++ b/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt @@ -70,6 +70,7 @@ private lateinit var borderPaint: Paint private lateinit var shaderPaint: Paint private lateinit var dataPaint: Paint + private lateinit var targetPaint: Paint private lateinit var outerPaint: TextPaint private lateinit var outerTextPath: Path @@ -172,6 +173,12 @@ dataPaint.isAntiAlias = true dataPaint.style = Paint.Style.FILL + //最近点画笔 + targetPaint = Paint() + targetPaint.color = Color.GREEN + targetPaint.isAntiAlias = true + targetPaint.style = Paint.Style.FILL + //矩阵 matrix = Matrix() } @@ -331,9 +338,9 @@ canvas.drawCircle(it.x, it.y, 10f, dataPaint) } - //画最近的点最外层圆环 + //画最近的点 targetPoint?.apply { - canvas.drawCircle(x, y, 12f, borderPaint) + canvas.drawCircle(x, y, 10f, targetPaint) } /** @@ -394,14 +401,12 @@ * dataPoint转为PointF * */ private fun DataPoint.convertPointF(): PointF { - val dataAngle = (this.angle * Math.PI / 180).toFloat() - /** * 距离最大5.5米,表盘四个环,一个环距离1.5米,半径124dp(248px) * */ val dataDistance = (this.distance / LocaleConstant.MAX_DISTANCE) * radius - val x = dataDistance * cos(dataAngle) - val y = dataDistance * sin(dataAngle) + val x = dataDistance * cos(this.angle).toFloat() + val y = dataDistance * sin(this.angle).toFloat() return PointF(x, y) } @@ -410,5 +415,5 @@ * @param angle 数据点和圆心的方位角 * @param distance 数据点和圆心的相对距离 * */ - data class DataPoint(var angle: Int, var distance: Float) + data class DataPoint(var angle: Double, var distance: Float) } \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt index 837ae86..2f1bb58 100644 --- a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt @@ -276,7 +276,7 @@ //先存本地 lifecycleScope.launch { withContext(Dispatchers.IO) { - DataBaseManager.get.insertSmallLabel(smallLabelData) +// DataBaseManager.get.insertSmallLabel(smallLabelData) } } @@ -339,7 +339,7 @@ gpioManager.setGpioLow("18") //查本地库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isEmpty()) { binding.objectAttrInclude.markerIdView.text = markerId } else { diff --git a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt index d3ffdd3..a5834bd 100644 --- a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt @@ -6,6 +6,7 @@ import android.app.Dialog import android.content.Context import android.content.DialogInterface +import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable @@ -19,16 +20,16 @@ import android.os.CountDownTimer import android.os.Handler import android.os.Message +import android.util.Log import android.view.KeyEvent import android.view.View -import android.view.animation.Animation -import android.view.animation.RotateAnimation import android.widget.AdapterView import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import com.amap.api.location.AMapLocation import com.amap.api.maps.AMap import com.amap.api.maps.AMapOptions +import com.amap.api.maps.AMapUtils import com.amap.api.maps.CameraUpdateFactory import com.amap.api.maps.CoordinateConverter import com.amap.api.maps.model.BitmapDescriptorFactory @@ -39,8 +40,9 @@ import com.casic.electric.detector.R import com.casic.electric.detector.adapter.EditableImageAdapter import com.casic.electric.detector.base.SerialPortActivity -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.TaskBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean import com.casic.electric.detector.callback.OnGetLocationListener import com.casic.electric.detector.callback.OnImageCompressListener import com.casic.electric.detector.cluster.ClusterItem @@ -49,9 +51,10 @@ import com.casic.electric.detector.databinding.ActivityMainBinding import com.casic.electric.detector.databinding.DialogInstallMarkerBinding import com.casic.electric.detector.databinding.DialogInstallSmallMarkerBinding -import com.casic.electric.detector.databinding.DialogSearchMarkerBinding +import com.casic.electric.detector.databinding.DialogSearchMarkerNewBinding import com.casic.electric.detector.extensions.appendExcelDownloadUrl import com.casic.electric.detector.extensions.compressImage +import com.casic.electric.detector.extensions.createTaskCode import com.casic.electric.detector.extensions.drawCircle import com.casic.electric.detector.extensions.getDefaultValue import com.casic.electric.detector.extensions.hexToString @@ -61,6 +64,7 @@ import com.casic.electric.detector.extensions.setDefaultValue import com.casic.electric.detector.extensions.show import com.casic.electric.detector.extensions.toHex +import com.casic.electric.detector.model.TaskDetailLocalModel import com.casic.electric.detector.model.TaskModel import com.casic.electric.detector.utils.DataBaseManager import com.casic.electric.detector.utils.ExcelHub @@ -70,9 +74,10 @@ import com.casic.electric.detector.utils.LocationHub import com.casic.electric.detector.utils.RouteOnMap import com.casic.electric.detector.vm.TaskViewModel +import com.casic.electric.detector.widgets.MarkerDetailDialog import com.casic.electric.detector.widgets.QueryMarkerDialog +import com.casic.electric.detector.widgets.RadarScanView import com.casic.electric.detector.widgets.SamplePopupWindow -import com.google.gson.Gson import com.luck.picture.lib.basic.PictureSelector import com.luck.picture.lib.config.SelectMimeType import com.luck.picture.lib.entity.LocalMedia @@ -81,8 +86,10 @@ import com.pengxh.kt.lite.extensions.binding import com.pengxh.kt.lite.extensions.convertColor import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.createLogFile import com.pengxh.kt.lite.extensions.dateToTimestamp import com.pengxh.kt.lite.extensions.dp2px +import com.pengxh.kt.lite.extensions.getSystemService import com.pengxh.kt.lite.extensions.initDialogLayoutParams import com.pengxh.kt.lite.extensions.isNetworkConnected import com.pengxh.kt.lite.extensions.navigatePageTo @@ -90,6 +97,7 @@ import com.pengxh.kt.lite.extensions.timestampToCompleteDate import com.pengxh.kt.lite.extensions.timestampToTime import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.extensions.writeToFile import com.pengxh.kt.lite.utils.FileDownloadManager import com.pengxh.kt.lite.utils.LoadState import com.pengxh.kt.lite.utils.LoadingDialogHub @@ -103,47 +111,50 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File +import java.math.RoundingMode import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer import java.util.TimerTask +import kotlin.math.atan2 @SuppressLint("all") class MainActivity : SerialPortActivity(), SensorEventListener, Handler.Callback { private val kTag = "MainActivity" - private val context = this@MainActivity + private val context = this private val samplePopupWindow by lazy { SamplePopupWindow(this) } - private val gson by lazy { Gson() } private val regionRadius by lazy { LocaleConstant.RADIUS_SIZE.dp2px(this) } private val backDrawables by lazy { HashMap() } private val installDialog by lazy { InstallMarkerDialog(this) } - private val searchDialog by lazy { SearchMarkerDialog(this) } + private val searchNewDialog by lazy { SearchMarkerNewDialog(this) } + private val detailDialog by lazy { MarkerDetailDialog(this) } + private val locationHub by lazy { LocationHub(this) } + private val decimalFormat by lazy { DecimalFormat("0.00") } private val sensorMessageCode = 2024022301 private val rotationMatrix = FloatArray(9)//旋转矩阵缓存 private val valueArray = FloatArray(3)//方位角数值 private var clickTime: Long = 0 - private var labelBeans = ArrayList() + private var markers = ArrayList() + private var smallMarkers = ArrayList() private var clusterOverlay: ClusterOverlay? = null - private var latitude: Double = 0.0 - private var longitude: Double = 0.0 private var isFreeTask = false + private var freeTaskTitle = "" private var ids = HashSet() private var signalTask: TimerTask? = null + private var energyTask: TimerTask? = null private var searchMarkerTimer: Timer? = null - private var taskId: String? = null + private var freeTaskId: String? = null private var gravity: FloatArray? = null private var geomagnetic: FloatArray? = null private lateinit var aMap: AMap - private lateinit var task: TaskBean private lateinit var sensorManager: SensorManager private lateinit var weakReferenceHandler: WeakReferenceHandler /***inner class 需要用到*****start*/ private val gpioManager by lazy { GpioManager() } - private val locationHub by lazy { LocationHub(this) } private val taskViewModel by lazy { ViewModelProvider(this)[TaskViewModel::class.java] } private val attr = AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ALARM) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build() @@ -168,6 +179,9 @@ slowSoundResourceId = soundPool.load(this, R.raw.ring4, 1) fastSoundResourceId = soundPool.load(this, R.raw.ring2, 1) + //保留小数2位 + decimalFormat.roundingMode = RoundingMode.HALF_UP + "登录成功".show(this) //地图初始化 @@ -177,12 +191,14 @@ samplePopupWindow.setPopupMenuItem(LocaleConstant.POPUP_TITLES) samplePopupWindow.setBackgroundDrawable(null) + sensorManager = getSystemService()!! + weakReferenceHandler = WeakReferenceHandler(this) + //task网络请求监听 taskViewModel.markerFileResult.observe(this) { if (it.success == "true") { //清空之前的数据 - DataBaseManager.get.clearLabels() - DataBaseManager.get.clearSmallLabels() + DataBaseManager.get.clearMarkers() /** * "data":"/xls/marker1.xls,/xls/smallMarker1.xls" * 有两份excel表格需要下载 @@ -200,10 +216,10 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { - labelBeans = ExcelHub.readLabel(file.absolutePath) + markers = ExcelHub.readLabel(file.absolutePath) withContext(Dispatchers.IO) { - labelBeans.forEach { label -> - DataBaseManager.get.insertLabel(label) + markers.forEach { marker -> + DataBaseManager.get.saveMarkerInLocale(marker) } } LoadingDialogHub.dismiss() @@ -227,12 +243,12 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { -// smallLabels = ExcelHub.readSmallLabel(file.absolutePath) -// withContext(Dispatchers.IO) { -// smallLabels.forEach { label -> -// DataBaseManager.get.insertSmallLabel(label) -// } -// } + smallMarkers = ExcelHub.readSmallLabel(file.absolutePath) + withContext(Dispatchers.IO) { + smallMarkers.forEach { marker -> + DataBaseManager.get.saveSmallMarkerInLocale(marker) + } + } } } @@ -250,18 +266,35 @@ taskViewModel.taskResult.observe(this) { if (it.success == "true") { //清空之前的数据 -// DataBaseManager.get.clearTasks() AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") .setMessage("您有${it.message.size}个新任务!").setPositiveButton("知道了") .setOnDialogButtonClickListener(object : AlertMessageDialog.OnDialogButtonClickListener { override fun onConfirmClick() { - saveTaskInformation(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { + freeTaskId = it + // 自由巡检保存在本地 + val bean = TaskLocalBean() + bean.id = freeTaskId.toString().toLong() + val currentTimeMillis = System.currentTimeMillis() + bean.taskCode = currentTimeMillis.createTaskCode() + bean.description = freeTaskTitle + val time = currentTimeMillis.timestampToCompleteDate() + bean.createTime = time + bean.status = "0" + val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + bean.createUserName = userName + bean.startTime = time + bean.endTime = "" + bean.isFreeTask = "1" + DataBaseManager.get.saveTaskInLocale(bean) + } + taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -290,10 +323,11 @@ }).build().show() } else { lifecycleScope.launch(Dispatchers.Main) { - val labels = withContext(Dispatchers.IO) { - DataBaseManager.get.queryLabelById("0") + val markers = withContext(Dispatchers.IO) { + DataBaseManager.get.queryMarkerByState("0") } - if (labels.isNotEmpty()) { + //如果有需要补全的标识器,Popup右侧会有小圆点提示 + if (markers.isNotEmpty()) { samplePopupWindow.setShowPosition(4) } val x = @@ -307,37 +341,42 @@ SamplePopupWindow.OnPopupWindowClickListener { override fun onPopupItemClicked(position: Int) { when (position) { - 0 -> updateLabels() + 0 -> updateMarkers() 1 -> downloadTask() 2 -> navigatePageTo() 3 -> uploadEvent() -// 4 -> uploadLabel() +// 4 -> completionMarker() } } }) //安装。上传,然后存入本地库 binding.installButton.setOnClickListener { - AlertControlDialog.Builder().setContext(context).setTitle("提示") - .setMessage("请选择安装对象").setPositiveButton("标识器") - .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - //标识器 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installMarkerDialog.show() - } + if (isFreeTask) { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("正在自由巡检任务中,请完成此次任务之后再使用此功能") + .setPositiveButton("好的").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { - override fun onCancelClick() { - //电子标签 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installSmallMarkerDialog.show() - } - }).build().show() + } + }).build().show() + } else { + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择安装对象").setPositiveButton("标识器") + .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + //标识器 +// installMarkerDialog.show() + } + + override fun onCancelClick() { + //电子标签 +// installSmallMarkerDialog.show() + } + }).build().show() + } } //查看 @@ -351,24 +390,24 @@ ) { //查询数据库 lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { + markers = withContext(Dispatchers.IO) { if (contentValue.size == 1) { - DataBaseManager.get.loadLabelByCondition( + DataBaseManager.get.loadMarkerByCondition( selectedCondition, contentValue[0] - ) as ArrayList + ) as ArrayList } else { DataBaseManager.get.loadLabelByDate( contentValue[0], contentValue[1] - ) as ArrayList + ) as ArrayList } } val latitudeList = ArrayList() val longitudeList = ArrayList() - labelBeans.forEach { - val latitude = it.latitude - val longitude = it.longitude + markers.forEach { + val latitude = markers.first().lat + val longitude = markers.first().lng if (latitude.isNotBlank() && longitude.isNotBlank()) { if (CoordinateConverter.isAMapDataAvailable( latitude.toDouble(), longitude.toDouble() @@ -400,52 +439,63 @@ //巡检 binding.inspectionButton.setOnClickListener { -// val task = DataBaseManager.get.queryDistinctTask() -// if (task.isNotEmpty()) { -// val arrayList = ArrayList() -// task.forEachIndexed { index, taskBean -> -// arrayList.add("任务${index + 1}:${taskBean.taskId},${taskBean.desc}") -// } -// -// BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) -// .setActionItemTitle(arrayList) -// .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { -// override fun onActionItemClick(position: Int) { -// val taskBean = task[position] -// SaveKeyValues.putValue(LocaleConstant.TASK_ID, taskBean.taskId) -// AlertControlDialog.Builder().setContext(context).setTitle("提示") -// .setMessage("请选择操作方式").setPositiveButton("执行工单") -// .setNegativeButton("提交工单") -// .setOnDialogButtonClickListener(object : -// AlertControlDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// detectRedrawGraphic(taskBean.taskId) -// -// val latLng = LatLng( -// taskBean.lat.toDouble(), taskBean.lng.toDouble() -// ) -// aMap.moveCamera( -// CameraUpdateFactory.newLatLngZoom(latLng, 16f) -// ) -// uploadTask(taskBean.taskId, "1") -// } -// -// override fun onCancelClick() { -// uploadTask(taskBean.taskId, "2") -// } -// }).build().show() -// } -// }).build().show() -// } else { -// AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") -// .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") -// .setPositiveButton("知道了").setOnDialogButtonClickListener(object : -// AlertMessageDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// startFreeTask() -// } -// }).build().show() -// } + val tasks = DataBaseManager.get.loadLocalTask() + if (tasks.isNotEmpty()) { + val arrayList = ArrayList() + tasks.forEachIndexed { index, task -> + arrayList.add("任务${index + 1}:${task.taskId},${task.description}") + } + + BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) + .setActionItemTitle(arrayList) + .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { + override fun onActionItemClick(position: Int) { + val task = tasks[position] + Log.d(kTag, task.toJson()) + SaveKeyValues.putValue(LocaleConstant.TASK_ID, task.taskId) + SaveKeyValues.putValue(LocaleConstant.TASK_CODE, task.taskCode) + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择操作方式").setPositiveButton("执行工单") + .setNegativeButton("提交工单") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + if (task.markerModels.isNotEmpty()) { + //移到Task下属第一个标识器位置 + val firstMarker = task.markerModels.first() + val latLng = LatLng(firstMarker.lat, firstMarker.lng) + aMap.moveCamera( + CameraUpdateFactory.newLatLngZoom(latLng, 16f) + ) + //执行工单 + uploadTask(task.taskId, task.taskCode, "1") + detectRedrawGraphic(task) + isExecuteTask = true + } else { + "此工单下无标识器,将执行自由巡检任务".show(context) + freeTaskId = task.taskId + openSerialPort() + } + } + + override fun onCancelClick() { + //提交工单 + uploadTask(task.taskId, task.taskCode, "2") + isExecuteTask = false + } + }).build().show() + } + }).build().show() + } else { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") + .setPositiveButton("知道了").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + startFreeTask() + } + }).build().show() + } } //探测 @@ -465,7 +515,7 @@ } }).build().show() } else { - searchDialog.show() + searchNewDialog.show() } } @@ -479,16 +529,21 @@ isFreeTask = false soundPool.autoPause() + //停止信号和ID搜索定时器 + signalTask?.cancel() + energyTask?.cancel() + searchMarkerTimer?.cancel() + //降低串口电位 gpioManager.setGpioLow("18") binding.stopFreeTaskButton.visibility = View.GONE - if (taskId.isNullOrBlank()) { + if (freeTaskId.isNullOrBlank()) { "任务ID异常,无法提交任务,请联系服务器管理员".show(context) return } - taskId?.apply { + freeTaskId?.apply { taskViewModel.uploadTaskMarker(context, this, ArrayList(ids)) } } @@ -497,42 +552,65 @@ } } + private fun uploadTask(taskId: String, taskCode: String, state: String) { + if (isNetworkConnected()) { + val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) + } else { + "网络连接已断开,请检查".show(this) + } + } + private fun startFreeTask() { AlertInputDialog.Builder().setContext(this).setTitle("新建自由巡检任务") .setHintMessage("请输入自由巡检任务简要描述").setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : AlertInputDialog.OnDialogButtonClickListener { override fun onConfirmClick(value: String) { + freeTaskTitle = value val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String taskViewModel.createFreeTask(context, userId, value) - //调高串口电位 - gpioManager.setGpioHigh("18") - - isFreeTask = true - //自由巡检 - signalTask = object : TimerTask() { - override fun run() { - out?.write('2'.code) - out?.flush() - } - } - searchMarkerTimer = Timer() - searchMarkerTimer?.apply { - schedule(signalTask, 0, 100) - } - - binding.stopFreeTaskButton.visibility = View.VISIBLE + openSerialPort() } override fun onCancelClick() {} }).build().show() } + private fun openSerialPort() { + //调高串口电位 + gpioManager.setGpioHigh("18") + + isFreeTask = true + //自由巡检 + signalTask = object : TimerTask() { + override fun run() { + out.write('2'.code) + out.flush() + } + } + + energyTask = object : TimerTask() { + override fun run() { + out.write('6'.code) + out.flush() + } + } + + searchMarkerTimer = Timer() + searchMarkerTimer?.apply { + schedule(signalTask, 0, 200) + schedule(energyTask, 0, 251) + } + + binding.stopFreeTaskButton.visibility = View.VISIBLE + } + override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) + if (searchNewDialog.isDetectMarker) { + searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() if (markerId.isNumber()) { @@ -540,26 +618,47 @@ } } else if (isFreeTask) { val markerId = hex.take(20).hexToString() + if (markerId.isNumber()) { //只响一次,因为探测频率高,所以依旧是连续的报警声 soundPool.play(soundResourceId, 1f, 1f, 0, 0, 1f) - "标识器${markerId}已探测".show(this) //添加地图Marker if (!ids.contains(markerId)) { //根据markerId查询标识器经纬度 - val labels = DataBaseManager.get.queryLabelById(markerId) - if (labels.isNotEmpty()) { - val bean = labels.first() + val markers = DataBaseManager.get.queryMarkerById(markerId) + if (markers.isNotEmpty()) { + val bean = markers.first() aMap.addMarker( MarkerOptions().position( - LatLng( - bean.latitude.toDouble(), bean.longitude.toDouble() - ) + LatLng(bean.lat.toDouble(), bean.lng.toDouble()) ).icon(BitmapDescriptorFactory.fromResource(R.mipmap.label_blue1)) ) } } ids.add(markerId) + + //显示标识器详细信息 + if (!detailDialog.isShowing) { + val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull() + if (markerBean == null) { + "无法查询到此ID【${markerId}】的信息".show(context) + } else { + detailDialog.setMarker(markerBean) + detailDialog.show() + } + } + } + + if (hex.startsWith("4E")) { + val energyResponse = hex.take(10).hexToString() + try { + val energy = energyResponse.substring(1).toInt() + if (energy <= 500 && detailDialog.isShowing) { + detailDialog.dismiss() + } + } catch (e: NumberFormatException) { + e.printStackTrace() + } } } } @@ -570,31 +669,21 @@ LoadState.Loading -> { if (installDialog.isInstallMarker) { LoadingDialogHub.show(this, "标识器安装中,请稍后...") - } else if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - "标识器${this.markerRealId}已探测!".show(context) -// DataBaseManager.get.updateTaskLabel(this) - } } else { LoadingDialogHub.show(this, "提交工单中,请稍后") } } - else -> { + LoadState.Success -> { if (installDialog.isInstallMarker) { -// installDialog.clearDefaultData() + installDialog.clearDefaultData() installDialog.dismiss() - "${installDialog.markerId}安装成功".show(context) + "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } } @@ -618,8 +707,6 @@ aMap.myLocationStyle = locationStyle//设置定位蓝点的Style aMap.isMyLocationEnabled = true//设置是否显示定位小蓝点 aMap.setOnMyLocationChangeListener { - longitude = it.longitude - latitude = it.latitude //经纬度逆编码 locationHub.antiCodingLocation(it) { address -> binding.currentLocationView.text = address @@ -631,19 +718,20 @@ aMap.setOnMapLongClickListener { lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } - //显示标签 - showLabelsOnMap() } //虽然不用显示附属标签,但是需要和标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } + + //显示标签 + showLabelsOnMap() } //自定义定位按钮 @@ -666,39 +754,28 @@ }) } - private fun saveTaskInformation(it: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String - if (it.message.size > 0) { - it.message.forEach { messageModel -> -// val count = DataBaseManager.get.countTaskById(messageModel.id.toString()) -// if (count == 0) { -// messageModel.taskDetailInfos.forEach { info -> -// DataBaseManager.get.insertTaskInformation( -// userName, -// messageModel.description, -// info.taskId.toString(), -// info.id.toString(), -// info.markerId.toString(), -// info.markerIdReal.toString(), -// info.longitude.toString(), -// info.latitude.toString(), -// messageModel.status -// ) -// } -// } + private fun saveUserTasks(task: TaskModel) { + task.message.forEach { model -> + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) + } } - "工单下载成功!".show(context) } + "工单下载成功!".show(this) } private fun showLabelsOnMap() { clusterOverlay?.onDestroy() val clusterItems = ArrayList() - labelBeans.forEach { - if (it.latitude.isNotEmpty() && it.longitude.isNotEmpty()) { - val latitude = it.latitude.toDouble() - val longitude = it.longitude.toDouble() + markers.forEach { + if (it.lat.isNotEmpty() && it.lng.isNotEmpty()) { + val latitude = it.lat.toDouble() + val longitude = it.lng.toDouble() val latLng = LatLng(latitude, longitude, false) val regionItem = RegionItem(latLng, it.id.toString()) @@ -717,7 +794,6 @@ ) backDrawables[0] = bitmapDrawable } - bitmapDrawable } if (clusterNum == 1) { var bitmapDrawable = backDrawables[1] @@ -780,8 +856,8 @@ override fun onActionItemClick(position: Int) { when (position) { 0 -> { - labelBeans.forEach { - if (it.markerId.toString() == item.tag) { + markers.forEach { + if (it.id.toString() == item.tag) { navigatePageTo(it.toJson()) } } @@ -789,11 +865,11 @@ 1 -> { val electricMarkers = ArrayList() -// smallLabels.forEach { -// if (it.markerId.toString() == item.tag) { -// electricMarkers.add(it.electricMarkerId) -// } -// } + smallMarkers.forEach { + if (it.id.toString() == item.tag) { + electricMarkers.add(it.electricMarkerId) + } + } if (electricMarkers.isEmpty()) { "此标识器没有绑定的电子标签".show(context) @@ -818,44 +894,32 @@ }.show() } - private fun detectRedrawGraphic(taskId: String) { -// val tasks = DataBaseManager.get.queryTaskById(taskId) -// if (tasks.isNotEmpty()) { -// tasks.forEach { -// val latLng = LatLng(it.lat.toDouble(), it.lng.toDouble()) -// val otMarkerOptions = MarkerOptions() -// otMarkerOptions.position(latLng) -// otMarkerOptions.visible(true) // 设置可见 -// if (it.state == "未开始") { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_red1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } else { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } -// aMap.addMarker(otMarkerOptions) -// } -// } + private fun detectRedrawGraphic(task: TaskDetailLocalModel) { + task.markerModels.forEach { + val latLng = LatLng(it.lat, it.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (it.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } + aMap.addMarker(otMarkerOptions) + } showLabelsOnMap() } - private fun uploadTask(taskId: String?, state: String) { - if (isNetworkConnected()) { - val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String - taskViewModel.uploadTask(userId, taskId, state) - } else { - "网络连接已断开,请检查".show(this) - } - } - //更新数据 - private fun updateLabels() { + private fun updateMarkers() { AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") .setNegativeButton("取消").setPositiveButton("确定") .setOnDialogButtonClickListener(object : @@ -941,7 +1005,7 @@ SensorManager.getOrientation(rotationMatrix, valueArray) val degree = ((360f + valueArray[0] * 180f / Math.PI) % 360).toInt() -// searchNewDialog.updateDegreeValue(degree) + searchNewDialog.updateDegreeValue(degree) } } return true @@ -953,8 +1017,8 @@ super.onResume() binding.mapView.onResume() lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } //显示标签 showLabelsOnMap() @@ -962,9 +1026,9 @@ //虽然不用显示附属标签,但是需要喝标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } //注册加速度传感器监听 @@ -990,8 +1054,6 @@ override fun onDestroy() { super.onDestroy() binding.mapView.onDestroy() - signalTask?.cancel() - searchMarkerTimer?.cancel() soundPool.release() locationHub.stopLocation() //降低串口电位 @@ -1006,6 +1068,7 @@ private val realPaths = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var countDownTimer: CountDownTimer + private lateinit var locationManager: LocationHub var isReadMarker = false var isInstallMarker = false @@ -1150,8 +1213,8 @@ soundPool.play(soundResourceId, 1f, 1f, 0, -1, 1f) - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() countDownTimer = object : CountDownTimer(5 * 1000, 1000) { override fun onTick(millisUntilFinished: Long) { @@ -1174,6 +1237,21 @@ } } + override fun show() { + super.show() + locationManager = LocationHub(context) + locationManager.getCurrentLocation(true, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + if (location != null) { + binding.markerAttrInclude.lngView.text = location.longitude.toString() + binding.markerAttrInclude.latView.text = location.latitude.toString() + } else { + "当前位置信号差,无法获取定位".show(context) + } + } + }) + } + fun bindingValue(markerId: String) { this.markerId = markerId LoadingDialogHub.dismiss() @@ -1193,6 +1271,7 @@ gpioManager.setGpioLow("18") soundPool.autoPause() isInstallMarker = false + locationManager.stopLocation() super.dismiss() } @@ -1515,6 +1594,21 @@ }) } + //清除默认数据 + fun clearDefaultData() { +// "markerObjectTypeView".setDefaultValue("") +// "pipelineDiameterView".setDefaultValue("") +// "buryDeepView".setDefaultValue("") +// "bottomPipeDiameterView".setDefaultValue("") +// "bottomPointDeepView".setDefaultValue("") +// "areaView".setDefaultValue("") +// "lineView".setDefaultValue("") +// "roadView".setDefaultValue("") +// "ownerView".setDefaultValue("") +// "identifierDeepView".setDefaultValue("") +// "personDeptView".setDefaultValue("") + } + //根据选择类型控制界面某些区域显隐 private fun setLayoutVisibility(vararg args: Int) { binding.objectAttrInclude.objectModeLayout.visibility = args[0] @@ -1566,21 +1660,23 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(context: Context) : Dialog(context) { + /**探测标识器新对话框******************************************************************************/ + inner class SearchMarkerNewDialog(context: Context) : Dialog(context) { - private val binding: DialogSearchMarkerBinding by binding() - private val decimal by lazy { DecimalFormat("0.0") } - private val degreeCache by lazy { HashMap() } - private var isPlaying = false + private val taskId by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String + } + private val taskCode by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_CODE, "") as String + } + private val binding: DialogSearchMarkerNewBinding by binding() private var markerId = "" private lateinit var searchMarkerTimer: Timer private lateinit var signalTask: TimerTask private lateinit var energyTask: TimerTask private lateinit var countDownTimer: CountDownTimer - + private lateinit var locationManager: LocationHub var isDetectMarker = false - var taskBean: TaskBean? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -1590,47 +1686,111 @@ energyTask.cancel() searchMarkerTimer.cancel() - out?.write('3'.code) -// val result = DataBaseManager.get.queryLabelById(markerId) -// if (result.isNotEmpty()) { -// val tag = when (result.first().identifierType) { -// "EM30" -> '7' -// "EM50" -> '8' -// "EM14" -> '9' -// else -> '1' -// } -// if (tag == '1') { -// "此标识器无法读取埋深!".show(context) -// } else { -// // 发送读取标识器埋设深度指令 -// LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") -// out.write(tag.code) -// out.flush() -// countDownTimer = object : CountDownTimer(15 * 1000, 1000) { -// override fun onTick(millisUntilFinished: Long) { -// -// } -// -// override fun onFinish() { -// LoadingDialogHub.dismiss() -// "探测此标识器深度超时,请重试".show(context) -// initTimer() -// } -// } -// countDownTimer.start() -// } -// } else { -// "标识器未安装,安装成功后才可读取埋深!".show(context) -// } + out.write('3'.code) + val result = DataBaseManager.get.queryMarkerById(markerId) + if (result.isNotEmpty()) { + val tag = when (result.first().markerType) { + "EM30" -> '7' + "EM50" -> '8' + "EM14" -> '9' + else -> '1' + } + if (tag == '1') { + "此标识器无法读取埋深!".show(context) + initTimer() + } else { + // 发送读取标识器埋设深度指令 + LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") + out.write(tag.code) + out.flush() + countDownTimer = object : CountDownTimer(15 * 1000, 1000) { + override fun onTick(millisUntilFinished: Long) { + + } + + override fun onFinish() { + LoadingDialogHub.dismiss() + "探测此标识器深度超时,请重试".show(context) + initTimer() + } + } + countDownTimer.start() + } + } else { + "标识器未安装,安装成功后才可读取埋深!".show(context) + initTimer() + } } binding.markerInfoButton.setOnClickListener { //查库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isNotEmpty()) { -// context.navigatePageTo(result.first().toJson()) + context.navigatePageTo(result.first().toJson()) } else { -// context.navigatePageTo(markerId) + context.navigatePageTo(markerId) + } + } + } + + override fun show() { + super.show() + locationManager = LocationHub(context) + //点位渲染,每次定位都计算当前位置与符合条件的点距离 + locationManager.getCurrentLocation(false, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + location?.apply { + renderDataPoint(this) + } + } + }) + } + + /** + * 计算并渲染数据点。点太多采用协程计算,不然会有点卡顿 + * @param location 定位点(天宝RTK获取) + * */ + private fun renderDataPoint(location: AMapLocation) { + val longitude = location.longitude + val latitude = location.latitude + lifecycleScope.launch(Dispatchers.IO) { + val dataPoints = ArrayList() + DataBaseManager.get.loadMarkers().forEach { + val distance = AMapUtils.calculateLineDistance( + LatLng(it.lat.toDouble(), it.lng.toDouble()), LatLng(latitude, longitude) + ) + val formatDistance = decimalFormat.format(distance).toFloat() + if (formatDistance <= LocaleConstant.MAX_DISTANCE) { + val angle = atan2( + (it.lat.toDouble() - latitude), (it.lng.toDouble() - longitude) + ) + Math.PI + val formatAngle = decimalFormat.format(angle).toDouble() + + "[$longitude, $latitude,$formatDistance, $formatAngle]".writeToFile( + createLogFile() + ) + dataPoints.add(RadarScanView.DataPoint(formatAngle, formatDistance)) + } + } + withContext(Dispatchers.Main) { + binding.radarScanView.renderPointData(dataPoints, + object : RadarScanView.OnGetNearestPointCallback { + override fun getNearestPoint(point: RadarScanView.DataPoint?) { + if (point == null) { + binding.distanceValueView.text = "大于5.5m" + binding.distancePgBar.progress = 100 + } else { + binding.distanceValueView.text = "${point.distance}m" + val progress = + if (point.distance > LocaleConstant.MAX_DISTANCE) { + 100 + } else { + (point.distance / LocaleConstant.MAX_DISTANCE) * 100 + } + binding.distancePgBar.progress = progress.toInt() + } + } + }) } } } @@ -1644,60 +1804,33 @@ isDetectMarker = true - //角度 - degreeCache["lastDegree"] = 0f + if (isExecuteTask) { + binding.taskStateView.visibility = View.GONE + binding.taskStateView.isSelected = false + } else { + binding.taskStateView.visibility = View.VISIBLE + binding.taskStateView.isSelected = true + } } fun bindingValue(hex: String) { if (hex.startsWith("4E")) { try { //4E转为String为N,代表能量值 - //用能量值转动表盘 val energyResponse = hex.take(10).hexToString() val energy = energyResponse.substring(1).toInt() if (energy >= 4000) { - isPlaying = if (!isPlaying) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(fastSoundResourceId) - false - } + soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) } else { - isPlaying = if (!isPlaying) { - soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(slowSoundResourceId) - false - } + soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) } - binding.resultTextView.text = "信号能量值:${energyResponse}" - - //转换为转动的角度 - val degree = (energy.toFloat() / (50 * 100)) * 180 - binding.energyValueView.text = decimal.format(degree) - - degreeCache["lastDegree"]?.apply { - val animation = RotateAnimation( - this, - degree, - Animation.RELATIVE_TO_SELF, - 0.5f, - Animation.RELATIVE_TO_SELF, - 0.5f - ) - animation.duration = 0 - animation.fillAfter = true - binding.needleView.startAnimation(animation) - } - - //保存旋转后的角度 - degreeCache["lastDegree"] = degree + //通过设置进度条表示能量值 + binding.energyPgBar.progress = energy + binding.energyValueView.text = "${energy}dB" if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" + binding.energyTipsView.text = "信号较弱,可能距离较远" binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) @@ -1712,11 +1845,11 @@ binding.searchResultView.setTextColor(Color.parseColor("#8D1717")) binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } else if (energy >= 4100) {//148° - binding.energyTipsView.text = "标识器信号极强,可能在正下方" + binding.energyTipsView.text = "信号极强,接近标识器正上方" binding.energyTipsView.setTextColor(Color.parseColor("#428d00")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" + binding.energyTipsView.text = "已靠近,请继续移动位置" binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } @@ -1757,31 +1890,37 @@ binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) //自动上传标识器 -// taskBean = DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") -// taskBean?.apply { -// /** -// * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 -// * */ -// taskViewModel.uploadMarker(taskCode) -// } + if (isExecuteTask) { + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) + } + } } } } + //更新罗盘角度 + fun updateDegreeValue(degree: Int) { + binding.radarScanView.setDegreeValue(degree) + } + private fun initTimer() { searchMarkerTimer = Timer() signalTask = object : TimerTask() { override fun run() { - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() } } energyTask = object : TimerTask() { override fun run() { - out?.write('6'.code) - out?.flush() + out.write('6'.code) + out.flush() } } @@ -1798,6 +1937,7 @@ gpioManager.setGpioLow("18") isDetectMarker = false soundPool.autoPause() + locationManager.stopLocation() super.dismiss() } } diff --git a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt index f092eb0..040eb10 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt @@ -5,7 +5,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.LabelBean +import com.casic.electric.detector.bean.MarkerLocalBean import com.casic.electric.detector.databinding.ActivityObjectDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.FileType @@ -23,7 +23,7 @@ private val kTag = "ObjectDetailActivity" private val context: Context = this@ObjectDetailActivity private val gson by lazy { Gson() } - private lateinit var labelBean: LabelBean + private lateinit var markerLocalBean: MarkerLocalBean override fun initOnCreate(savedInstanceState: Bundle?) { window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) @@ -36,37 +36,37 @@ val objectJson = intent.getStringExtra(Constant.INTENT_PARAM)!! try { - labelBean = gson.fromJson(objectJson, object : TypeToken() {}.type) + markerLocalBean = gson.fromJson(objectJson, object : TypeToken() {}.type) - binding.markerObjTypeView.text = labelBean.markerObjType - binding.markerNumberView.text = labelBean.markerNumber - binding.objectNameView.text = labelBean.objectName - binding.voltageLevelView.text = labelBean.voltageLevel - binding.transformerModelView.text = labelBean.transformerModel - binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial - binding.sizeView.text = labelBean.size - binding.bottomDepthView.text = labelBean.bottomDepth - binding.jointCountView.text = labelBean.jointCount - binding.casingMaterialView.text = labelBean.casingMaterial - binding.casingSpecView.text = labelBean.casingSpec - binding.constructTimeView.text = labelBean.constructTime - binding.inspectionUnitView.text = labelBean.inspectionUnit - binding.areaView.text = labelBean.area - binding.roadView.text = labelBean.road - binding.memo1View.text = labelBean.memo1 - binding.memo2View.text = labelBean.memo2 - binding.memo3View.text = labelBean.memo3 - binding.markerIdView.text = labelBean.markerId - binding.markerTypeView.text = labelBean.markerType - binding.ownerView.text = labelBean.owner - binding.markerDepthView.text = labelBean.markerDepth - binding.electricTagCountView.text = labelBean.electricTagCount - binding.installedTimeView.text = labelBean.installedTime - binding.longitudeView.text = labelBean.longitude - binding.latitudeView.text = labelBean.latitude - binding.markerMemo1View.text = labelBean.markerMemo1 - binding.markerMemo2View.text = labelBean.markerMemo2 - binding.markerMemo3View.text = labelBean.markerMemo3 +// binding.markerObjTypeView.text = labelBean.markerObjType +// binding.markerNumberView.text = labelBean.markerNumber +// binding.objectNameView.text = labelBean.objectName +// binding.voltageLevelView.text = labelBean.voltageLevel +// binding.transformerModelView.text = labelBean.transformerModel +// binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial +// binding.sizeView.text = labelBean.size +// binding.bottomDepthView.text = labelBean.bottomDepth +// binding.jointCountView.text = labelBean.jointCount +// binding.casingMaterialView.text = labelBean.casingMaterial +// binding.casingSpecView.text = labelBean.casingSpec +// binding.constructTimeView.text = labelBean.constructTime +// binding.inspectionUnitView.text = labelBean.inspectionUnit +// binding.areaView.text = labelBean.area +// binding.roadView.text = labelBean.road +// binding.memo1View.text = labelBean.memo1 +// binding.memo2View.text = labelBean.memo2 +// binding.memo3View.text = labelBean.memo3 +// binding.markerIdView.text = labelBean.markerId +// binding.markerTypeView.text = labelBean.markerType +// binding.ownerView.text = labelBean.owner +// binding.markerDepthView.text = labelBean.markerDepth +// binding.electricTagCountView.text = labelBean.electricTagCount +// binding.installedTimeView.text = labelBean.installedTime +// binding.longitudeView.text = labelBean.longitude +// binding.latitudeView.text = labelBean.latitude +// binding.markerMemo1View.text = labelBean.markerMemo1 +// binding.markerMemo2View.text = labelBean.markerMemo2 +// binding.markerMemo3View.text = labelBean.markerMemo3 } catch (e: NumberFormatException) { e.printStackTrace() } @@ -77,7 +77,7 @@ binding.showImageView.setOnClickListener { //查数据库 - if (labelBean.imagePath.isNullOrEmpty()) { + if (markerLocalBean.imagePath.isNullOrEmpty()) { "此标识器无图片".show(context) } else { val realPaths: ArrayList = ArrayList() //真实图片路径 @@ -85,7 +85,7 @@ /** * /images/markers/202307/0008818922_EVENT_20230704_160349_0_1.jpg,/images/markers/202307/0008818922_EVENT_20230704_160406_0_2.jpg * */ - val imagePath = labelBean.imagePath + val imagePath = markerLocalBean.imagePath if (imagePath.contains(",")) { val list = imagePath.split(",") list.forEach { path -> diff --git a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt index ea74e8a..57c93fe 100644 --- a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt +++ b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt @@ -1,8 +1,10 @@ package com.casic.electric.detector.vm import android.content.Context +import android.util.Log import androidx.lifecycle.MutableLiveData import com.casic.electric.detector.base.BaseApplication +import com.casic.electric.detector.bean.TaskMarkerLocalBean import com.casic.electric.detector.extensions.getResponseMessage import com.casic.electric.detector.extensions.getResponseState import com.casic.electric.detector.model.MarkerFileModel @@ -21,6 +23,8 @@ import com.pengxh.kt.lite.utils.SaveKeyValues class TaskViewModel : BaseViewModel() { + + private val kTag = "TaskViewModel" private val gson by lazy { Gson() } val markerFileResult = MutableLiveData() val taskResult = MutableLiveData() @@ -165,40 +169,25 @@ loadState.value = LoadState.Fail }) - fun uploadTask(userId: String, taskId: String?, state: String) = launch({ + fun uploadTask( + context: Context, userId: String, taskId: String, taskCode: String, state: String + ) = launch({ loadState.value = LoadState.Loading val response = RetrofitServiceManager.uploadTask(userId, taskId, state) if (response.getResponseState()) { loadState.value = LoadState.Success - if (state == "2") { - "工单${taskId}已提交!".show(BaseApplication.get()) - //删除本地数据库 -// DataBaseManager.get.deleteTaskById(taskId) - SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") - } - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(BaseApplication.get()) - } - }, { - it.printStackTrace() - loadState.value = LoadState.Fail - }) - - fun uploadTask(context: Context, userId: String, taskId: String?, state: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadTask(userId, taskId, state) - if (response.getResponseState()) { - loadState.value = LoadState.Success + //工单提交之后,并且状态是2,删除本地Task记录 if (state == "2") { "工单${taskId}已提交!".show(context) //删除本地数据库 - DataBaseManager.get.deleteTaskById(taskId) + DataBaseManager.get.deleteLocalTaskById(taskId, taskCode) SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") val element = JsonParser.parseString(response) val jsonObject = element.asJsonObject executeTaskResult.value = jsonObject.get("success").asString + } else { + Log.d(kTag, "uploadTask: 仅执行工单,不删除本地工单数据") } } else { loadState.value = LoadState.Fail @@ -225,17 +214,12 @@ loadState.value = LoadState.Fail }) - fun uploadMarker(context: Context, taskDetailId: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadMarker(taskDetailId) - if (response.getResponseState()) { - loadState.value = LoadState.Success - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(context) - } + fun uploadMarker(context: Context, marker: TaskMarkerLocalBean) = launch({ + //主键ID代替MarkerId + RetrofitServiceManager.uploadMarker(marker.id.toString()) + "标识器${marker.markerId}已探测!".show(context) + DataBaseManager.get.updateLocalTaskMarkerState(marker) }, { it.printStackTrace() - loadState.value = LoadState.Fail }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt new file mode 100644 index 0000000..e3831d6 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt @@ -0,0 +1,60 @@ +package com.casic.electric.detector.widgets + +import android.app.Dialog +import android.content.Context +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Bundle +import com.casic.electric.detector.R +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.databinding.DialogMarkerDetailBinding +import com.casic.electric.detector.utils.LocaleConstant +import com.pengxh.kt.lite.extensions.binding +import com.pengxh.kt.lite.extensions.getScreenHeight +import com.pengxh.kt.lite.extensions.getScreenWidth + +class MarkerDetailDialog constructor(context: Context) : + Dialog(context, R.style.UserDefinedDialogStyle) { + + private lateinit var marker: MarkerLocalBean + + fun setMarker(marker: MarkerLocalBean) { + this.marker = marker + } + + private val binding: DialogMarkerDetailBinding by binding() + + private fun Dialog.initDialogLayoutParams() { + val window = this.window ?: return + window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + window.decorView.setBackgroundColor(Color.TRANSPARENT) + val params = window.attributes + params.width = ((context.getScreenWidth() * 0.8).toInt()) + params.height = ((context.getScreenHeight() * 0.7).toInt()) + window.attributes = params + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.initDialogLayoutParams() + setCanceledOnTouchOutside(true) + + binding.objectTypeView.text = LocaleConstant.POINT_TYPE_ARRAY[marker.objectType.toInt() - 1] + binding.pipelineTypeView.text = marker.pipelineType + binding.pipelineDiameterView.text = marker.pipelineDiameter + binding.pipelineMaterialView.text = marker.pipelineMaterial + binding.buryMethodView.text = marker.buryMethod + binding.buryDeepView.text = marker.buryDepth + binding.areaView.text = marker.area + binding.lineView.text = marker.line + binding.roadView.text = marker.road + binding.constructTimeView.text = marker.constructTime + binding.ownerView.text = marker.owner + binding.identifierIdView.text = marker.markerId + binding.identifierTypeView.text = marker.markerType + binding.identifierDeepView.text = marker.markerDepth + binding.personView.text = marker.installationDept + binding.installTimeView.text = marker.updateTime + binding.remarkView.text = marker.remark + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt index 169147b..b6b710b 100644 --- a/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt +++ b/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt @@ -223,18 +223,18 @@ //查库 val autoCompleteData = HashSet() CoroutineScope(Dispatchers.Main).launch { - val labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabelByCondition(conditionArray[position], null) + val makers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkerByCondition(conditionArray[position], null) } - for (labelBean in labelBeans) { + for (marker in makers) { when (position) { - 1 -> autoCompleteData.add(labelBean.markerNumber) - 2 -> autoCompleteData.add(labelBean.objectName) - 3 -> autoCompleteData.add(labelBean.area) - 4 -> autoCompleteData.add(labelBean.road) - 5 -> autoCompleteData.add(labelBean.inspectionUnit) - 6 -> autoCompleteData.add(labelBean.owner) - 8 -> autoCompleteData.add(labelBean.markerId) +// 1 -> autoCompleteData.add(marker.markerNumber) +// 2 -> autoCompleteData.add(marker.objectName) + 3 -> autoCompleteData.add(marker.area) + 4 -> autoCompleteData.add(marker.road) + 5 -> autoCompleteData.add(marker.installationDept) + 6 -> autoCompleteData.add(marker.owner) + 8 -> autoCompleteData.add(marker.markerId) } } diff --git a/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt b/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt index 372d973..7c74215 100644 --- a/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt +++ b/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt @@ -70,6 +70,7 @@ private lateinit var borderPaint: Paint private lateinit var shaderPaint: Paint private lateinit var dataPaint: Paint + private lateinit var targetPaint: Paint private lateinit var outerPaint: TextPaint private lateinit var outerTextPath: Path @@ -172,6 +173,12 @@ dataPaint.isAntiAlias = true dataPaint.style = Paint.Style.FILL + //最近点画笔 + targetPaint = Paint() + targetPaint.color = Color.GREEN + targetPaint.isAntiAlias = true + targetPaint.style = Paint.Style.FILL + //矩阵 matrix = Matrix() } @@ -331,9 +338,9 @@ canvas.drawCircle(it.x, it.y, 10f, dataPaint) } - //画最近的点最外层圆环 + //画最近的点 targetPoint?.apply { - canvas.drawCircle(x, y, 12f, borderPaint) + canvas.drawCircle(x, y, 10f, targetPaint) } /** @@ -394,14 +401,12 @@ * dataPoint转为PointF * */ private fun DataPoint.convertPointF(): PointF { - val dataAngle = (this.angle * Math.PI / 180).toFloat() - /** * 距离最大5.5米,表盘四个环,一个环距离1.5米,半径124dp(248px) * */ val dataDistance = (this.distance / LocaleConstant.MAX_DISTANCE) * radius - val x = dataDistance * cos(dataAngle) - val y = dataDistance * sin(dataAngle) + val x = dataDistance * cos(this.angle).toFloat() + val y = dataDistance * sin(this.angle).toFloat() return PointF(x, y) } @@ -410,5 +415,5 @@ * @param angle 数据点和圆心的方位角 * @param distance 数据点和圆心的相对距离 * */ - data class DataPoint(var angle: Int, var distance: Float) + data class DataPoint(var angle: Double, var distance: Float) } \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_progress_bar.xml b/app/src/main/res/drawable/bg_progress_bar.xml new file mode 100644 index 0000000..8a6cd5f --- /dev/null +++ b/app/src/main/res/drawable/bg_progress_bar.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt index 837ae86..2f1bb58 100644 --- a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt @@ -276,7 +276,7 @@ //先存本地 lifecycleScope.launch { withContext(Dispatchers.IO) { - DataBaseManager.get.insertSmallLabel(smallLabelData) +// DataBaseManager.get.insertSmallLabel(smallLabelData) } } @@ -339,7 +339,7 @@ gpioManager.setGpioLow("18") //查本地库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isEmpty()) { binding.objectAttrInclude.markerIdView.text = markerId } else { diff --git a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt index d3ffdd3..a5834bd 100644 --- a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt @@ -6,6 +6,7 @@ import android.app.Dialog import android.content.Context import android.content.DialogInterface +import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable @@ -19,16 +20,16 @@ import android.os.CountDownTimer import android.os.Handler import android.os.Message +import android.util.Log import android.view.KeyEvent import android.view.View -import android.view.animation.Animation -import android.view.animation.RotateAnimation import android.widget.AdapterView import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import com.amap.api.location.AMapLocation import com.amap.api.maps.AMap import com.amap.api.maps.AMapOptions +import com.amap.api.maps.AMapUtils import com.amap.api.maps.CameraUpdateFactory import com.amap.api.maps.CoordinateConverter import com.amap.api.maps.model.BitmapDescriptorFactory @@ -39,8 +40,9 @@ import com.casic.electric.detector.R import com.casic.electric.detector.adapter.EditableImageAdapter import com.casic.electric.detector.base.SerialPortActivity -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.TaskBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean import com.casic.electric.detector.callback.OnGetLocationListener import com.casic.electric.detector.callback.OnImageCompressListener import com.casic.electric.detector.cluster.ClusterItem @@ -49,9 +51,10 @@ import com.casic.electric.detector.databinding.ActivityMainBinding import com.casic.electric.detector.databinding.DialogInstallMarkerBinding import com.casic.electric.detector.databinding.DialogInstallSmallMarkerBinding -import com.casic.electric.detector.databinding.DialogSearchMarkerBinding +import com.casic.electric.detector.databinding.DialogSearchMarkerNewBinding import com.casic.electric.detector.extensions.appendExcelDownloadUrl import com.casic.electric.detector.extensions.compressImage +import com.casic.electric.detector.extensions.createTaskCode import com.casic.electric.detector.extensions.drawCircle import com.casic.electric.detector.extensions.getDefaultValue import com.casic.electric.detector.extensions.hexToString @@ -61,6 +64,7 @@ import com.casic.electric.detector.extensions.setDefaultValue import com.casic.electric.detector.extensions.show import com.casic.electric.detector.extensions.toHex +import com.casic.electric.detector.model.TaskDetailLocalModel import com.casic.electric.detector.model.TaskModel import com.casic.electric.detector.utils.DataBaseManager import com.casic.electric.detector.utils.ExcelHub @@ -70,9 +74,10 @@ import com.casic.electric.detector.utils.LocationHub import com.casic.electric.detector.utils.RouteOnMap import com.casic.electric.detector.vm.TaskViewModel +import com.casic.electric.detector.widgets.MarkerDetailDialog import com.casic.electric.detector.widgets.QueryMarkerDialog +import com.casic.electric.detector.widgets.RadarScanView import com.casic.electric.detector.widgets.SamplePopupWindow -import com.google.gson.Gson import com.luck.picture.lib.basic.PictureSelector import com.luck.picture.lib.config.SelectMimeType import com.luck.picture.lib.entity.LocalMedia @@ -81,8 +86,10 @@ import com.pengxh.kt.lite.extensions.binding import com.pengxh.kt.lite.extensions.convertColor import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.createLogFile import com.pengxh.kt.lite.extensions.dateToTimestamp import com.pengxh.kt.lite.extensions.dp2px +import com.pengxh.kt.lite.extensions.getSystemService import com.pengxh.kt.lite.extensions.initDialogLayoutParams import com.pengxh.kt.lite.extensions.isNetworkConnected import com.pengxh.kt.lite.extensions.navigatePageTo @@ -90,6 +97,7 @@ import com.pengxh.kt.lite.extensions.timestampToCompleteDate import com.pengxh.kt.lite.extensions.timestampToTime import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.extensions.writeToFile import com.pengxh.kt.lite.utils.FileDownloadManager import com.pengxh.kt.lite.utils.LoadState import com.pengxh.kt.lite.utils.LoadingDialogHub @@ -103,47 +111,50 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File +import java.math.RoundingMode import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer import java.util.TimerTask +import kotlin.math.atan2 @SuppressLint("all") class MainActivity : SerialPortActivity(), SensorEventListener, Handler.Callback { private val kTag = "MainActivity" - private val context = this@MainActivity + private val context = this private val samplePopupWindow by lazy { SamplePopupWindow(this) } - private val gson by lazy { Gson() } private val regionRadius by lazy { LocaleConstant.RADIUS_SIZE.dp2px(this) } private val backDrawables by lazy { HashMap() } private val installDialog by lazy { InstallMarkerDialog(this) } - private val searchDialog by lazy { SearchMarkerDialog(this) } + private val searchNewDialog by lazy { SearchMarkerNewDialog(this) } + private val detailDialog by lazy { MarkerDetailDialog(this) } + private val locationHub by lazy { LocationHub(this) } + private val decimalFormat by lazy { DecimalFormat("0.00") } private val sensorMessageCode = 2024022301 private val rotationMatrix = FloatArray(9)//旋转矩阵缓存 private val valueArray = FloatArray(3)//方位角数值 private var clickTime: Long = 0 - private var labelBeans = ArrayList() + private var markers = ArrayList() + private var smallMarkers = ArrayList() private var clusterOverlay: ClusterOverlay? = null - private var latitude: Double = 0.0 - private var longitude: Double = 0.0 private var isFreeTask = false + private var freeTaskTitle = "" private var ids = HashSet() private var signalTask: TimerTask? = null + private var energyTask: TimerTask? = null private var searchMarkerTimer: Timer? = null - private var taskId: String? = null + private var freeTaskId: String? = null private var gravity: FloatArray? = null private var geomagnetic: FloatArray? = null private lateinit var aMap: AMap - private lateinit var task: TaskBean private lateinit var sensorManager: SensorManager private lateinit var weakReferenceHandler: WeakReferenceHandler /***inner class 需要用到*****start*/ private val gpioManager by lazy { GpioManager() } - private val locationHub by lazy { LocationHub(this) } private val taskViewModel by lazy { ViewModelProvider(this)[TaskViewModel::class.java] } private val attr = AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ALARM) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build() @@ -168,6 +179,9 @@ slowSoundResourceId = soundPool.load(this, R.raw.ring4, 1) fastSoundResourceId = soundPool.load(this, R.raw.ring2, 1) + //保留小数2位 + decimalFormat.roundingMode = RoundingMode.HALF_UP + "登录成功".show(this) //地图初始化 @@ -177,12 +191,14 @@ samplePopupWindow.setPopupMenuItem(LocaleConstant.POPUP_TITLES) samplePopupWindow.setBackgroundDrawable(null) + sensorManager = getSystemService()!! + weakReferenceHandler = WeakReferenceHandler(this) + //task网络请求监听 taskViewModel.markerFileResult.observe(this) { if (it.success == "true") { //清空之前的数据 - DataBaseManager.get.clearLabels() - DataBaseManager.get.clearSmallLabels() + DataBaseManager.get.clearMarkers() /** * "data":"/xls/marker1.xls,/xls/smallMarker1.xls" * 有两份excel表格需要下载 @@ -200,10 +216,10 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { - labelBeans = ExcelHub.readLabel(file.absolutePath) + markers = ExcelHub.readLabel(file.absolutePath) withContext(Dispatchers.IO) { - labelBeans.forEach { label -> - DataBaseManager.get.insertLabel(label) + markers.forEach { marker -> + DataBaseManager.get.saveMarkerInLocale(marker) } } LoadingDialogHub.dismiss() @@ -227,12 +243,12 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { -// smallLabels = ExcelHub.readSmallLabel(file.absolutePath) -// withContext(Dispatchers.IO) { -// smallLabels.forEach { label -> -// DataBaseManager.get.insertSmallLabel(label) -// } -// } + smallMarkers = ExcelHub.readSmallLabel(file.absolutePath) + withContext(Dispatchers.IO) { + smallMarkers.forEach { marker -> + DataBaseManager.get.saveSmallMarkerInLocale(marker) + } + } } } @@ -250,18 +266,35 @@ taskViewModel.taskResult.observe(this) { if (it.success == "true") { //清空之前的数据 -// DataBaseManager.get.clearTasks() AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") .setMessage("您有${it.message.size}个新任务!").setPositiveButton("知道了") .setOnDialogButtonClickListener(object : AlertMessageDialog.OnDialogButtonClickListener { override fun onConfirmClick() { - saveTaskInformation(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { + freeTaskId = it + // 自由巡检保存在本地 + val bean = TaskLocalBean() + bean.id = freeTaskId.toString().toLong() + val currentTimeMillis = System.currentTimeMillis() + bean.taskCode = currentTimeMillis.createTaskCode() + bean.description = freeTaskTitle + val time = currentTimeMillis.timestampToCompleteDate() + bean.createTime = time + bean.status = "0" + val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + bean.createUserName = userName + bean.startTime = time + bean.endTime = "" + bean.isFreeTask = "1" + DataBaseManager.get.saveTaskInLocale(bean) + } + taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -290,10 +323,11 @@ }).build().show() } else { lifecycleScope.launch(Dispatchers.Main) { - val labels = withContext(Dispatchers.IO) { - DataBaseManager.get.queryLabelById("0") + val markers = withContext(Dispatchers.IO) { + DataBaseManager.get.queryMarkerByState("0") } - if (labels.isNotEmpty()) { + //如果有需要补全的标识器,Popup右侧会有小圆点提示 + if (markers.isNotEmpty()) { samplePopupWindow.setShowPosition(4) } val x = @@ -307,37 +341,42 @@ SamplePopupWindow.OnPopupWindowClickListener { override fun onPopupItemClicked(position: Int) { when (position) { - 0 -> updateLabels() + 0 -> updateMarkers() 1 -> downloadTask() 2 -> navigatePageTo() 3 -> uploadEvent() -// 4 -> uploadLabel() +// 4 -> completionMarker() } } }) //安装。上传,然后存入本地库 binding.installButton.setOnClickListener { - AlertControlDialog.Builder().setContext(context).setTitle("提示") - .setMessage("请选择安装对象").setPositiveButton("标识器") - .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - //标识器 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installMarkerDialog.show() - } + if (isFreeTask) { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("正在自由巡检任务中,请完成此次任务之后再使用此功能") + .setPositiveButton("好的").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { - override fun onCancelClick() { - //电子标签 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installSmallMarkerDialog.show() - } - }).build().show() + } + }).build().show() + } else { + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择安装对象").setPositiveButton("标识器") + .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + //标识器 +// installMarkerDialog.show() + } + + override fun onCancelClick() { + //电子标签 +// installSmallMarkerDialog.show() + } + }).build().show() + } } //查看 @@ -351,24 +390,24 @@ ) { //查询数据库 lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { + markers = withContext(Dispatchers.IO) { if (contentValue.size == 1) { - DataBaseManager.get.loadLabelByCondition( + DataBaseManager.get.loadMarkerByCondition( selectedCondition, contentValue[0] - ) as ArrayList + ) as ArrayList } else { DataBaseManager.get.loadLabelByDate( contentValue[0], contentValue[1] - ) as ArrayList + ) as ArrayList } } val latitudeList = ArrayList() val longitudeList = ArrayList() - labelBeans.forEach { - val latitude = it.latitude - val longitude = it.longitude + markers.forEach { + val latitude = markers.first().lat + val longitude = markers.first().lng if (latitude.isNotBlank() && longitude.isNotBlank()) { if (CoordinateConverter.isAMapDataAvailable( latitude.toDouble(), longitude.toDouble() @@ -400,52 +439,63 @@ //巡检 binding.inspectionButton.setOnClickListener { -// val task = DataBaseManager.get.queryDistinctTask() -// if (task.isNotEmpty()) { -// val arrayList = ArrayList() -// task.forEachIndexed { index, taskBean -> -// arrayList.add("任务${index + 1}:${taskBean.taskId},${taskBean.desc}") -// } -// -// BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) -// .setActionItemTitle(arrayList) -// .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { -// override fun onActionItemClick(position: Int) { -// val taskBean = task[position] -// SaveKeyValues.putValue(LocaleConstant.TASK_ID, taskBean.taskId) -// AlertControlDialog.Builder().setContext(context).setTitle("提示") -// .setMessage("请选择操作方式").setPositiveButton("执行工单") -// .setNegativeButton("提交工单") -// .setOnDialogButtonClickListener(object : -// AlertControlDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// detectRedrawGraphic(taskBean.taskId) -// -// val latLng = LatLng( -// taskBean.lat.toDouble(), taskBean.lng.toDouble() -// ) -// aMap.moveCamera( -// CameraUpdateFactory.newLatLngZoom(latLng, 16f) -// ) -// uploadTask(taskBean.taskId, "1") -// } -// -// override fun onCancelClick() { -// uploadTask(taskBean.taskId, "2") -// } -// }).build().show() -// } -// }).build().show() -// } else { -// AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") -// .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") -// .setPositiveButton("知道了").setOnDialogButtonClickListener(object : -// AlertMessageDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// startFreeTask() -// } -// }).build().show() -// } + val tasks = DataBaseManager.get.loadLocalTask() + if (tasks.isNotEmpty()) { + val arrayList = ArrayList() + tasks.forEachIndexed { index, task -> + arrayList.add("任务${index + 1}:${task.taskId},${task.description}") + } + + BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) + .setActionItemTitle(arrayList) + .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { + override fun onActionItemClick(position: Int) { + val task = tasks[position] + Log.d(kTag, task.toJson()) + SaveKeyValues.putValue(LocaleConstant.TASK_ID, task.taskId) + SaveKeyValues.putValue(LocaleConstant.TASK_CODE, task.taskCode) + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择操作方式").setPositiveButton("执行工单") + .setNegativeButton("提交工单") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + if (task.markerModels.isNotEmpty()) { + //移到Task下属第一个标识器位置 + val firstMarker = task.markerModels.first() + val latLng = LatLng(firstMarker.lat, firstMarker.lng) + aMap.moveCamera( + CameraUpdateFactory.newLatLngZoom(latLng, 16f) + ) + //执行工单 + uploadTask(task.taskId, task.taskCode, "1") + detectRedrawGraphic(task) + isExecuteTask = true + } else { + "此工单下无标识器,将执行自由巡检任务".show(context) + freeTaskId = task.taskId + openSerialPort() + } + } + + override fun onCancelClick() { + //提交工单 + uploadTask(task.taskId, task.taskCode, "2") + isExecuteTask = false + } + }).build().show() + } + }).build().show() + } else { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") + .setPositiveButton("知道了").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + startFreeTask() + } + }).build().show() + } } //探测 @@ -465,7 +515,7 @@ } }).build().show() } else { - searchDialog.show() + searchNewDialog.show() } } @@ -479,16 +529,21 @@ isFreeTask = false soundPool.autoPause() + //停止信号和ID搜索定时器 + signalTask?.cancel() + energyTask?.cancel() + searchMarkerTimer?.cancel() + //降低串口电位 gpioManager.setGpioLow("18") binding.stopFreeTaskButton.visibility = View.GONE - if (taskId.isNullOrBlank()) { + if (freeTaskId.isNullOrBlank()) { "任务ID异常,无法提交任务,请联系服务器管理员".show(context) return } - taskId?.apply { + freeTaskId?.apply { taskViewModel.uploadTaskMarker(context, this, ArrayList(ids)) } } @@ -497,42 +552,65 @@ } } + private fun uploadTask(taskId: String, taskCode: String, state: String) { + if (isNetworkConnected()) { + val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) + } else { + "网络连接已断开,请检查".show(this) + } + } + private fun startFreeTask() { AlertInputDialog.Builder().setContext(this).setTitle("新建自由巡检任务") .setHintMessage("请输入自由巡检任务简要描述").setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : AlertInputDialog.OnDialogButtonClickListener { override fun onConfirmClick(value: String) { + freeTaskTitle = value val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String taskViewModel.createFreeTask(context, userId, value) - //调高串口电位 - gpioManager.setGpioHigh("18") - - isFreeTask = true - //自由巡检 - signalTask = object : TimerTask() { - override fun run() { - out?.write('2'.code) - out?.flush() - } - } - searchMarkerTimer = Timer() - searchMarkerTimer?.apply { - schedule(signalTask, 0, 100) - } - - binding.stopFreeTaskButton.visibility = View.VISIBLE + openSerialPort() } override fun onCancelClick() {} }).build().show() } + private fun openSerialPort() { + //调高串口电位 + gpioManager.setGpioHigh("18") + + isFreeTask = true + //自由巡检 + signalTask = object : TimerTask() { + override fun run() { + out.write('2'.code) + out.flush() + } + } + + energyTask = object : TimerTask() { + override fun run() { + out.write('6'.code) + out.flush() + } + } + + searchMarkerTimer = Timer() + searchMarkerTimer?.apply { + schedule(signalTask, 0, 200) + schedule(energyTask, 0, 251) + } + + binding.stopFreeTaskButton.visibility = View.VISIBLE + } + override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) + if (searchNewDialog.isDetectMarker) { + searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() if (markerId.isNumber()) { @@ -540,26 +618,47 @@ } } else if (isFreeTask) { val markerId = hex.take(20).hexToString() + if (markerId.isNumber()) { //只响一次,因为探测频率高,所以依旧是连续的报警声 soundPool.play(soundResourceId, 1f, 1f, 0, 0, 1f) - "标识器${markerId}已探测".show(this) //添加地图Marker if (!ids.contains(markerId)) { //根据markerId查询标识器经纬度 - val labels = DataBaseManager.get.queryLabelById(markerId) - if (labels.isNotEmpty()) { - val bean = labels.first() + val markers = DataBaseManager.get.queryMarkerById(markerId) + if (markers.isNotEmpty()) { + val bean = markers.first() aMap.addMarker( MarkerOptions().position( - LatLng( - bean.latitude.toDouble(), bean.longitude.toDouble() - ) + LatLng(bean.lat.toDouble(), bean.lng.toDouble()) ).icon(BitmapDescriptorFactory.fromResource(R.mipmap.label_blue1)) ) } } ids.add(markerId) + + //显示标识器详细信息 + if (!detailDialog.isShowing) { + val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull() + if (markerBean == null) { + "无法查询到此ID【${markerId}】的信息".show(context) + } else { + detailDialog.setMarker(markerBean) + detailDialog.show() + } + } + } + + if (hex.startsWith("4E")) { + val energyResponse = hex.take(10).hexToString() + try { + val energy = energyResponse.substring(1).toInt() + if (energy <= 500 && detailDialog.isShowing) { + detailDialog.dismiss() + } + } catch (e: NumberFormatException) { + e.printStackTrace() + } } } } @@ -570,31 +669,21 @@ LoadState.Loading -> { if (installDialog.isInstallMarker) { LoadingDialogHub.show(this, "标识器安装中,请稍后...") - } else if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - "标识器${this.markerRealId}已探测!".show(context) -// DataBaseManager.get.updateTaskLabel(this) - } } else { LoadingDialogHub.show(this, "提交工单中,请稍后") } } - else -> { + LoadState.Success -> { if (installDialog.isInstallMarker) { -// installDialog.clearDefaultData() + installDialog.clearDefaultData() installDialog.dismiss() - "${installDialog.markerId}安装成功".show(context) + "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } } @@ -618,8 +707,6 @@ aMap.myLocationStyle = locationStyle//设置定位蓝点的Style aMap.isMyLocationEnabled = true//设置是否显示定位小蓝点 aMap.setOnMyLocationChangeListener { - longitude = it.longitude - latitude = it.latitude //经纬度逆编码 locationHub.antiCodingLocation(it) { address -> binding.currentLocationView.text = address @@ -631,19 +718,20 @@ aMap.setOnMapLongClickListener { lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } - //显示标签 - showLabelsOnMap() } //虽然不用显示附属标签,但是需要和标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } + + //显示标签 + showLabelsOnMap() } //自定义定位按钮 @@ -666,39 +754,28 @@ }) } - private fun saveTaskInformation(it: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String - if (it.message.size > 0) { - it.message.forEach { messageModel -> -// val count = DataBaseManager.get.countTaskById(messageModel.id.toString()) -// if (count == 0) { -// messageModel.taskDetailInfos.forEach { info -> -// DataBaseManager.get.insertTaskInformation( -// userName, -// messageModel.description, -// info.taskId.toString(), -// info.id.toString(), -// info.markerId.toString(), -// info.markerIdReal.toString(), -// info.longitude.toString(), -// info.latitude.toString(), -// messageModel.status -// ) -// } -// } + private fun saveUserTasks(task: TaskModel) { + task.message.forEach { model -> + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) + } } - "工单下载成功!".show(context) } + "工单下载成功!".show(this) } private fun showLabelsOnMap() { clusterOverlay?.onDestroy() val clusterItems = ArrayList() - labelBeans.forEach { - if (it.latitude.isNotEmpty() && it.longitude.isNotEmpty()) { - val latitude = it.latitude.toDouble() - val longitude = it.longitude.toDouble() + markers.forEach { + if (it.lat.isNotEmpty() && it.lng.isNotEmpty()) { + val latitude = it.lat.toDouble() + val longitude = it.lng.toDouble() val latLng = LatLng(latitude, longitude, false) val regionItem = RegionItem(latLng, it.id.toString()) @@ -717,7 +794,6 @@ ) backDrawables[0] = bitmapDrawable } - bitmapDrawable } if (clusterNum == 1) { var bitmapDrawable = backDrawables[1] @@ -780,8 +856,8 @@ override fun onActionItemClick(position: Int) { when (position) { 0 -> { - labelBeans.forEach { - if (it.markerId.toString() == item.tag) { + markers.forEach { + if (it.id.toString() == item.tag) { navigatePageTo(it.toJson()) } } @@ -789,11 +865,11 @@ 1 -> { val electricMarkers = ArrayList() -// smallLabels.forEach { -// if (it.markerId.toString() == item.tag) { -// electricMarkers.add(it.electricMarkerId) -// } -// } + smallMarkers.forEach { + if (it.id.toString() == item.tag) { + electricMarkers.add(it.electricMarkerId) + } + } if (electricMarkers.isEmpty()) { "此标识器没有绑定的电子标签".show(context) @@ -818,44 +894,32 @@ }.show() } - private fun detectRedrawGraphic(taskId: String) { -// val tasks = DataBaseManager.get.queryTaskById(taskId) -// if (tasks.isNotEmpty()) { -// tasks.forEach { -// val latLng = LatLng(it.lat.toDouble(), it.lng.toDouble()) -// val otMarkerOptions = MarkerOptions() -// otMarkerOptions.position(latLng) -// otMarkerOptions.visible(true) // 设置可见 -// if (it.state == "未开始") { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_red1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } else { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } -// aMap.addMarker(otMarkerOptions) -// } -// } + private fun detectRedrawGraphic(task: TaskDetailLocalModel) { + task.markerModels.forEach { + val latLng = LatLng(it.lat, it.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (it.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } + aMap.addMarker(otMarkerOptions) + } showLabelsOnMap() } - private fun uploadTask(taskId: String?, state: String) { - if (isNetworkConnected()) { - val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String - taskViewModel.uploadTask(userId, taskId, state) - } else { - "网络连接已断开,请检查".show(this) - } - } - //更新数据 - private fun updateLabels() { + private fun updateMarkers() { AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") .setNegativeButton("取消").setPositiveButton("确定") .setOnDialogButtonClickListener(object : @@ -941,7 +1005,7 @@ SensorManager.getOrientation(rotationMatrix, valueArray) val degree = ((360f + valueArray[0] * 180f / Math.PI) % 360).toInt() -// searchNewDialog.updateDegreeValue(degree) + searchNewDialog.updateDegreeValue(degree) } } return true @@ -953,8 +1017,8 @@ super.onResume() binding.mapView.onResume() lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } //显示标签 showLabelsOnMap() @@ -962,9 +1026,9 @@ //虽然不用显示附属标签,但是需要喝标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } //注册加速度传感器监听 @@ -990,8 +1054,6 @@ override fun onDestroy() { super.onDestroy() binding.mapView.onDestroy() - signalTask?.cancel() - searchMarkerTimer?.cancel() soundPool.release() locationHub.stopLocation() //降低串口电位 @@ -1006,6 +1068,7 @@ private val realPaths = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var countDownTimer: CountDownTimer + private lateinit var locationManager: LocationHub var isReadMarker = false var isInstallMarker = false @@ -1150,8 +1213,8 @@ soundPool.play(soundResourceId, 1f, 1f, 0, -1, 1f) - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() countDownTimer = object : CountDownTimer(5 * 1000, 1000) { override fun onTick(millisUntilFinished: Long) { @@ -1174,6 +1237,21 @@ } } + override fun show() { + super.show() + locationManager = LocationHub(context) + locationManager.getCurrentLocation(true, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + if (location != null) { + binding.markerAttrInclude.lngView.text = location.longitude.toString() + binding.markerAttrInclude.latView.text = location.latitude.toString() + } else { + "当前位置信号差,无法获取定位".show(context) + } + } + }) + } + fun bindingValue(markerId: String) { this.markerId = markerId LoadingDialogHub.dismiss() @@ -1193,6 +1271,7 @@ gpioManager.setGpioLow("18") soundPool.autoPause() isInstallMarker = false + locationManager.stopLocation() super.dismiss() } @@ -1515,6 +1594,21 @@ }) } + //清除默认数据 + fun clearDefaultData() { +// "markerObjectTypeView".setDefaultValue("") +// "pipelineDiameterView".setDefaultValue("") +// "buryDeepView".setDefaultValue("") +// "bottomPipeDiameterView".setDefaultValue("") +// "bottomPointDeepView".setDefaultValue("") +// "areaView".setDefaultValue("") +// "lineView".setDefaultValue("") +// "roadView".setDefaultValue("") +// "ownerView".setDefaultValue("") +// "identifierDeepView".setDefaultValue("") +// "personDeptView".setDefaultValue("") + } + //根据选择类型控制界面某些区域显隐 private fun setLayoutVisibility(vararg args: Int) { binding.objectAttrInclude.objectModeLayout.visibility = args[0] @@ -1566,21 +1660,23 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(context: Context) : Dialog(context) { + /**探测标识器新对话框******************************************************************************/ + inner class SearchMarkerNewDialog(context: Context) : Dialog(context) { - private val binding: DialogSearchMarkerBinding by binding() - private val decimal by lazy { DecimalFormat("0.0") } - private val degreeCache by lazy { HashMap() } - private var isPlaying = false + private val taskId by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String + } + private val taskCode by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_CODE, "") as String + } + private val binding: DialogSearchMarkerNewBinding by binding() private var markerId = "" private lateinit var searchMarkerTimer: Timer private lateinit var signalTask: TimerTask private lateinit var energyTask: TimerTask private lateinit var countDownTimer: CountDownTimer - + private lateinit var locationManager: LocationHub var isDetectMarker = false - var taskBean: TaskBean? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -1590,47 +1686,111 @@ energyTask.cancel() searchMarkerTimer.cancel() - out?.write('3'.code) -// val result = DataBaseManager.get.queryLabelById(markerId) -// if (result.isNotEmpty()) { -// val tag = when (result.first().identifierType) { -// "EM30" -> '7' -// "EM50" -> '8' -// "EM14" -> '9' -// else -> '1' -// } -// if (tag == '1') { -// "此标识器无法读取埋深!".show(context) -// } else { -// // 发送读取标识器埋设深度指令 -// LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") -// out.write(tag.code) -// out.flush() -// countDownTimer = object : CountDownTimer(15 * 1000, 1000) { -// override fun onTick(millisUntilFinished: Long) { -// -// } -// -// override fun onFinish() { -// LoadingDialogHub.dismiss() -// "探测此标识器深度超时,请重试".show(context) -// initTimer() -// } -// } -// countDownTimer.start() -// } -// } else { -// "标识器未安装,安装成功后才可读取埋深!".show(context) -// } + out.write('3'.code) + val result = DataBaseManager.get.queryMarkerById(markerId) + if (result.isNotEmpty()) { + val tag = when (result.first().markerType) { + "EM30" -> '7' + "EM50" -> '8' + "EM14" -> '9' + else -> '1' + } + if (tag == '1') { + "此标识器无法读取埋深!".show(context) + initTimer() + } else { + // 发送读取标识器埋设深度指令 + LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") + out.write(tag.code) + out.flush() + countDownTimer = object : CountDownTimer(15 * 1000, 1000) { + override fun onTick(millisUntilFinished: Long) { + + } + + override fun onFinish() { + LoadingDialogHub.dismiss() + "探测此标识器深度超时,请重试".show(context) + initTimer() + } + } + countDownTimer.start() + } + } else { + "标识器未安装,安装成功后才可读取埋深!".show(context) + initTimer() + } } binding.markerInfoButton.setOnClickListener { //查库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isNotEmpty()) { -// context.navigatePageTo(result.first().toJson()) + context.navigatePageTo(result.first().toJson()) } else { -// context.navigatePageTo(markerId) + context.navigatePageTo(markerId) + } + } + } + + override fun show() { + super.show() + locationManager = LocationHub(context) + //点位渲染,每次定位都计算当前位置与符合条件的点距离 + locationManager.getCurrentLocation(false, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + location?.apply { + renderDataPoint(this) + } + } + }) + } + + /** + * 计算并渲染数据点。点太多采用协程计算,不然会有点卡顿 + * @param location 定位点(天宝RTK获取) + * */ + private fun renderDataPoint(location: AMapLocation) { + val longitude = location.longitude + val latitude = location.latitude + lifecycleScope.launch(Dispatchers.IO) { + val dataPoints = ArrayList() + DataBaseManager.get.loadMarkers().forEach { + val distance = AMapUtils.calculateLineDistance( + LatLng(it.lat.toDouble(), it.lng.toDouble()), LatLng(latitude, longitude) + ) + val formatDistance = decimalFormat.format(distance).toFloat() + if (formatDistance <= LocaleConstant.MAX_DISTANCE) { + val angle = atan2( + (it.lat.toDouble() - latitude), (it.lng.toDouble() - longitude) + ) + Math.PI + val formatAngle = decimalFormat.format(angle).toDouble() + + "[$longitude, $latitude,$formatDistance, $formatAngle]".writeToFile( + createLogFile() + ) + dataPoints.add(RadarScanView.DataPoint(formatAngle, formatDistance)) + } + } + withContext(Dispatchers.Main) { + binding.radarScanView.renderPointData(dataPoints, + object : RadarScanView.OnGetNearestPointCallback { + override fun getNearestPoint(point: RadarScanView.DataPoint?) { + if (point == null) { + binding.distanceValueView.text = "大于5.5m" + binding.distancePgBar.progress = 100 + } else { + binding.distanceValueView.text = "${point.distance}m" + val progress = + if (point.distance > LocaleConstant.MAX_DISTANCE) { + 100 + } else { + (point.distance / LocaleConstant.MAX_DISTANCE) * 100 + } + binding.distancePgBar.progress = progress.toInt() + } + } + }) } } } @@ -1644,60 +1804,33 @@ isDetectMarker = true - //角度 - degreeCache["lastDegree"] = 0f + if (isExecuteTask) { + binding.taskStateView.visibility = View.GONE + binding.taskStateView.isSelected = false + } else { + binding.taskStateView.visibility = View.VISIBLE + binding.taskStateView.isSelected = true + } } fun bindingValue(hex: String) { if (hex.startsWith("4E")) { try { //4E转为String为N,代表能量值 - //用能量值转动表盘 val energyResponse = hex.take(10).hexToString() val energy = energyResponse.substring(1).toInt() if (energy >= 4000) { - isPlaying = if (!isPlaying) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(fastSoundResourceId) - false - } + soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) } else { - isPlaying = if (!isPlaying) { - soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(slowSoundResourceId) - false - } + soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) } - binding.resultTextView.text = "信号能量值:${energyResponse}" - - //转换为转动的角度 - val degree = (energy.toFloat() / (50 * 100)) * 180 - binding.energyValueView.text = decimal.format(degree) - - degreeCache["lastDegree"]?.apply { - val animation = RotateAnimation( - this, - degree, - Animation.RELATIVE_TO_SELF, - 0.5f, - Animation.RELATIVE_TO_SELF, - 0.5f - ) - animation.duration = 0 - animation.fillAfter = true - binding.needleView.startAnimation(animation) - } - - //保存旋转后的角度 - degreeCache["lastDegree"] = degree + //通过设置进度条表示能量值 + binding.energyPgBar.progress = energy + binding.energyValueView.text = "${energy}dB" if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" + binding.energyTipsView.text = "信号较弱,可能距离较远" binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) @@ -1712,11 +1845,11 @@ binding.searchResultView.setTextColor(Color.parseColor("#8D1717")) binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } else if (energy >= 4100) {//148° - binding.energyTipsView.text = "标识器信号极强,可能在正下方" + binding.energyTipsView.text = "信号极强,接近标识器正上方" binding.energyTipsView.setTextColor(Color.parseColor("#428d00")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" + binding.energyTipsView.text = "已靠近,请继续移动位置" binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } @@ -1757,31 +1890,37 @@ binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) //自动上传标识器 -// taskBean = DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") -// taskBean?.apply { -// /** -// * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 -// * */ -// taskViewModel.uploadMarker(taskCode) -// } + if (isExecuteTask) { + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) + } + } } } } + //更新罗盘角度 + fun updateDegreeValue(degree: Int) { + binding.radarScanView.setDegreeValue(degree) + } + private fun initTimer() { searchMarkerTimer = Timer() signalTask = object : TimerTask() { override fun run() { - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() } } energyTask = object : TimerTask() { override fun run() { - out?.write('6'.code) - out?.flush() + out.write('6'.code) + out.flush() } } @@ -1798,6 +1937,7 @@ gpioManager.setGpioLow("18") isDetectMarker = false soundPool.autoPause() + locationManager.stopLocation() super.dismiss() } } diff --git a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt index f092eb0..040eb10 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt @@ -5,7 +5,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.LabelBean +import com.casic.electric.detector.bean.MarkerLocalBean import com.casic.electric.detector.databinding.ActivityObjectDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.FileType @@ -23,7 +23,7 @@ private val kTag = "ObjectDetailActivity" private val context: Context = this@ObjectDetailActivity private val gson by lazy { Gson() } - private lateinit var labelBean: LabelBean + private lateinit var markerLocalBean: MarkerLocalBean override fun initOnCreate(savedInstanceState: Bundle?) { window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) @@ -36,37 +36,37 @@ val objectJson = intent.getStringExtra(Constant.INTENT_PARAM)!! try { - labelBean = gson.fromJson(objectJson, object : TypeToken() {}.type) + markerLocalBean = gson.fromJson(objectJson, object : TypeToken() {}.type) - binding.markerObjTypeView.text = labelBean.markerObjType - binding.markerNumberView.text = labelBean.markerNumber - binding.objectNameView.text = labelBean.objectName - binding.voltageLevelView.text = labelBean.voltageLevel - binding.transformerModelView.text = labelBean.transformerModel - binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial - binding.sizeView.text = labelBean.size - binding.bottomDepthView.text = labelBean.bottomDepth - binding.jointCountView.text = labelBean.jointCount - binding.casingMaterialView.text = labelBean.casingMaterial - binding.casingSpecView.text = labelBean.casingSpec - binding.constructTimeView.text = labelBean.constructTime - binding.inspectionUnitView.text = labelBean.inspectionUnit - binding.areaView.text = labelBean.area - binding.roadView.text = labelBean.road - binding.memo1View.text = labelBean.memo1 - binding.memo2View.text = labelBean.memo2 - binding.memo3View.text = labelBean.memo3 - binding.markerIdView.text = labelBean.markerId - binding.markerTypeView.text = labelBean.markerType - binding.ownerView.text = labelBean.owner - binding.markerDepthView.text = labelBean.markerDepth - binding.electricTagCountView.text = labelBean.electricTagCount - binding.installedTimeView.text = labelBean.installedTime - binding.longitudeView.text = labelBean.longitude - binding.latitudeView.text = labelBean.latitude - binding.markerMemo1View.text = labelBean.markerMemo1 - binding.markerMemo2View.text = labelBean.markerMemo2 - binding.markerMemo3View.text = labelBean.markerMemo3 +// binding.markerObjTypeView.text = labelBean.markerObjType +// binding.markerNumberView.text = labelBean.markerNumber +// binding.objectNameView.text = labelBean.objectName +// binding.voltageLevelView.text = labelBean.voltageLevel +// binding.transformerModelView.text = labelBean.transformerModel +// binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial +// binding.sizeView.text = labelBean.size +// binding.bottomDepthView.text = labelBean.bottomDepth +// binding.jointCountView.text = labelBean.jointCount +// binding.casingMaterialView.text = labelBean.casingMaterial +// binding.casingSpecView.text = labelBean.casingSpec +// binding.constructTimeView.text = labelBean.constructTime +// binding.inspectionUnitView.text = labelBean.inspectionUnit +// binding.areaView.text = labelBean.area +// binding.roadView.text = labelBean.road +// binding.memo1View.text = labelBean.memo1 +// binding.memo2View.text = labelBean.memo2 +// binding.memo3View.text = labelBean.memo3 +// binding.markerIdView.text = labelBean.markerId +// binding.markerTypeView.text = labelBean.markerType +// binding.ownerView.text = labelBean.owner +// binding.markerDepthView.text = labelBean.markerDepth +// binding.electricTagCountView.text = labelBean.electricTagCount +// binding.installedTimeView.text = labelBean.installedTime +// binding.longitudeView.text = labelBean.longitude +// binding.latitudeView.text = labelBean.latitude +// binding.markerMemo1View.text = labelBean.markerMemo1 +// binding.markerMemo2View.text = labelBean.markerMemo2 +// binding.markerMemo3View.text = labelBean.markerMemo3 } catch (e: NumberFormatException) { e.printStackTrace() } @@ -77,7 +77,7 @@ binding.showImageView.setOnClickListener { //查数据库 - if (labelBean.imagePath.isNullOrEmpty()) { + if (markerLocalBean.imagePath.isNullOrEmpty()) { "此标识器无图片".show(context) } else { val realPaths: ArrayList = ArrayList() //真实图片路径 @@ -85,7 +85,7 @@ /** * /images/markers/202307/0008818922_EVENT_20230704_160349_0_1.jpg,/images/markers/202307/0008818922_EVENT_20230704_160406_0_2.jpg * */ - val imagePath = labelBean.imagePath + val imagePath = markerLocalBean.imagePath if (imagePath.contains(",")) { val list = imagePath.split(",") list.forEach { path -> diff --git a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt index ea74e8a..57c93fe 100644 --- a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt +++ b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt @@ -1,8 +1,10 @@ package com.casic.electric.detector.vm import android.content.Context +import android.util.Log import androidx.lifecycle.MutableLiveData import com.casic.electric.detector.base.BaseApplication +import com.casic.electric.detector.bean.TaskMarkerLocalBean import com.casic.electric.detector.extensions.getResponseMessage import com.casic.electric.detector.extensions.getResponseState import com.casic.electric.detector.model.MarkerFileModel @@ -21,6 +23,8 @@ import com.pengxh.kt.lite.utils.SaveKeyValues class TaskViewModel : BaseViewModel() { + + private val kTag = "TaskViewModel" private val gson by lazy { Gson() } val markerFileResult = MutableLiveData() val taskResult = MutableLiveData() @@ -165,40 +169,25 @@ loadState.value = LoadState.Fail }) - fun uploadTask(userId: String, taskId: String?, state: String) = launch({ + fun uploadTask( + context: Context, userId: String, taskId: String, taskCode: String, state: String + ) = launch({ loadState.value = LoadState.Loading val response = RetrofitServiceManager.uploadTask(userId, taskId, state) if (response.getResponseState()) { loadState.value = LoadState.Success - if (state == "2") { - "工单${taskId}已提交!".show(BaseApplication.get()) - //删除本地数据库 -// DataBaseManager.get.deleteTaskById(taskId) - SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") - } - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(BaseApplication.get()) - } - }, { - it.printStackTrace() - loadState.value = LoadState.Fail - }) - - fun uploadTask(context: Context, userId: String, taskId: String?, state: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadTask(userId, taskId, state) - if (response.getResponseState()) { - loadState.value = LoadState.Success + //工单提交之后,并且状态是2,删除本地Task记录 if (state == "2") { "工单${taskId}已提交!".show(context) //删除本地数据库 - DataBaseManager.get.deleteTaskById(taskId) + DataBaseManager.get.deleteLocalTaskById(taskId, taskCode) SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") val element = JsonParser.parseString(response) val jsonObject = element.asJsonObject executeTaskResult.value = jsonObject.get("success").asString + } else { + Log.d(kTag, "uploadTask: 仅执行工单,不删除本地工单数据") } } else { loadState.value = LoadState.Fail @@ -225,17 +214,12 @@ loadState.value = LoadState.Fail }) - fun uploadMarker(context: Context, taskDetailId: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadMarker(taskDetailId) - if (response.getResponseState()) { - loadState.value = LoadState.Success - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(context) - } + fun uploadMarker(context: Context, marker: TaskMarkerLocalBean) = launch({ + //主键ID代替MarkerId + RetrofitServiceManager.uploadMarker(marker.id.toString()) + "标识器${marker.markerId}已探测!".show(context) + DataBaseManager.get.updateLocalTaskMarkerState(marker) }, { it.printStackTrace() - loadState.value = LoadState.Fail }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt new file mode 100644 index 0000000..e3831d6 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt @@ -0,0 +1,60 @@ +package com.casic.electric.detector.widgets + +import android.app.Dialog +import android.content.Context +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Bundle +import com.casic.electric.detector.R +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.databinding.DialogMarkerDetailBinding +import com.casic.electric.detector.utils.LocaleConstant +import com.pengxh.kt.lite.extensions.binding +import com.pengxh.kt.lite.extensions.getScreenHeight +import com.pengxh.kt.lite.extensions.getScreenWidth + +class MarkerDetailDialog constructor(context: Context) : + Dialog(context, R.style.UserDefinedDialogStyle) { + + private lateinit var marker: MarkerLocalBean + + fun setMarker(marker: MarkerLocalBean) { + this.marker = marker + } + + private val binding: DialogMarkerDetailBinding by binding() + + private fun Dialog.initDialogLayoutParams() { + val window = this.window ?: return + window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + window.decorView.setBackgroundColor(Color.TRANSPARENT) + val params = window.attributes + params.width = ((context.getScreenWidth() * 0.8).toInt()) + params.height = ((context.getScreenHeight() * 0.7).toInt()) + window.attributes = params + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.initDialogLayoutParams() + setCanceledOnTouchOutside(true) + + binding.objectTypeView.text = LocaleConstant.POINT_TYPE_ARRAY[marker.objectType.toInt() - 1] + binding.pipelineTypeView.text = marker.pipelineType + binding.pipelineDiameterView.text = marker.pipelineDiameter + binding.pipelineMaterialView.text = marker.pipelineMaterial + binding.buryMethodView.text = marker.buryMethod + binding.buryDeepView.text = marker.buryDepth + binding.areaView.text = marker.area + binding.lineView.text = marker.line + binding.roadView.text = marker.road + binding.constructTimeView.text = marker.constructTime + binding.ownerView.text = marker.owner + binding.identifierIdView.text = marker.markerId + binding.identifierTypeView.text = marker.markerType + binding.identifierDeepView.text = marker.markerDepth + binding.personView.text = marker.installationDept + binding.installTimeView.text = marker.updateTime + binding.remarkView.text = marker.remark + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt index 169147b..b6b710b 100644 --- a/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt +++ b/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt @@ -223,18 +223,18 @@ //查库 val autoCompleteData = HashSet() CoroutineScope(Dispatchers.Main).launch { - val labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabelByCondition(conditionArray[position], null) + val makers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkerByCondition(conditionArray[position], null) } - for (labelBean in labelBeans) { + for (marker in makers) { when (position) { - 1 -> autoCompleteData.add(labelBean.markerNumber) - 2 -> autoCompleteData.add(labelBean.objectName) - 3 -> autoCompleteData.add(labelBean.area) - 4 -> autoCompleteData.add(labelBean.road) - 5 -> autoCompleteData.add(labelBean.inspectionUnit) - 6 -> autoCompleteData.add(labelBean.owner) - 8 -> autoCompleteData.add(labelBean.markerId) +// 1 -> autoCompleteData.add(marker.markerNumber) +// 2 -> autoCompleteData.add(marker.objectName) + 3 -> autoCompleteData.add(marker.area) + 4 -> autoCompleteData.add(marker.road) + 5 -> autoCompleteData.add(marker.installationDept) + 6 -> autoCompleteData.add(marker.owner) + 8 -> autoCompleteData.add(marker.markerId) } } diff --git a/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt b/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt index 372d973..7c74215 100644 --- a/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt +++ b/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt @@ -70,6 +70,7 @@ private lateinit var borderPaint: Paint private lateinit var shaderPaint: Paint private lateinit var dataPaint: Paint + private lateinit var targetPaint: Paint private lateinit var outerPaint: TextPaint private lateinit var outerTextPath: Path @@ -172,6 +173,12 @@ dataPaint.isAntiAlias = true dataPaint.style = Paint.Style.FILL + //最近点画笔 + targetPaint = Paint() + targetPaint.color = Color.GREEN + targetPaint.isAntiAlias = true + targetPaint.style = Paint.Style.FILL + //矩阵 matrix = Matrix() } @@ -331,9 +338,9 @@ canvas.drawCircle(it.x, it.y, 10f, dataPaint) } - //画最近的点最外层圆环 + //画最近的点 targetPoint?.apply { - canvas.drawCircle(x, y, 12f, borderPaint) + canvas.drawCircle(x, y, 10f, targetPaint) } /** @@ -394,14 +401,12 @@ * dataPoint转为PointF * */ private fun DataPoint.convertPointF(): PointF { - val dataAngle = (this.angle * Math.PI / 180).toFloat() - /** * 距离最大5.5米,表盘四个环,一个环距离1.5米,半径124dp(248px) * */ val dataDistance = (this.distance / LocaleConstant.MAX_DISTANCE) * radius - val x = dataDistance * cos(dataAngle) - val y = dataDistance * sin(dataAngle) + val x = dataDistance * cos(this.angle).toFloat() + val y = dataDistance * sin(this.angle).toFloat() return PointF(x, y) } @@ -410,5 +415,5 @@ * @param angle 数据点和圆心的方位角 * @param distance 数据点和圆心的相对距离 * */ - data class DataPoint(var angle: Int, var distance: Float) + data class DataPoint(var angle: Double, var distance: Float) } \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_progress_bar.xml b/app/src/main/res/drawable/bg_progress_bar.xml new file mode 100644 index 0000000..8a6cd5f --- /dev/null +++ b/app/src/main/res/drawable/bg_progress_bar.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/dialog_marker_detail.xml b/app/src/main/res/layout/dialog_marker_detail.xml new file mode 100644 index 0000000..651d755 --- /dev/null +++ b/app/src/main/res/layout/dialog_marker_detail.xml @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 167cf0c..93ec3d6 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,21 +1,21 @@ - - - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 59fdbea..2907601 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ dependencies { //基础依赖库 - implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.8' + implementation 'com.github.AndroidCoderPeng:Kotlin-lite-lib:1.0.10' implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' //Google官方授权框架 diff --git a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt index 1010ab7..3f0356a 100644 --- a/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt +++ b/app/src/main/java/com/casic/electric/detector/base/BaseApplication.kt @@ -28,6 +28,12 @@ return serialPorts } + fun closeSerialPort() { + serialPorts?.forEach { + it.close() + } + } + companion object { private var application: BaseApplication by Delegates.notNull() diff --git a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt index 69a3ddd..76cfd81 100644 --- a/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/base/SerialPortActivity.kt @@ -17,8 +17,8 @@ abstract class SerialPortActivity : AppCompatActivity() { protected lateinit var binding: VB - private val serialPorts by lazy { BaseApplication.get().getSerialPorts() } - var out: OutputStream? = null + + lateinit var out: OutputStream override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -30,6 +30,7 @@ initEvent() try { + val serialPorts = BaseApplication.get().getSerialPorts() //读 lifecycleScope.launch(Dispatchers.IO) { serialPorts?.apply { @@ -119,9 +120,7 @@ abstract fun onDataReceived(buffer: ByteArray) override fun onDestroy() { - serialPorts?.forEach { - it.closeSerialPort() - } + BaseApplication.get().closeSerialPort() super.onDestroy() } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java deleted file mode 100644 index b2743b9..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/LabelBean.java +++ /dev/null @@ -1,523 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class LabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标记对象类型 - private String markerObjType; - // 编号 - private String markerNumber; - // 名称 - private String objectName; - // 电压等级 - private String voltageLevel; - // 变压器型号 - private String transformerModel; - // 管孔数量 - private String holeCount; - // 装机容量 - private String capacity; - // 井盖材质 - private String wellCoverMaterial; - // 覆土深度 - private String coverDepth; - // 变压器规格 - private String transformerSpec; - // 进线名称 - private String inlineName; - // 尺寸 - private String size; - // 底部深度,井深 - private String bottomDepth; - // 高度 - private String height; - // 交叉管道 - private String crossPipeLine; - // 进线数量 - private String inlineCount; - // 线路编号 - private String lineNumber; - // 中间接头个数 - private String jointCount; - // 出线数量 - private String outlineCount; - // 剩余通道 - private String remainingChannels; - // 柜型 - private String cabinetType; - // 连接电缆井一 - private String tieCable1; - // 连接电缆井二 - private String tieCable2; - // 套管材质 - private String casingMaterial; - // 套管规格 - private String casingSpec; - // 建设时间 - private String constructTime; - // 运检单位 - private String inspectionUnit; - // 所属区域 - private String area; - // 所属道路 - private String road; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - //标识器ID - private String markerId; - // 标识器类型 - private String markerType; - // 责任人 - private String owner; - // 标识器埋深 - private String markerDepth; - // 电子标签数量 - private String electricTagCount; - // 安装时间 - private String installedTime; - // 经度 - private String longitude; - // 纬度 - private String latitude; - // 标识器备注1 - private String markerMemo1; - // 标识器备注2 - private String markerMemo2; - // 标识器备注3 - private String markerMemo3; - // 图片路径 - private String imagePath; - - @Generated(hash = 1984568625) - public LabelBean(Long id, String markerObjType, String markerNumber, String objectName, - String voltageLevel, String transformerModel, String holeCount, String capacity, - String wellCoverMaterial, String coverDepth, String transformerSpec, - String inlineName, String size, String bottomDepth, String height, - String crossPipeLine, String inlineCount, String lineNumber, String jointCount, - String outlineCount, String remainingChannels, String cabinetType, - String tieCable1, String tieCable2, String casingMaterial, String casingSpec, - String constructTime, String inspectionUnit, String area, String road, - String memo1, String memo2, String memo3, String markerId, String markerType, - String owner, String markerDepth, String electricTagCount, String installedTime, - String longitude, String latitude, String markerMemo1, String markerMemo2, - String markerMemo3, String imagePath) { - this.id = id; - this.markerObjType = markerObjType; - this.markerNumber = markerNumber; - this.objectName = objectName; - this.voltageLevel = voltageLevel; - this.transformerModel = transformerModel; - this.holeCount = holeCount; - this.capacity = capacity; - this.wellCoverMaterial = wellCoverMaterial; - this.coverDepth = coverDepth; - this.transformerSpec = transformerSpec; - this.inlineName = inlineName; - this.size = size; - this.bottomDepth = bottomDepth; - this.height = height; - this.crossPipeLine = crossPipeLine; - this.inlineCount = inlineCount; - this.lineNumber = lineNumber; - this.jointCount = jointCount; - this.outlineCount = outlineCount; - this.remainingChannels = remainingChannels; - this.cabinetType = cabinetType; - this.tieCable1 = tieCable1; - this.tieCable2 = tieCable2; - this.casingMaterial = casingMaterial; - this.casingSpec = casingSpec; - this.constructTime = constructTime; - this.inspectionUnit = inspectionUnit; - this.area = area; - this.road = road; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - this.markerId = markerId; - this.markerType = markerType; - this.owner = owner; - this.markerDepth = markerDepth; - this.electricTagCount = electricTagCount; - this.installedTime = installedTime; - this.longitude = longitude; - this.latitude = latitude; - this.markerMemo1 = markerMemo1; - this.markerMemo2 = markerMemo2; - this.markerMemo3 = markerMemo3; - this.imagePath = imagePath; - } - - @Generated(hash = 1285554626) - public LabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerObjType() { - return this.markerObjType; - } - - public void setMarkerObjType(String markerObjType) { - this.markerObjType = markerObjType; - } - - public String getMarkerNumber() { - return this.markerNumber; - } - - public void setMarkerNumber(String markerNumber) { - this.markerNumber = markerNumber; - } - - public String getObjectName() { - return this.objectName; - } - - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getTransformerModel() { - return this.transformerModel; - } - - public void setTransformerModel(String transformerModel) { - this.transformerModel = transformerModel; - } - - public String getHoleCount() { - return this.holeCount; - } - - public void setHoleCount(String holeCount) { - this.holeCount = holeCount; - } - - public String getCapacity() { - return this.capacity; - } - - public void setCapacity(String capacity) { - this.capacity = capacity; - } - - public String getWellCoverMaterial() { - return this.wellCoverMaterial; - } - - public void setWellCoverMaterial(String wellCoverMaterial) { - this.wellCoverMaterial = wellCoverMaterial; - } - - public String getCoverDepth() { - return this.coverDepth; - } - - public void setCoverDepth(String coverDepth) { - this.coverDepth = coverDepth; - } - - public String getTransformerSpec() { - return this.transformerSpec; - } - - public void setTransformerSpec(String transformerSpec) { - this.transformerSpec = transformerSpec; - } - - public String getInlineName() { - return this.inlineName; - } - - public void setInlineName(String inlineName) { - this.inlineName = inlineName; - } - - public String getSize() { - return this.size; - } - - public void setSize(String size) { - this.size = size; - } - - public String getBottomDepth() { - return this.bottomDepth; - } - - public void setBottomDepth(String bottomDepth) { - this.bottomDepth = bottomDepth; - } - - public String getHeight() { - return this.height; - } - - public void setHeight(String height) { - this.height = height; - } - - public String getCrossPipeLine() { - return this.crossPipeLine; - } - - public void setCrossPipeLine(String crossPipeLine) { - this.crossPipeLine = crossPipeLine; - } - - public String getInlineCount() { - return this.inlineCount; - } - - public void setInlineCount(String inlineCount) { - this.inlineCount = inlineCount; - } - - public String getLineNumber() { - return this.lineNumber; - } - - public void setLineNumber(String lineNumber) { - this.lineNumber = lineNumber; - } - - public String getJointCount() { - return this.jointCount; - } - - public void setJointCount(String jointCount) { - this.jointCount = jointCount; - } - - public String getOutlineCount() { - return this.outlineCount; - } - - public void setOutlineCount(String outlineCount) { - this.outlineCount = outlineCount; - } - - public String getRemainingChannels() { - return this.remainingChannels; - } - - public void setRemainingChannels(String remainingChannels) { - this.remainingChannels = remainingChannels; - } - - public String getCabinetType() { - return this.cabinetType; - } - - public void setCabinetType(String cabinetType) { - this.cabinetType = cabinetType; - } - - public String getTieCable1() { - return this.tieCable1; - } - - public void setTieCable1(String tieCable1) { - this.tieCable1 = tieCable1; - } - - public String getTieCable2() { - return this.tieCable2; - } - - public void setTieCable2(String tieCable2) { - this.tieCable2 = tieCable2; - } - - public String getCasingMaterial() { - return this.casingMaterial; - } - - public void setCasingMaterial(String casingMaterial) { - this.casingMaterial = casingMaterial; - } - - public String getCasingSpec() { - return this.casingSpec; - } - - public void setCasingSpec(String casingSpec) { - this.casingSpec = casingSpec; - } - - public String getConstructTime() { - return this.constructTime; - } - - public void setConstructTime(String constructTime) { - this.constructTime = constructTime; - } - - public String getInspectionUnit() { - return this.inspectionUnit; - } - - public void setInspectionUnit(String inspectionUnit) { - this.inspectionUnit = inspectionUnit; - } - - public String getArea() { - return this.area; - } - - public void setArea(String area) { - this.area = area; - } - - public String getRoad() { - return this.road; - } - - public void setRoad(String road) { - this.road = road; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerType() { - return this.markerType; - } - - public void setMarkerType(String markerType) { - this.markerType = markerType; - } - - public String getOwner() { - return this.owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public String getMarkerDepth() { - return this.markerDepth; - } - - public void setMarkerDepth(String markerDepth) { - this.markerDepth = markerDepth; - } - - public String getElectricTagCount() { - return this.electricTagCount; - } - - public void setElectricTagCount(String electricTagCount) { - this.electricTagCount = electricTagCount; - } - - public String getInstalledTime() { - return this.installedTime; - } - - public void setInstalledTime(String installedTime) { - this.installedTime = installedTime; - } - - public String getLongitude() { - return this.longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getLatitude() { - return this.latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getMarkerMemo1() { - return this.markerMemo1; - } - - public void setMarkerMemo1(String markerMemo1) { - this.markerMemo1 = markerMemo1; - } - - public String getMarkerMemo2() { - return this.markerMemo2; - } - - public void setMarkerMemo2(String markerMemo2) { - this.markerMemo2 = markerMemo2; - } - - public String getMarkerMemo3() { - return this.markerMemo3; - } - - public void setMarkerMemo3(String markerMemo3) { - this.markerMemo3 = markerMemo3; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java new file mode 100644 index 0000000..50c3599 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/MarkerLocalBean.java @@ -0,0 +1,327 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 从平台下载的标识器本地库实体类 + */ +@Entity +public class MarkerLocalBean { + @Id(autoincrement = true) + private Long id;//本地库主键ID + + // 管线类型 + private String pipelineType; + // 管线直径 + private String pipelineDiameter; + // 管材 + private String pipelineMaterial; + // 埋设方式 + private String buryMethod; + // 埋深 + private String buryDepth; + // 所属区域 + private String area; + // 所属线路 + private String line; + // 所属道路 + private String road; + // 建设年代 + private String constructTime; + // 权属单位 + private String owner; + //标识对象ID,无实际用途 + @Deprecated + private String objectId; + // 标识器ID + private String markerId; + // 标识器类型 + private String markerType; + // 标识器埋深 + private String markerDepth; + // 安装部门 + private String installationDept; + // 经度 + private String lng; + // 纬度 + private String lat; + //最后修改时间,更新时间 + private String updateTime; + // 备注信息 + private String remark; + // 下层管线类型 + private String underlyingPipelineType; + // 下层埋深 + private String underlyingPipelineDepth; + // 下层管径 + private String underlyingPipelineDiameter; + // 下层管材 + private String underlyingPipelineMaterial; + //标识对象类型 + private String objectType; + // 颜色 + private String color; + // 图片路径 + private String imagePath; + + @Generated(hash = 1479045776) + public MarkerLocalBean(Long id, String pipelineType, String pipelineDiameter, + String pipelineMaterial, String buryMethod, String buryDepth, + String area, String line, String road, String constructTime, + String owner, String objectId, String markerId, String markerType, + String markerDepth, String installationDept, String lng, String lat, + String updateTime, String remark, String underlyingPipelineType, + String underlyingPipelineDepth, String underlyingPipelineDiameter, + String underlyingPipelineMaterial, String objectType, String color, + String imagePath) { + this.id = id; + this.pipelineType = pipelineType; + this.pipelineDiameter = pipelineDiameter; + this.pipelineMaterial = pipelineMaterial; + this.buryMethod = buryMethod; + this.buryDepth = buryDepth; + this.area = area; + this.line = line; + this.road = road; + this.constructTime = constructTime; + this.owner = owner; + this.objectId = objectId; + this.markerId = markerId; + this.markerType = markerType; + this.markerDepth = markerDepth; + this.installationDept = installationDept; + this.lng = lng; + this.lat = lat; + this.updateTime = updateTime; + this.remark = remark; + this.underlyingPipelineType = underlyingPipelineType; + this.underlyingPipelineDepth = underlyingPipelineDepth; + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + this.objectType = objectType; + this.color = color; + this.imagePath = imagePath; + } + + @Generated(hash = 1538606012) + public MarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPipelineType() { + return this.pipelineType; + } + + public void setPipelineType(String pipelineType) { + this.pipelineType = pipelineType; + } + + public String getPipelineDiameter() { + return this.pipelineDiameter; + } + + public void setPipelineDiameter(String pipelineDiameter) { + this.pipelineDiameter = pipelineDiameter; + } + + public String getPipelineMaterial() { + return this.pipelineMaterial; + } + + public void setPipelineMaterial(String pipelineMaterial) { + this.pipelineMaterial = pipelineMaterial; + } + + public String getBuryMethod() { + return this.buryMethod; + } + + public void setBuryMethod(String buryMethod) { + this.buryMethod = buryMethod; + } + + public String getBuryDepth() { + return this.buryDepth; + } + + public void setBuryDepth(String buryDepth) { + this.buryDepth = buryDepth; + } + + public String getArea() { + return this.area; + } + + public void setArea(String area) { + this.area = area; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getRoad() { + return this.road; + } + + public void setRoad(String road) { + this.road = road; + } + + public String getConstructTime() { + return this.constructTime; + } + + public void setConstructTime(String constructTime) { + this.constructTime = constructTime; + } + + public String getOwner() { + return this.owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getObjectId() { + return this.objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getMarkerType() { + return this.markerType; + } + + public void setMarkerType(String markerType) { + this.markerType = markerType; + } + + public String getMarkerDepth() { + return this.markerDepth; + } + + public void setMarkerDepth(String markerDepth) { + this.markerDepth = markerDepth; + } + + public String getInstallationDept() { + return this.installationDept; + } + + public void setInstallationDept(String installationDept) { + this.installationDept = installationDept; + } + + public String getLng() { + return this.lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getLat() { + return this.lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getUnderlyingPipelineType() { + return this.underlyingPipelineType; + } + + public void setUnderlyingPipelineType(String underlyingPipelineType) { + this.underlyingPipelineType = underlyingPipelineType; + } + + public String getUnderlyingPipelineDepth() { + return this.underlyingPipelineDepth; + } + + public void setUnderlyingPipelineDepth(String underlyingPipelineDepth) { + this.underlyingPipelineDepth = underlyingPipelineDepth; + } + + public String getUnderlyingPipelineDiameter() { + return this.underlyingPipelineDiameter; + } + + public void setUnderlyingPipelineDiameter(String underlyingPipelineDiameter) { + this.underlyingPipelineDiameter = underlyingPipelineDiameter; + } + + public String getUnderlyingPipelineMaterial() { + return this.underlyingPipelineMaterial; + } + + public void setUnderlyingPipelineMaterial(String underlyingPipelineMaterial) { + this.underlyingPipelineMaterial = underlyingPipelineMaterial; + } + + public String getObjectType() { + return this.objectType; + } + + public void setObjectType(String objectType) { + this.objectType = objectType; + } + + public String getColor() { + return this.color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java deleted file mode 100644 index 43ec88d..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class SmallLabelBean { - @Id(autoincrement = true) - private Long id;//主键ID - // 标识器ID号 - private String markerId; - // 位置点编号 - private String locationNumber; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String electricMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNumber; - // 所属线路 - private String line; - // 电压等级 - private String voltageLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 照片路径 - private String imagePath; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 2023477854) - public SmallLabelBean(Long id, String markerId, String locationNumber, - String locationName, String electricMarkerId, String cableName, - String cableNumber, String line, String voltageLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String imagePath, String memo1, - String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNumber = locationNumber; - this.locationName = locationName; - this.electricMarkerId = electricMarkerId; - this.cableName = cableName; - this.cableNumber = cableNumber; - this.line = line; - this.voltageLevel = voltageLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.imagePath = imagePath; - this.memo1 = memo1; - this.memo2 = memo2; - this.memo3 = memo3; - } - - @Generated(hash = 1271203389) - public SmallLabelBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getLocationNumber() { - return this.locationNumber; - } - - public void setLocationNumber(String locationNumber) { - this.locationNumber = locationNumber; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getElectricMarkerId() { - return this.electricMarkerId; - } - - public void setElectricMarkerId(String electricMarkerId) { - this.electricMarkerId = electricMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNumber() { - return this.cableNumber; - } - - public void setCableNumber(String cableNumber) { - this.cableNumber = cableNumber; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getVoltageLevel() { - return this.voltageLevel; - } - - public void setVoltageLevel(String voltageLevel) { - this.voltageLevel = voltageLevel; - } - - public String getCableType() { - return this.cableType; - } - - public void setCableType(String cableType) { - this.cableType = cableType; - } - - public String getCableSpec() { - return this.cableSpec; - } - - public void setCableSpec(String cableSpec) { - this.cableSpec = cableSpec; - } - - public String getCableBrand() { - return this.cableBrand; - } - - public void setCableBrand(String cableBrand) { - this.cableBrand = cableBrand; - } - - public String getCableStart() { - return this.cableStart; - } - - public void setCableStart(String cableStart) { - this.cableStart = cableStart; - } - - public String getCableEnd() { - return this.cableEnd; - } - - public void setCableEnd(String cableEnd) { - this.cableEnd = cableEnd; - } - - public String getHasJoint() { - return this.hasJoint; - } - - public void setHasJoint(String hasJoint) { - this.hasJoint = hasJoint; - } - - public String getJointCreator() { - return this.jointCreator; - } - - public void setJointCreator(String jointCreator) { - this.jointCreator = jointCreator; - } - - public String getImagePath() { - return this.imagePath; - } - - public void setImagePath(String imagePath) { - this.imagePath = imagePath; - } - - public String getMemo1() { - return this.memo1; - } - - public void setMemo1(String memo1) { - this.memo1 = memo1; - } - - public String getMemo2() { - return this.memo2; - } - - public void setMemo2(String memo2) { - this.memo2 = memo2; - } - - public String getMemo3() { - return this.memo3; - } - - public void setMemo3(String memo3) { - this.memo3 = memo3; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java new file mode 100644 index 0000000..f795eb0 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/SmallMarkerLocalBean.java @@ -0,0 +1,242 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +@Entity +public class SmallMarkerLocalBean { + @Id(autoincrement = true) + private Long id;//主键ID + // 标识器ID号 + private String markerId; + // 位置点编号 + private String locationNumber; + // 位置点名称 + private String locationName; + // 电子标签ID号 + private String electricMarkerId; + // 电缆名称 + private String cableName; + // 电缆编号 + private String cableNumber; + // 所属线路 + private String line; + // 电压等级 + private String voltageLevel; + // 电缆型号 + private String cableType; + // 电缆规格 + private String cableSpec; + // 电缆品牌 + private String cableBrand; + // 电缆起点 + private String cableStart; + // 电缆终点 + private String cableEnd; + // 中间接头 + private String hasJoint; + // 中间接头制作人 + private String jointCreator; + // 照片路径 + private String imagePath; + // 备注1 + private String memo1; + // 备注2 + private String memo2; + // 备注3 + private String memo3; + + @Generated(hash = 1834413106) + public SmallMarkerLocalBean(Long id, String markerId, String locationNumber, + String locationName, String electricMarkerId, String cableName, + String cableNumber, String line, String voltageLevel, String cableType, + String cableSpec, String cableBrand, String cableStart, String cableEnd, + String hasJoint, String jointCreator, String imagePath, String memo1, + String memo2, String memo3) { + this.id = id; + this.markerId = markerId; + this.locationNumber = locationNumber; + this.locationName = locationName; + this.electricMarkerId = electricMarkerId; + this.cableName = cableName; + this.cableNumber = cableNumber; + this.line = line; + this.voltageLevel = voltageLevel; + this.cableType = cableType; + this.cableSpec = cableSpec; + this.cableBrand = cableBrand; + this.cableStart = cableStart; + this.cableEnd = cableEnd; + this.hasJoint = hasJoint; + this.jointCreator = jointCreator; + this.imagePath = imagePath; + this.memo1 = memo1; + this.memo2 = memo2; + this.memo3 = memo3; + } + + @Generated(hash = 427136067) + public SmallMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLocationName() { + return this.locationName; + } + + public void setLocationName(String locationName) { + this.locationName = locationName; + } + + public String getElectricMarkerId() { + return this.electricMarkerId; + } + + public void setElectricMarkerId(String electricMarkerId) { + this.electricMarkerId = electricMarkerId; + } + + public String getCableName() { + return this.cableName; + } + + public void setCableName(String cableName) { + this.cableName = cableName; + } + + public String getCableNumber() { + return this.cableNumber; + } + + public void setCableNumber(String cableNumber) { + this.cableNumber = cableNumber; + } + + public String getLine() { + return this.line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getVoltageLevel() { + return this.voltageLevel; + } + + public void setVoltageLevel(String voltageLevel) { + this.voltageLevel = voltageLevel; + } + + public String getCableType() { + return this.cableType; + } + + public void setCableType(String cableType) { + this.cableType = cableType; + } + + public String getCableSpec() { + return this.cableSpec; + } + + public void setCableSpec(String cableSpec) { + this.cableSpec = cableSpec; + } + + public String getCableBrand() { + return this.cableBrand; + } + + public void setCableBrand(String cableBrand) { + this.cableBrand = cableBrand; + } + + public String getCableStart() { + return this.cableStart; + } + + public void setCableStart(String cableStart) { + this.cableStart = cableStart; + } + + public String getCableEnd() { + return this.cableEnd; + } + + public void setCableEnd(String cableEnd) { + this.cableEnd = cableEnd; + } + + public String getHasJoint() { + return this.hasJoint; + } + + public void setHasJoint(String hasJoint) { + this.hasJoint = hasJoint; + } + + public String getJointCreator() { + return this.jointCreator; + } + + public void setJointCreator(String jointCreator) { + this.jointCreator = jointCreator; + } + + public String getImagePath() { + return this.imagePath; + } + + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + public String getMemo1() { + return this.memo1; + } + + public void setMemo1(String memo1) { + this.memo1 = memo1; + } + + public String getMemo2() { + return this.memo2; + } + + public void setMemo2(String memo2) { + this.memo2 = memo2; + } + + public String getMemo3() { + return this.memo3; + } + + public void setMemo3(String memo3) { + this.memo3 = memo3; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java deleted file mode 100644 index feb0c76..0000000 --- a/app/src/main/java/com/casic/electric/detector/bean/TaskBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.casic.electric.detector.bean; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -@Entity -public class TaskBean { - @Id(autoincrement = true) - private Long id;//主键ID - - private String taskId; - private String taskCode; - private String markerId; - private String markerRealId; - private String scanner; - private String lng; - private String lat; - private String state; - private String desc; - - @Generated(hash = 1918598433) - public TaskBean(Long id, String taskId, String taskCode, String markerId, - String markerRealId, String scanner, String lng, String lat, - String state, String desc) { - this.id = id; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.scanner = scanner; - this.lng = lng; - this.lat = lat; - this.state = state; - this.desc = desc; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTaskId() { - return this.taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getTaskCode() { - return this.taskCode; - } - - public void setTaskCode(String taskCode) { - this.taskCode = taskCode; - } - - public String getMarkerId() { - return this.markerId; - } - - public void setMarkerId(String markerId) { - this.markerId = markerId; - } - - public String getMarkerRealId() { - return this.markerRealId; - } - - public void setMarkerRealId(String markerRealId) { - this.markerRealId = markerRealId; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getLng() { - return this.lng; - } - - public void setLng(String lng) { - this.lng = lng; - } - - public String getLat() { - return this.lat; - } - - public void setLat(String lat) { - this.lat = lat; - } - - public String getState() { - return this.state; - } - - public void setState(String state) { - this.state = state; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } -} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..3c02119 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskLocalBean.java @@ -0,0 +1,114 @@ +package com.casic.electric.detector.bean; + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务本地库实体类,不包含任务里面需要巡检的标识器信息 + */ +@Entity +public class TaskLocalBean { + @Id + private Long id;//任务ID + + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + + @Generated(hash = 1482022528) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime, String isFreeTask) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + this.isFreeTask = isFreeTask; + } + + @Generated(hash = 949704588) + public TaskLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return this.createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return this.createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return this.startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return this.endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return this.isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..66353e2 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,127 @@ +package com.casic.electric.detector.bean; + + +import org.greenrobot.greendao.annotation.Entity; +import org.greenrobot.greendao.annotation.Generated; +import org.greenrobot.greendao.annotation.Id; + +/** + * 巡检任务里面需要巡检的标识器信息本地库实体类 + */ +@Entity +public class TaskMarkerLocalBean { + @Id + private Long id;//标识器后台库的主键ID,不是标识器实际ID + + /** + * 任务ID,通过此字段关联{@link TaskLocalBean#id} + */ + private String taskId; + + /** + * 任务Code,通过此字段关联{@link TaskLocalBean#taskCode} + *

+ * 双重验证,防止出现同时刻重复的情况 + */ + private String taskCode; + + /** + * 对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#markerIdReal},也就是探测仪扫描出来的ID + */ + private String markerId; + + private double lng; + private double lat; + + /** + * 是否已被探测到 + * 1-是,0-否 + */ + private String isDetected; + + /** + * 被探测到的时间,对应后台字段{@link TaskModel.MessageModel.TaskDetailInfosModel#finishTime} + */ + private String detectedTime; + + @Generated(hash = 677328533) + public TaskMarkerLocalBean(Long id, String taskId, String taskCode, String markerId, + double lng, double lat, String isDetected, String detectedTime) { + this.id = id; + this.taskId = taskId; + this.taskCode = taskCode; + this.markerId = markerId; + this.lng = lng; + this.lat = lat; + this.isDetected = isDetected; + this.detectedTime = detectedTime; + } + + @Generated(hash = 1162404642) + public TaskMarkerLocalBean() { + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTaskId() { + return this.taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return this.taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getMarkerId() { + return this.markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return this.lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return this.lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return this.isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return this.detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } +} diff --git a/app/src/main/java/com/casic/electric/detector/extensions/Long.kt b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt new file mode 100644 index 0000000..e721898 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/extensions/Long.kt @@ -0,0 +1,10 @@ +package com.casic.electric.detector.extensions + +import java.text.SimpleDateFormat +import java.util.Date +import java.util.Locale + +fun Long.createTaskCode(): String { + val dateFormat = SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA) + return dateFormat.format(Date(this)) +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java index 71db201..a74f8c9 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoMaster.java @@ -21,16 +21,18 @@ /** Creates underlying database table using DAOs. */ public static void createAllTables(Database db, boolean ifNotExists) { - LabelBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + MarkerLocalBeanDao.createTable(db, ifNotExists); + SmallMarkerLocalBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** Drops underlying database table using DAOs. */ public static void dropAllTables(Database db, boolean ifExists) { - LabelBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + MarkerLocalBeanDao.dropTable(db, ifExists); + SmallMarkerLocalBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -49,9 +51,10 @@ public DaoMaster(Database db) { super(db, SCHEMA_VERSION); - registerDaoClass(LabelBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(MarkerLocalBeanDao.class); + registerDaoClass(SmallMarkerLocalBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java index 564a552..6868224 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/DaoSession.java @@ -1,8 +1,9 @@ package com.casic.electric.detector.greendao; -import com.casic.electric.detector.bean.LabelBean; -import com.casic.electric.detector.bean.SmallLabelBean; -import com.casic.electric.detector.bean.TaskBean; +import com.casic.electric.detector.bean.MarkerLocalBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; +import com.casic.electric.detector.bean.TaskLocalBean; +import com.casic.electric.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -21,52 +22,64 @@ */ public class DaoSession extends AbstractDaoSession { - private final DaoConfig labelBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig markerLocalBeanDaoConfig; + private final DaoConfig smallMarkerLocalBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; - private final LabelBeanDao labelBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final MarkerLocalBeanDao markerLocalBeanDao; + private final SmallMarkerLocalBeanDao smallMarkerLocalBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { super(db); - labelBeanDaoConfig = daoConfigMap.get(LabelBeanDao.class).clone(); - labelBeanDaoConfig.initIdentityScope(type); + markerLocalBeanDaoConfig = daoConfigMap.get(MarkerLocalBeanDao.class).clone(); + markerLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + smallMarkerLocalBeanDaoConfig = daoConfigMap.get(SmallMarkerLocalBeanDao.class).clone(); + smallMarkerLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); - registerDao(LabelBean.class, labelBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + markerLocalBeanDao = new MarkerLocalBeanDao(markerLocalBeanDaoConfig, this); + smallMarkerLocalBeanDao = new SmallMarkerLocalBeanDao(smallMarkerLocalBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); + + registerDao(MarkerLocalBean.class, markerLocalBeanDao); + registerDao(SmallMarkerLocalBean.class, smallMarkerLocalBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { - labelBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + markerLocalBeanDaoConfig.clearIdentityScope(); + smallMarkerLocalBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } - public LabelBeanDao getLabelBeanDao() { - return labelBeanDao; + public MarkerLocalBeanDao getMarkerLocalBeanDao() { + return markerLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public SmallMarkerLocalBeanDao getSmallMarkerLocalBeanDao() { + return smallMarkerLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; + } + + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java deleted file mode 100644 index 0afe589..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/LabelBeanDao.java +++ /dev/null @@ -1,731 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.LabelBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "LABEL_BEAN". -*/ -public class LabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "LABEL_BEAN"; - - /** - * Properties of entity LabelBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property MarkerObjType = new Property(1, String.class, "markerObjType", false, "MARKER_OBJ_TYPE"); - public final static Property MarkerNumber = new Property(2, String.class, "markerNumber", false, "MARKER_NUMBER"); - public final static Property ObjectName = new Property(3, String.class, "objectName", false, "OBJECT_NAME"); - public final static Property VoltageLevel = new Property(4, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); - public final static Property TransformerModel = new Property(5, String.class, "transformerModel", false, "TRANSFORMER_MODEL"); - public final static Property HoleCount = new Property(6, String.class, "holeCount", false, "HOLE_COUNT"); - public final static Property Capacity = new Property(7, String.class, "capacity", false, "CAPACITY"); - public final static Property WellCoverMaterial = new Property(8, String.class, "wellCoverMaterial", false, "WELL_COVER_MATERIAL"); - public final static Property CoverDepth = new Property(9, String.class, "coverDepth", false, "COVER_DEPTH"); - public final static Property TransformerSpec = new Property(10, String.class, "transformerSpec", false, "TRANSFORMER_SPEC"); - public final static Property InlineName = new Property(11, String.class, "inlineName", false, "INLINE_NAME"); - public final static Property Size = new Property(12, String.class, "size", false, "SIZE"); - public final static Property BottomDepth = new Property(13, String.class, "bottomDepth", false, "BOTTOM_DEPTH"); - public final static Property Height = new Property(14, String.class, "height", false, "HEIGHT"); - public final static Property CrossPipeLine = new Property(15, String.class, "crossPipeLine", false, "CROSS_PIPE_LINE"); - public final static Property InlineCount = new Property(16, String.class, "inlineCount", false, "INLINE_COUNT"); - public final static Property LineNumber = new Property(17, String.class, "lineNumber", false, "LINE_NUMBER"); - public final static Property JointCount = new Property(18, String.class, "jointCount", false, "JOINT_COUNT"); - public final static Property OutlineCount = new Property(19, String.class, "outlineCount", false, "OUTLINE_COUNT"); - public final static Property RemainingChannels = new Property(20, String.class, "remainingChannels", false, "REMAINING_CHANNELS"); - public final static Property CabinetType = new Property(21, String.class, "cabinetType", false, "CABINET_TYPE"); - public final static Property TieCable1 = new Property(22, String.class, "tieCable1", false, "TIE_CABLE1"); - public final static Property TieCable2 = new Property(23, String.class, "tieCable2", false, "TIE_CABLE2"); - public final static Property CasingMaterial = new Property(24, String.class, "casingMaterial", false, "CASING_MATERIAL"); - public final static Property CasingSpec = new Property(25, String.class, "casingSpec", false, "CASING_SPEC"); - public final static Property ConstructTime = new Property(26, String.class, "constructTime", false, "CONSTRUCT_TIME"); - public final static Property InspectionUnit = new Property(27, String.class, "inspectionUnit", false, "INSPECTION_UNIT"); - public final static Property Area = new Property(28, String.class, "area", false, "AREA"); - public final static Property Road = new Property(29, String.class, "road", false, "ROAD"); - public final static Property Memo1 = new Property(30, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(31, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(32, String.class, "memo3", false, "MEMO3"); - public final static Property MarkerId = new Property(33, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerType = new Property(34, String.class, "markerType", false, "MARKER_TYPE"); - public final static Property Owner = new Property(35, String.class, "owner", false, "OWNER"); - public final static Property MarkerDepth = new Property(36, String.class, "markerDepth", false, "MARKER_DEPTH"); - public final static Property ElectricTagCount = new Property(37, String.class, "electricTagCount", false, "ELECTRIC_TAG_COUNT"); - public final static Property InstalledTime = new Property(38, String.class, "installedTime", false, "INSTALLED_TIME"); - public final static Property Longitude = new Property(39, String.class, "longitude", false, "LONGITUDE"); - public final static Property Latitude = new Property(40, String.class, "latitude", false, "LATITUDE"); - public final static Property MarkerMemo1 = new Property(41, String.class, "markerMemo1", false, "MARKER_MEMO1"); - public final static Property MarkerMemo2 = new Property(42, String.class, "markerMemo2", false, "MARKER_MEMO2"); - public final static Property MarkerMemo3 = new Property(43, String.class, "markerMemo3", false, "MARKER_MEMO3"); - public final static Property ImagePath = new Property(44, String.class, "imagePath", false, "IMAGE_PATH"); - } - - - public LabelBeanDao(DaoConfig config) { - super(config); - } - - public LabelBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_OBJ_TYPE\" TEXT," + // 1: markerObjType - "\"MARKER_NUMBER\" TEXT," + // 2: markerNumber - "\"OBJECT_NAME\" TEXT," + // 3: objectName - "\"VOLTAGE_LEVEL\" TEXT," + // 4: voltageLevel - "\"TRANSFORMER_MODEL\" TEXT," + // 5: transformerModel - "\"HOLE_COUNT\" TEXT," + // 6: holeCount - "\"CAPACITY\" TEXT," + // 7: capacity - "\"WELL_COVER_MATERIAL\" TEXT," + // 8: wellCoverMaterial - "\"COVER_DEPTH\" TEXT," + // 9: coverDepth - "\"TRANSFORMER_SPEC\" TEXT," + // 10: transformerSpec - "\"INLINE_NAME\" TEXT," + // 11: inlineName - "\"SIZE\" TEXT," + // 12: size - "\"BOTTOM_DEPTH\" TEXT," + // 13: bottomDepth - "\"HEIGHT\" TEXT," + // 14: height - "\"CROSS_PIPE_LINE\" TEXT," + // 15: crossPipeLine - "\"INLINE_COUNT\" TEXT," + // 16: inlineCount - "\"LINE_NUMBER\" TEXT," + // 17: lineNumber - "\"JOINT_COUNT\" TEXT," + // 18: jointCount - "\"OUTLINE_COUNT\" TEXT," + // 19: outlineCount - "\"REMAINING_CHANNELS\" TEXT," + // 20: remainingChannels - "\"CABINET_TYPE\" TEXT," + // 21: cabinetType - "\"TIE_CABLE1\" TEXT," + // 22: tieCable1 - "\"TIE_CABLE2\" TEXT," + // 23: tieCable2 - "\"CASING_MATERIAL\" TEXT," + // 24: casingMaterial - "\"CASING_SPEC\" TEXT," + // 25: casingSpec - "\"CONSTRUCT_TIME\" TEXT," + // 26: constructTime - "\"INSPECTION_UNIT\" TEXT," + // 27: inspectionUnit - "\"AREA\" TEXT," + // 28: area - "\"ROAD\" TEXT," + // 29: road - "\"MEMO1\" TEXT," + // 30: memo1 - "\"MEMO2\" TEXT," + // 31: memo2 - "\"MEMO3\" TEXT," + // 32: memo3 - "\"MARKER_ID\" TEXT," + // 33: markerId - "\"MARKER_TYPE\" TEXT," + // 34: markerType - "\"OWNER\" TEXT," + // 35: owner - "\"MARKER_DEPTH\" TEXT," + // 36: markerDepth - "\"ELECTRIC_TAG_COUNT\" TEXT," + // 37: electricTagCount - "\"INSTALLED_TIME\" TEXT," + // 38: installedTime - "\"LONGITUDE\" TEXT," + // 39: longitude - "\"LATITUDE\" TEXT," + // 40: latitude - "\"MARKER_MEMO1\" TEXT," + // 41: markerMemo1 - "\"MARKER_MEMO2\" TEXT," + // 42: markerMemo2 - "\"MARKER_MEMO3\" TEXT," + // 43: markerMemo3 - "\"IMAGE_PATH\" TEXT);"); // 44: imagePath - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LABEL_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, LabelBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String markerObjType = entity.getMarkerObjType(); - if (markerObjType != null) { - stmt.bindString(2, markerObjType); - } - - String markerNumber = entity.getMarkerNumber(); - if (markerNumber != null) { - stmt.bindString(3, markerNumber); - } - - String objectName = entity.getObjectName(); - if (objectName != null) { - stmt.bindString(4, objectName); - } - - String voltageLevel = entity.getVoltageLevel(); - if (voltageLevel != null) { - stmt.bindString(5, voltageLevel); - } - - String transformerModel = entity.getTransformerModel(); - if (transformerModel != null) { - stmt.bindString(6, transformerModel); - } - - String holeCount = entity.getHoleCount(); - if (holeCount != null) { - stmt.bindString(7, holeCount); - } - - String capacity = entity.getCapacity(); - if (capacity != null) { - stmt.bindString(8, capacity); - } - - String wellCoverMaterial = entity.getWellCoverMaterial(); - if (wellCoverMaterial != null) { - stmt.bindString(9, wellCoverMaterial); - } - - String coverDepth = entity.getCoverDepth(); - if (coverDepth != null) { - stmt.bindString(10, coverDepth); - } - - String transformerSpec = entity.getTransformerSpec(); - if (transformerSpec != null) { - stmt.bindString(11, transformerSpec); - } - - String inlineName = entity.getInlineName(); - if (inlineName != null) { - stmt.bindString(12, inlineName); - } - - String size = entity.getSize(); - if (size != null) { - stmt.bindString(13, size); - } - - String bottomDepth = entity.getBottomDepth(); - if (bottomDepth != null) { - stmt.bindString(14, bottomDepth); - } - - String height = entity.getHeight(); - if (height != null) { - stmt.bindString(15, height); - } - - String crossPipeLine = entity.getCrossPipeLine(); - if (crossPipeLine != null) { - stmt.bindString(16, crossPipeLine); - } - - String inlineCount = entity.getInlineCount(); - if (inlineCount != null) { - stmt.bindString(17, inlineCount); - } - - String lineNumber = entity.getLineNumber(); - if (lineNumber != null) { - stmt.bindString(18, lineNumber); - } - - String jointCount = entity.getJointCount(); - if (jointCount != null) { - stmt.bindString(19, jointCount); - } - - String outlineCount = entity.getOutlineCount(); - if (outlineCount != null) { - stmt.bindString(20, outlineCount); - } - - String remainingChannels = entity.getRemainingChannels(); - if (remainingChannels != null) { - stmt.bindString(21, remainingChannels); - } - - String cabinetType = entity.getCabinetType(); - if (cabinetType != null) { - stmt.bindString(22, cabinetType); - } - - String tieCable1 = entity.getTieCable1(); - if (tieCable1 != null) { - stmt.bindString(23, tieCable1); - } - - String tieCable2 = entity.getTieCable2(); - if (tieCable2 != null) { - stmt.bindString(24, tieCable2); - } - - String casingMaterial = entity.getCasingMaterial(); - if (casingMaterial != null) { - stmt.bindString(25, casingMaterial); - } - - String casingSpec = entity.getCasingSpec(); - if (casingSpec != null) { - stmt.bindString(26, casingSpec); - } - - String constructTime = entity.getConstructTime(); - if (constructTime != null) { - stmt.bindString(27, constructTime); - } - - String inspectionUnit = entity.getInspectionUnit(); - if (inspectionUnit != null) { - stmt.bindString(28, inspectionUnit); - } - - String area = entity.getArea(); - if (area != null) { - stmt.bindString(29, area); - } - - String road = entity.getRoad(); - if (road != null) { - stmt.bindString(30, road); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(31, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(32, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(33, memo3); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(34, markerId); - } - - String markerType = entity.getMarkerType(); - if (markerType != null) { - stmt.bindString(35, markerType); - } - - String owner = entity.getOwner(); - if (owner != null) { - stmt.bindString(36, owner); - } - - String markerDepth = entity.getMarkerDepth(); - if (markerDepth != null) { - stmt.bindString(37, markerDepth); - } - - String electricTagCount = entity.getElectricTagCount(); - if (electricTagCount != null) { - stmt.bindString(38, electricTagCount); - } - - String installedTime = entity.getInstalledTime(); - if (installedTime != null) { - stmt.bindString(39, installedTime); - } - - String longitude = entity.getLongitude(); - if (longitude != null) { - stmt.bindString(40, longitude); - } - - String latitude = entity.getLatitude(); - if (latitude != null) { - stmt.bindString(41, latitude); - } - - String markerMemo1 = entity.getMarkerMemo1(); - if (markerMemo1 != null) { - stmt.bindString(42, markerMemo1); - } - - String markerMemo2 = entity.getMarkerMemo2(); - if (markerMemo2 != null) { - stmt.bindString(43, markerMemo2); - } - - String markerMemo3 = entity.getMarkerMemo3(); - if (markerMemo3 != null) { - stmt.bindString(44, markerMemo3); - } - - String imagePath = entity.getImagePath(); - if (imagePath != null) { - stmt.bindString(45, imagePath); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public LabelBean readEntity(Cursor cursor, int offset) { - LabelBean entity = new LabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerObjType - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // markerNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // objectName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // voltageLevel - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // transformerModel - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // holeCount - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // capacity - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // wellCoverMaterial - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // coverDepth - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // transformerSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // inlineName - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // size - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // bottomDepth - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // height - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // crossPipeLine - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // inlineCount - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lineNumber - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // jointCount - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // outlineCount - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // remainingChannels - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // cabinetType - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // tieCable1 - cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // tieCable2 - cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // casingMaterial - cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // casingSpec - cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // constructTime - cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // inspectionUnit - cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // area - cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // road - cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // memo1 - cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // memo2 - cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // memo3 - cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // markerId - cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // markerType - cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35), // owner - cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36), // markerDepth - cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37), // electricTagCount - cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38), // installedTime - cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39), // longitude - cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40), // latitude - cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41), // markerMemo1 - cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42), // markerMemo2 - cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43), // markerMemo3 - cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44) // imagePath - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, LabelBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setMarkerObjType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setMarkerNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setObjectName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setVoltageLevel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setTransformerModel(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setHoleCount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setCapacity(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setWellCoverMaterial(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setCoverDepth(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - entity.setTransformerSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); - entity.setInlineName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); - entity.setSize(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); - entity.setBottomDepth(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); - entity.setHeight(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); - entity.setCrossPipeLine(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); - entity.setInlineCount(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setLineNumber(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setJointCount(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setOutlineCount(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setRemainingChannels(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - entity.setCabinetType(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); - entity.setTieCable1(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); - entity.setTieCable2(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); - entity.setCasingMaterial(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); - entity.setCasingSpec(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); - entity.setConstructTime(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); - entity.setInspectionUnit(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27)); - entity.setArea(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28)); - entity.setRoad(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29)); - entity.setMemo1(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30)); - entity.setMemo2(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31)); - entity.setMemo3(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32)); - entity.setMarkerId(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33)); - entity.setMarkerType(cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34)); - entity.setOwner(cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35)); - entity.setMarkerDepth(cursor.isNull(offset + 36) ? null : cursor.getString(offset + 36)); - entity.setElectricTagCount(cursor.isNull(offset + 37) ? null : cursor.getString(offset + 37)); - entity.setInstalledTime(cursor.isNull(offset + 38) ? null : cursor.getString(offset + 38)); - entity.setLongitude(cursor.isNull(offset + 39) ? null : cursor.getString(offset + 39)); - entity.setLatitude(cursor.isNull(offset + 40) ? null : cursor.getString(offset + 40)); - entity.setMarkerMemo1(cursor.isNull(offset + 41) ? null : cursor.getString(offset + 41)); - entity.setMarkerMemo2(cursor.isNull(offset + 42) ? null : cursor.getString(offset + 42)); - entity.setMarkerMemo3(cursor.isNull(offset + 43) ? null : cursor.getString(offset + 43)); - entity.setImagePath(cursor.isNull(offset + 44) ? null : cursor.getString(offset + 44)); - } - - @Override - protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(LabelBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(LabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java new file mode 100644 index 0000000..9f2afa5 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/MarkerLocalBeanDao.java @@ -0,0 +1,479 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.MarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "MARKER_LOCAL_BEAN". +*/ +public class MarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "MARKER_LOCAL_BEAN"; + + /** + * Properties of entity MarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property PipelineType = new Property(1, String.class, "pipelineType", false, "PIPELINE_TYPE"); + public final static Property PipelineDiameter = new Property(2, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER"); + public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL"); + public final static Property BuryMethod = new Property(4, String.class, "buryMethod", false, "BURY_METHOD"); + public final static Property BuryDepth = new Property(5, String.class, "buryDepth", false, "BURY_DEPTH"); + public final static Property Area = new Property(6, String.class, "area", false, "AREA"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property Road = new Property(8, String.class, "road", false, "ROAD"); + public final static Property ConstructTime = new Property(9, String.class, "constructTime", false, "CONSTRUCT_TIME"); + public final static Property Owner = new Property(10, String.class, "owner", false, "OWNER"); + public final static Property ObjectId = new Property(11, String.class, "objectId", false, "OBJECT_ID"); + public final static Property MarkerId = new Property(12, String.class, "markerId", false, "MARKER_ID"); + public final static Property MarkerType = new Property(13, String.class, "markerType", false, "MARKER_TYPE"); + public final static Property MarkerDepth = new Property(14, String.class, "markerDepth", false, "MARKER_DEPTH"); + public final static Property InstallationDept = new Property(15, String.class, "installationDept", false, "INSTALLATION_DEPT"); + public final static Property Lng = new Property(16, String.class, "lng", false, "LNG"); + public final static Property Lat = new Property(17, String.class, "lat", false, "LAT"); + public final static Property UpdateTime = new Property(18, String.class, "updateTime", false, "UPDATE_TIME"); + public final static Property Remark = new Property(19, String.class, "remark", false, "REMARK"); + public final static Property UnderlyingPipelineType = new Property(20, String.class, "underlyingPipelineType", false, "UNDERLYING_PIPELINE_TYPE"); + public final static Property UnderlyingPipelineDepth = new Property(21, String.class, "underlyingPipelineDepth", false, "UNDERLYING_PIPELINE_DEPTH"); + public final static Property UnderlyingPipelineDiameter = new Property(22, String.class, "underlyingPipelineDiameter", false, "UNDERLYING_PIPELINE_DIAMETER"); + public final static Property UnderlyingPipelineMaterial = new Property(23, String.class, "underlyingPipelineMaterial", false, "UNDERLYING_PIPELINE_MATERIAL"); + public final static Property ObjectType = new Property(24, String.class, "objectType", false, "OBJECT_TYPE"); + public final static Property Color = new Property(25, String.class, "color", false, "COLOR"); + public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH"); + } + + + public MarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public MarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"PIPELINE_TYPE\" TEXT," + // 1: pipelineType + "\"PIPELINE_DIAMETER\" TEXT," + // 2: pipelineDiameter + "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial + "\"BURY_METHOD\" TEXT," + // 4: buryMethod + "\"BURY_DEPTH\" TEXT," + // 5: buryDepth + "\"AREA\" TEXT," + // 6: area + "\"LINE\" TEXT," + // 7: line + "\"ROAD\" TEXT," + // 8: road + "\"CONSTRUCT_TIME\" TEXT," + // 9: constructTime + "\"OWNER\" TEXT," + // 10: owner + "\"OBJECT_ID\" TEXT," + // 11: objectId + "\"MARKER_ID\" TEXT," + // 12: markerId + "\"MARKER_TYPE\" TEXT," + // 13: markerType + "\"MARKER_DEPTH\" TEXT," + // 14: markerDepth + "\"INSTALLATION_DEPT\" TEXT," + // 15: installationDept + "\"LNG\" TEXT," + // 16: lng + "\"LAT\" TEXT," + // 17: lat + "\"UPDATE_TIME\" TEXT," + // 18: updateTime + "\"REMARK\" TEXT," + // 19: remark + "\"UNDERLYING_PIPELINE_TYPE\" TEXT," + // 20: underlyingPipelineType + "\"UNDERLYING_PIPELINE_DEPTH\" TEXT," + // 21: underlyingPipelineDepth + "\"UNDERLYING_PIPELINE_DIAMETER\" TEXT," + // 22: underlyingPipelineDiameter + "\"UNDERLYING_PIPELINE_MATERIAL\" TEXT," + // 23: underlyingPipelineMaterial + "\"OBJECT_TYPE\" TEXT," + // 24: objectType + "\"COLOR\" TEXT," + // 25: color + "\"IMAGE_PATH\" TEXT);"); // 26: imagePath + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, MarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String pipelineType = entity.getPipelineType(); + if (pipelineType != null) { + stmt.bindString(2, pipelineType); + } + + String pipelineDiameter = entity.getPipelineDiameter(); + if (pipelineDiameter != null) { + stmt.bindString(3, pipelineDiameter); + } + + String pipelineMaterial = entity.getPipelineMaterial(); + if (pipelineMaterial != null) { + stmt.bindString(4, pipelineMaterial); + } + + String buryMethod = entity.getBuryMethod(); + if (buryMethod != null) { + stmt.bindString(5, buryMethod); + } + + String buryDepth = entity.getBuryDepth(); + if (buryDepth != null) { + stmt.bindString(6, buryDepth); + } + + String area = entity.getArea(); + if (area != null) { + stmt.bindString(7, area); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String road = entity.getRoad(); + if (road != null) { + stmt.bindString(9, road); + } + + String constructTime = entity.getConstructTime(); + if (constructTime != null) { + stmt.bindString(10, constructTime); + } + + String owner = entity.getOwner(); + if (owner != null) { + stmt.bindString(11, owner); + } + + String objectId = entity.getObjectId(); + if (objectId != null) { + stmt.bindString(12, objectId); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(13, markerId); + } + + String markerType = entity.getMarkerType(); + if (markerType != null) { + stmt.bindString(14, markerType); + } + + String markerDepth = entity.getMarkerDepth(); + if (markerDepth != null) { + stmt.bindString(15, markerDepth); + } + + String installationDept = entity.getInstallationDept(); + if (installationDept != null) { + stmt.bindString(16, installationDept); + } + + String lng = entity.getLng(); + if (lng != null) { + stmt.bindString(17, lng); + } + + String lat = entity.getLat(); + if (lat != null) { + stmt.bindString(18, lat); + } + + String updateTime = entity.getUpdateTime(); + if (updateTime != null) { + stmt.bindString(19, updateTime); + } + + String remark = entity.getRemark(); + if (remark != null) { + stmt.bindString(20, remark); + } + + String underlyingPipelineType = entity.getUnderlyingPipelineType(); + if (underlyingPipelineType != null) { + stmt.bindString(21, underlyingPipelineType); + } + + String underlyingPipelineDepth = entity.getUnderlyingPipelineDepth(); + if (underlyingPipelineDepth != null) { + stmt.bindString(22, underlyingPipelineDepth); + } + + String underlyingPipelineDiameter = entity.getUnderlyingPipelineDiameter(); + if (underlyingPipelineDiameter != null) { + stmt.bindString(23, underlyingPipelineDiameter); + } + + String underlyingPipelineMaterial = entity.getUnderlyingPipelineMaterial(); + if (underlyingPipelineMaterial != null) { + stmt.bindString(24, underlyingPipelineMaterial); + } + + String objectType = entity.getObjectType(); + if (objectType != null) { + stmt.bindString(25, objectType); + } + + String color = entity.getColor(); + if (color != null) { + stmt.bindString(26, color); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(27, imagePath); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public MarkerLocalBean readEntity(Cursor cursor, int offset) { + MarkerLocalBean entity = new MarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // pipelineType + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineDiameter + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // buryMethod + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDepth + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // area + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // road + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // constructTime + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // owner + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // objectId + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // markerId + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // markerType + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // markerDepth + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // installationDept + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // lng + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lat + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // updateTime + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // remark + cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // underlyingPipelineType + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // underlyingPipelineDepth + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // underlyingPipelineDiameter + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // underlyingPipelineMaterial + cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // objectType + cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // color + cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, MarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setPipelineType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setPipelineDiameter(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setBuryMethod(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setBuryDepth(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setArea(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setRoad(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setConstructTime(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setOwner(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setObjectId(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setMarkerId(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setMarkerType(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setMarkerDepth(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setInstallationDept(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setLng(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setLat(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setUpdateTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setRemark(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + entity.setUnderlyingPipelineType(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); + entity.setUnderlyingPipelineDepth(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); + entity.setUnderlyingPipelineDiameter(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); + entity.setUnderlyingPipelineMaterial(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); + entity.setObjectType(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24)); + entity.setColor(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25)); + entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26)); + } + + @Override + protected final Long updateKeyAfterInsert(MarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(MarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(MarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java index 18b1b7b..9d99b8d 100644 --- a/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallLabelBeanDao.java @@ -3,7 +3,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import com.casic.electric.detector.bean.SmallLabelBean; +import com.casic.electric.detector.bean.SmallMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; @@ -12,10 +12,11 @@ import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** + +/** * DAO for table "SMALL_LABEL_BEAN". -*/ -public class SmallLabelBeanDao extends AbstractDao { + */ +public class SmallLabelBeanDao extends AbstractDao { public static final String TABLENAME = "SMALL_LABEL_BEAN"; @@ -50,14 +51,16 @@ public SmallLabelBeanDao(DaoConfig config) { super(config); } - + public SmallLabelBeanDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } - /** Creates the underlying database table. */ + /** + * Creates the underlying database table. + */ public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; + String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"SMALL_LABEL_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MARKER_ID\" TEXT," + // 1: markerId @@ -81,111 +84,113 @@ "\"MEMO3\" TEXT);"); // 19: memo3 } - /** Drops the underlying database table. */ + /** + * Drops the underlying database table. + */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_LABEL_BEAN\""; db.execSQL(sql); } @Override - protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) { + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -193,104 +198,104 @@ } @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) { + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { stmt.clearBindings(); - + Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } - + String markerId = entity.getMarkerId(); if (markerId != null) { stmt.bindString(2, markerId); } - + String locationNumber = entity.getLocationNumber(); if (locationNumber != null) { stmt.bindString(3, locationNumber); } - + String locationName = entity.getLocationName(); if (locationName != null) { stmt.bindString(4, locationName); } - + String electricMarkerId = entity.getElectricMarkerId(); if (electricMarkerId != null) { stmt.bindString(5, electricMarkerId); } - + String cableName = entity.getCableName(); if (cableName != null) { stmt.bindString(6, cableName); } - + String cableNumber = entity.getCableNumber(); if (cableNumber != null) { stmt.bindString(7, cableNumber); } - + String line = entity.getLine(); if (line != null) { stmt.bindString(8, line); } - + String voltageLevel = entity.getVoltageLevel(); if (voltageLevel != null) { stmt.bindString(9, voltageLevel); } - + String cableType = entity.getCableType(); if (cableType != null) { stmt.bindString(10, cableType); } - + String cableSpec = entity.getCableSpec(); if (cableSpec != null) { stmt.bindString(11, cableSpec); } - + String cableBrand = entity.getCableBrand(); if (cableBrand != null) { stmt.bindString(12, cableBrand); } - + String cableStart = entity.getCableStart(); if (cableStart != null) { stmt.bindString(13, cableStart); } - + String cableEnd = entity.getCableEnd(); if (cableEnd != null) { stmt.bindString(14, cableEnd); } - + String hasJoint = entity.getHasJoint(); if (hasJoint != null) { stmt.bindString(15, hasJoint); } - + String jointCreator = entity.getJointCreator(); if (jointCreator != null) { stmt.bindString(16, jointCreator); } - + String imagePath = entity.getImagePath(); if (imagePath != null) { stmt.bindString(17, imagePath); } - + String memo1 = entity.getMemo1(); if (memo1 != null) { stmt.bindString(18, memo1); } - + String memo2 = entity.getMemo2(); if (memo2 != null) { stmt.bindString(19, memo2); } - + String memo3 = entity.getMemo3(); if (memo3 != null) { stmt.bindString(20, memo3); @@ -300,37 +305,37 @@ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } + } @Override - public SmallLabelBean readEntity(Cursor cursor, int offset) { - SmallLabelBean entity = new SmallLabelBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType - cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec - cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand - cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart - cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd - cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint - cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator - cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 ); return entity; } - + @Override - public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) { + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); @@ -351,17 +356,17 @@ entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - } - + } + @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { entity.setId(rowId); return rowId; } - + @Override - public Long getKey(SmallLabelBean entity) { - if(entity != null) { + public Long getKey(SmallMarkerLocalBean entity) { + if (entity != null) { return entity.getId(); } else { return null; @@ -369,7 +374,7 @@ } @Override - public boolean hasKey(SmallLabelBean entity) { + public boolean hasKey(SmallMarkerLocalBean entity) { return entity.getId() != null; } @@ -377,5 +382,5 @@ protected final boolean isEntityUpdateable() { return true; } - + } diff --git a/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java new file mode 100644 index 0000000..12641a1 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/SmallMarkerLocalBeanDao.java @@ -0,0 +1,381 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.SmallMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "SMALL_MARKER_LOCAL_BEAN". +*/ +public class SmallMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "SMALL_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity SmallMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID"); + public final static Property LocationNumber = new Property(2, String.class, "locationNumber", false, "LOCATION_NUMBER"); + public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); + public final static Property ElectricMarkerId = new Property(4, String.class, "electricMarkerId", false, "ELECTRIC_MARKER_ID"); + public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); + public final static Property CableNumber = new Property(6, String.class, "cableNumber", false, "CABLE_NUMBER"); + public final static Property Line = new Property(7, String.class, "line", false, "LINE"); + public final static Property VoltageLevel = new Property(8, String.class, "voltageLevel", false, "VOLTAGE_LEVEL"); + public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE"); + public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC"); + public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND"); + public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START"); + public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END"); + public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT"); + public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR"); + public final static Property ImagePath = new Property(16, String.class, "imagePath", false, "IMAGE_PATH"); + public final static Property Memo1 = new Property(17, String.class, "memo1", false, "MEMO1"); + public final static Property Memo2 = new Property(18, String.class, "memo2", false, "MEMO2"); + public final static Property Memo3 = new Property(19, String.class, "memo3", false, "MEMO3"); + } + + + public SmallMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public SmallMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"SMALL_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"MARKER_ID\" TEXT," + // 1: markerId + "\"LOCATION_NUMBER\" TEXT," + // 2: locationNumber + "\"LOCATION_NAME\" TEXT," + // 3: locationName + "\"ELECTRIC_MARKER_ID\" TEXT," + // 4: electricMarkerId + "\"CABLE_NAME\" TEXT," + // 5: cableName + "\"CABLE_NUMBER\" TEXT," + // 6: cableNumber + "\"LINE\" TEXT," + // 7: line + "\"VOLTAGE_LEVEL\" TEXT," + // 8: voltageLevel + "\"CABLE_TYPE\" TEXT," + // 9: cableType + "\"CABLE_SPEC\" TEXT," + // 10: cableSpec + "\"CABLE_BRAND\" TEXT," + // 11: cableBrand + "\"CABLE_START\" TEXT," + // 12: cableStart + "\"CABLE_END\" TEXT," + // 13: cableEnd + "\"HAS_JOINT\" TEXT," + // 14: hasJoint + "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator + "\"IMAGE_PATH\" TEXT," + // 16: imagePath + "\"MEMO1\" TEXT," + // 17: memo1 + "\"MEMO2\" TEXT," + // 18: memo2 + "\"MEMO3\" TEXT);"); // 19: memo3 + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SMALL_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, SmallMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(2, markerId); + } + + String locationNumber = entity.getLocationNumber(); + if (locationNumber != null) { + stmt.bindString(3, locationNumber); + } + + String locationName = entity.getLocationName(); + if (locationName != null) { + stmt.bindString(4, locationName); + } + + String electricMarkerId = entity.getElectricMarkerId(); + if (electricMarkerId != null) { + stmt.bindString(5, electricMarkerId); + } + + String cableName = entity.getCableName(); + if (cableName != null) { + stmt.bindString(6, cableName); + } + + String cableNumber = entity.getCableNumber(); + if (cableNumber != null) { + stmt.bindString(7, cableNumber); + } + + String line = entity.getLine(); + if (line != null) { + stmt.bindString(8, line); + } + + String voltageLevel = entity.getVoltageLevel(); + if (voltageLevel != null) { + stmt.bindString(9, voltageLevel); + } + + String cableType = entity.getCableType(); + if (cableType != null) { + stmt.bindString(10, cableType); + } + + String cableSpec = entity.getCableSpec(); + if (cableSpec != null) { + stmt.bindString(11, cableSpec); + } + + String cableBrand = entity.getCableBrand(); + if (cableBrand != null) { + stmt.bindString(12, cableBrand); + } + + String cableStart = entity.getCableStart(); + if (cableStart != null) { + stmt.bindString(13, cableStart); + } + + String cableEnd = entity.getCableEnd(); + if (cableEnd != null) { + stmt.bindString(14, cableEnd); + } + + String hasJoint = entity.getHasJoint(); + if (hasJoint != null) { + stmt.bindString(15, hasJoint); + } + + String jointCreator = entity.getJointCreator(); + if (jointCreator != null) { + stmt.bindString(16, jointCreator); + } + + String imagePath = entity.getImagePath(); + if (imagePath != null) { + stmt.bindString(17, imagePath); + } + + String memo1 = entity.getMemo1(); + if (memo1 != null) { + stmt.bindString(18, memo1); + } + + String memo2 = entity.getMemo2(); + if (memo2 != null) { + stmt.bindString(19, memo2); + } + + String memo3 = entity.getMemo3(); + if (memo3 != null) { + stmt.bindString(20, memo3); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public SmallMarkerLocalBean readEntity(Cursor cursor, int offset) { + SmallMarkerLocalBean entity = new SmallMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNumber + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // electricMarkerId + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNumber + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // voltageLevel + cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType + cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec + cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand + cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart + cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd + cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint + cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // imagePath + cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // memo1 + cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo2 + cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19) // memo3 + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, SmallMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setLocationNumber(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setElectricMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setCableNumber(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setVoltageLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); + entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10)); + entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11)); + entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12)); + entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13)); + entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); + entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15)); + entity.setImagePath(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); + entity.setMemo1(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); + entity.setMemo2(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); + entity.setMemo3(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); + } + + @Override + protected final Long updateKeyAfterInsert(SmallMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(SmallMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(SmallMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 802ffb0..0000000 --- a/app/src/main/java/com/casic/electric/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,241 +0,0 @@ -package com.casic.electric.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.electric.detector.bean.TaskBean; - -import org.greenrobot.greendao.AbstractDao; -import org.greenrobot.greendao.Property; -import org.greenrobot.greendao.database.Database; -import org.greenrobot.greendao.database.DatabaseStatement; -import org.greenrobot.greendao.internal.DaoConfig; - -// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. -/** - * DAO for table "TASK_BEAN". -*/ -public class TaskBeanDao extends AbstractDao { - - public static final String TABLENAME = "TASK_BEAN"; - - /** - * Properties of entity TaskBean.
- * Can be used for QueryBuilder and for referencing column names. - */ - public static class Properties { - public final static Property Id = new Property(0, Long.class, "id", true, "_id"); - public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(4, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Scanner = new Property(5, String.class, "scanner", false, "SCANNER"); - public final static Property Lng = new Property(6, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(7, String.class, "lat", false, "LAT"); - public final static Property State = new Property(8, String.class, "state", false, "STATE"); - public final static Property Desc = new Property(9, String.class, "desc", false, "DESC"); - } - - - public TaskBeanDao(DaoConfig config) { - super(config); - } - - public TaskBeanDao(DaoConfig config, DaoSession daoSession) { - super(config, daoSession); - } - - /** Creates the underlying database table. */ - public static void createTable(Database db, boolean ifNotExists) { - String constraint = ifNotExists? "IF NOT EXISTS ": ""; - db.execSQL("CREATE TABLE " + constraint + "\"TASK_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"TASK_ID\" TEXT," + // 1: taskId - "\"TASK_CODE\" TEXT," + // 2: taskCode - "\"MARKER_ID\" TEXT," + // 3: markerId - "\"MARKER_REAL_ID\" TEXT," + // 4: markerRealId - "\"SCANNER\" TEXT," + // 5: scanner - "\"LNG\" TEXT," + // 6: lng - "\"LAT\" TEXT," + // 7: lat - "\"STATE\" TEXT," + // 8: state - "\"DESC\" TEXT);"); // 9: desc - } - - /** Drops the underlying database table. */ - public static void dropTable(Database db, boolean ifExists) { - String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_BEAN\""; - db.execSQL(sql); - } - - @Override - protected final void bindValues(DatabaseStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(2, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(3, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(4, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(5, markerRealId); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(6, scanner); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(7, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(8, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(9, state); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(10, desc); - } - } - - @Override - public Long readKey(Cursor cursor, int offset) { - return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); - } - - @Override - public TaskBean readEntity(Cursor cursor, int offset) { - TaskBean entity = new TaskBean( // - cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id - cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // markerRealId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // scanner - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lng - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lat - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // state - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // desc - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setMarkerRealId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setScanner(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setLng(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLat(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setState(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setDesc(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9)); - } - - @Override - protected final Long updateKeyAfterInsert(TaskBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(TaskBean entity) { - if(entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(TaskBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..330af6b --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,227 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_LOCAL_BEAN". +*/ +public class TaskLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_LOCAL_BEAN"; + + /** + * Properties of entity TaskLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskCode = new Property(1, String.class, "taskCode", false, "TASK_CODE"); + public final static Property Description = new Property(2, String.class, "description", false, "DESCRIPTION"); + public final static Property CreateTime = new Property(3, String.class, "createTime", false, "CREATE_TIME"); + public final static Property Status = new Property(4, String.class, "status", false, "STATUS"); + public final static Property CreateUserName = new Property(5, String.class, "createUserName", false, "CREATE_USER_NAME"); + public final static Property StartTime = new Property(6, String.class, "startTime", false, "START_TIME"); + public final static Property EndTime = new Property(7, String.class, "endTime", false, "END_TIME"); + public final static Property IsFreeTask = new Property(8, String.class, "isFreeTask", false, "IS_FREE_TASK"); + } + + + public TaskLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_CODE\" TEXT," + // 1: taskCode + "\"DESCRIPTION\" TEXT," + // 2: description + "\"CREATE_TIME\" TEXT," + // 3: createTime + "\"STATUS\" TEXT," + // 4: status + "\"CREATE_USER_NAME\" TEXT," + // 5: createUserName + "\"START_TIME\" TEXT," + // 6: startTime + "\"END_TIME\" TEXT," + // 7: endTime + "\"IS_FREE_TASK\" TEXT);"); // 8: isFreeTask + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(2, taskCode); + } + + String description = entity.getDescription(); + if (description != null) { + stmt.bindString(3, description); + } + + String createTime = entity.getCreateTime(); + if (createTime != null) { + stmt.bindString(4, createTime); + } + + String status = entity.getStatus(); + if (status != null) { + stmt.bindString(5, status); + } + + String createUserName = entity.getCreateUserName(); + if (createUserName != null) { + stmt.bindString(6, createUserName); + } + + String startTime = entity.getStartTime(); + if (startTime != null) { + stmt.bindString(7, startTime); + } + + String endTime = entity.getEndTime(); + if (endTime != null) { + stmt.bindString(8, endTime); + } + + String isFreeTask = entity.getIsFreeTask(); + if (isFreeTask != null) { + stmt.bindString(9, isFreeTask); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskLocalBean readEntity(Cursor cursor, int offset) { + TaskLocalBean entity = new TaskLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskCode + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // description + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // createTime + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // createUserName + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // startTime + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // endTime + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // isFreeTask + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskCode(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setDescription(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setCreateTime(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setCreateUserName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setStartTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setEndTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setIsFreeTask(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..344c129 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,197 @@ +package com.casic.electric.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.electric.detector.bean.TaskMarkerLocalBean; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; +import org.greenrobot.greendao.internal.DaoConfig; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "TASK_MARKER_LOCAL_BEAN". +*/ +public class TaskMarkerLocalBeanDao extends AbstractDao { + + public static final String TABLENAME = "TASK_MARKER_LOCAL_BEAN"; + + /** + * Properties of entity TaskMarkerLocalBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property TaskId = new Property(1, String.class, "taskId", false, "TASK_ID"); + public final static Property TaskCode = new Property(2, String.class, "taskCode", false, "TASK_CODE"); + public final static Property MarkerId = new Property(3, String.class, "markerId", false, "MARKER_ID"); + public final static Property Lng = new Property(4, double.class, "lng", false, "LNG"); + public final static Property Lat = new Property(5, double.class, "lat", false, "LAT"); + public final static Property IsDetected = new Property(6, String.class, "isDetected", false, "IS_DETECTED"); + public final static Property DetectedTime = new Property(7, String.class, "detectedTime", false, "DETECTED_TIME"); + } + + + public TaskMarkerLocalBeanDao(DaoConfig config) { + super(config); + } + + public TaskMarkerLocalBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"TASK_MARKER_LOCAL_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY ," + // 0: id + "\"TASK_ID\" TEXT," + // 1: taskId + "\"TASK_CODE\" TEXT," + // 2: taskCode + "\"MARKER_ID\" TEXT," + // 3: markerId + "\"LNG\" REAL NOT NULL ," + // 4: lng + "\"LAT\" REAL NOT NULL ," + // 5: lat + "\"IS_DETECTED\" TEXT," + // 6: isDetected + "\"DETECTED_TIME\" TEXT);"); // 7: detectedTime + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TASK_MARKER_LOCAL_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, TaskMarkerLocalBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + + String taskId = entity.getTaskId(); + if (taskId != null) { + stmt.bindString(2, taskId); + } + + String taskCode = entity.getTaskCode(); + if (taskCode != null) { + stmt.bindString(3, taskCode); + } + + String markerId = entity.getMarkerId(); + if (markerId != null) { + stmt.bindString(4, markerId); + } + stmt.bindDouble(5, entity.getLng()); + stmt.bindDouble(6, entity.getLat()); + + String isDetected = entity.getIsDetected(); + if (isDetected != null) { + stmt.bindString(7, isDetected); + } + + String detectedTime = entity.getDetectedTime(); + if (detectedTime != null) { + stmt.bindString(8, detectedTime); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public TaskMarkerLocalBean readEntity(Cursor cursor, int offset) { + TaskMarkerLocalBean entity = new TaskMarkerLocalBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // taskId + cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // taskCode + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // markerId + cursor.getDouble(offset + 4), // lng + cursor.getDouble(offset + 5), // lat + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // isDetected + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // detectedTime + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, TaskMarkerLocalBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); + entity.setTaskCode(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); + entity.setMarkerId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setLng(cursor.getDouble(offset + 4)); + entity.setLat(cursor.getDouble(offset + 5)); + entity.setIsDetected(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setDetectedTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + } + + @Override + protected final Long updateKeyAfterInsert(TaskMarkerLocalBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(TaskMarkerLocalBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(TaskMarkerLocalBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +} diff --git a/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..a7c993c --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,147 @@ +package com.casic.electric.detector.model; + +import java.util.List; + +/** + * Task本地库数据模型类,包含Task里面的Marker + */ +public class TaskDetailLocalModel { + private String taskId;//任务ID + private String taskCode;//任务编号 + private String description;//任务名称 + private String createTime;//任务创建的时间 + private String status;//任务状态 + private String createUserName;//任务创建者名称 + private String startTime;//任务被开始执行的时间 + private String endTime;//任务执行结束的时间 + private String isFreeTask;//是否自由巡检。1-是,0-否 + private List markerModels; + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getTaskCode() { + return taskCode; + } + + public void setTaskCode(String taskCode) { + this.taskCode = taskCode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateUserName() { + return createUserName; + } + + public void setCreateUserName(String createUserName) { + this.createUserName = createUserName; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getIsFreeTask() { + return isFreeTask; + } + + public void setIsFreeTask(String isFreeTask) { + this.isFreeTask = isFreeTask; + } + + public List getMarkerModels() { + return markerModels; + } + + public void setMarkerModels(List markerModels) { + this.markerModels = markerModels; + } + + public static class TaskMarkerLocalModel { + private String markerId; + private double lng; + private double lat; + private String isDetected; + private String detectedTime; + + public String getMarkerId() { + return markerId; + } + + public void setMarkerId(String markerId) { + this.markerId = markerId; + } + + public double getLng() { + return lng; + } + + public void setLng(double lng) { + this.lng = lng; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public String getIsDetected() { + return isDetected; + } + + public void setIsDetected(String isDetected) { + this.isDetected = isDetected; + } + + public String getDetectedTime() { + return detectedTime; + } + + public void setDetectedTime(String detectedTime) { + this.detectedTime = detectedTime; + } + } +} diff --git a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java index 83cda4a..5e78a37 100644 --- a/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java +++ b/app/src/main/java/com/casic/electric/detector/uart/SerialPort.java @@ -25,7 +25,7 @@ /** * 关闭串口 */ - private native void close(); + public native void close(); /** * jfieldID fd_id = env->GetFieldID(serial_port_class, "fd", "Ljava/io/FileDescriptor;"); diff --git a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt index f9e5457..1e761c7 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/DataBaseManager.kt @@ -1,11 +1,16 @@ package com.casic.electric.detector.utils import com.casic.electric.detector.base.BaseApplication -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean -import com.casic.electric.detector.greendao.LabelBeanDao +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean +import com.casic.electric.detector.bean.TaskMarkerLocalBean +import com.casic.electric.detector.greendao.MarkerLocalBeanDao import com.casic.electric.detector.greendao.SmallLabelBeanDao -import com.pengxh.kt.lite.extensions.toJson +import com.casic.electric.detector.greendao.TaskLocalBeanDao +import com.casic.electric.detector.greendao.TaskMarkerLocalBeanDao +import com.casic.electric.detector.model.TaskDetailLocalModel +import com.casic.electric.detector.model.TaskModel import org.greenrobot.greendao.Property class DataBaseManager private constructor() { @@ -16,185 +21,233 @@ } } - private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var smallLabelBeanDao = BaseApplication.get().getDaoSession().smallLabelBeanDao + private var markerLocalBeanDao = BaseApplication.get().getDaoSession().markerLocalBeanDao + private var smallMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().smallMarkerLocalBeanDao - /******************************* Lable *** Start **********************************************/ - - fun clearLabels() { - labelBeanDao.deleteAll() + fun clearMarkers() { + markerLocalBeanDao.deleteAll() + smallMarkerLocalBeanDao.deleteAll() } //下载服务器表格后存本地 - fun insertLabel(labelBean: LabelBean) { - labelBeanDao.insert(labelBean) + fun saveMarkerInLocale(bean: MarkerLocalBean) { + markerLocalBeanDao.insert(bean) } - //上传服务器之前存本地 - fun insertLabel(labelData: LabelDataClass) { - val labelBean = LabelBean() - labelBean.markerObjType = labelData.recordType - labelBean.markerNumber = labelData.markerObjectId - labelBean.objectName = labelData.objectName - labelBean.voltageLevel = labelData.pressLevel - labelBean.transformerModel = labelData.markerObjectType - labelBean.holeCount = labelData.holeCount - labelBean.capacity = labelData.capacity - labelBean.wellCoverMaterial = labelData.wellMaterial - labelBean.coverDepth = labelData.coverDepth - labelBean.transformerSpec = labelData.transformerSpec - labelBean.inlineName = labelData.inlineName - labelBean.size = labelData.size - labelBean.bottomDepth = labelData.bottomDepth - labelBean.height = labelData.height - labelBean.crossPipeLine = labelData.crossPipe - labelBean.inlineCount = labelData.inlineCount - labelBean.lineNumber = labelData.lineNo - labelBean.jointCount = labelData.jointCount - labelBean.outlineCount = labelData.outlineCount - labelBean.remainingChannels = labelData.leftHoleCount - labelBean.cabinetType = labelData.cabinetType - labelBean.tieCable1 = labelData.tieCable1 - labelBean.tieCable2 = labelData.tieCable2 - labelBean.casingMaterial = labelData.bushingMaterial - labelBean.casingSpec = labelData.bushingSpec - labelBean.constructTime = labelData.constructTime - labelBean.inspectionUnit = labelData.operComp - labelBean.area = labelData.area - labelBean.road = labelData.road - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - labelBean.markerId = labelData.markerId - labelBean.markerType = labelData.markerType - labelBean.owner = labelData.owner - labelBean.markerDepth = labelData.markerDepth - labelBean.electricTagCount = labelData.eleTagCount - labelBean.installedTime = labelData.createTime - labelBean.longitude = labelData.longitude - labelBean.latitude = labelData.latitude - labelBean.markerMemo1 = labelData.markerMemo1 - labelBean.markerMemo2 = labelData.markerMemo2 - labelBean.markerMemo3 = labelData.markerMemo3 - labelBean.imagePath = labelData.realPaths.toJson() - - labelBeanDao.insert(labelBean) + fun queryMarkerById(markerId: String): List { + return markerLocalBeanDao.queryBuilder() + .where(MarkerLocalBeanDao.Properties.MarkerId.eq(markerId)) + .list() } - fun loadLabels(): MutableList { - return labelBeanDao.loadAll() + fun loadMarkers(): MutableList { + return markerLocalBeanDao.loadAll() } - fun loadLabelByCondition(selectedItem: String, value: String?): MutableList { + fun loadMarkerByCondition(selectedItem: String, value: String?): MutableList { when (selectedItem) { - LocaleConstant.CONDITION_ARRAY[1] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerNumber, value) - } +// LocaleConstant.CONDITION_ARRAY[1] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.MarkerNumber, value) +// } - LocaleConstant.CONDITION_ARRAY[2] -> { - return queryByProperty(LabelBeanDao.Properties.ObjectName, value) - } +// LocaleConstant.CONDITION_ARRAY[2] -> { +// return queryByProperty(MarkerLocalBeanDao.Properties.ObjectName, value) +// } LocaleConstant.CONDITION_ARRAY[3] -> { - return queryByProperty(LabelBeanDao.Properties.Area, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Area, value) } LocaleConstant.CONDITION_ARRAY[4] -> { - return queryByProperty(LabelBeanDao.Properties.Road, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Road, value) } LocaleConstant.CONDITION_ARRAY[5] -> { - return queryByProperty(LabelBeanDao.Properties.InspectionUnit, value) + return queryByProperty(MarkerLocalBeanDao.Properties.InstallationDept, value) } LocaleConstant.CONDITION_ARRAY[6] -> { - return queryByProperty(LabelBeanDao.Properties.Owner, value) + return queryByProperty(MarkerLocalBeanDao.Properties.Owner, value) } LocaleConstant.CONDITION_ARRAY[8] -> { - return queryByProperty(LabelBeanDao.Properties.MarkerId, value) + return queryByProperty(MarkerLocalBeanDao.Properties.MarkerId, value) } } return ArrayList() } - private fun queryByProperty(property: Property, value: String?): MutableList { + private fun queryByProperty(property: Property, value: String?): MutableList { return if (value == null) { - labelBeanDao.queryBuilder().where(property.isNotNull).list() + markerLocalBeanDao.queryBuilder().where(property.isNotNull).list() } else { - labelBeanDao.queryBuilder().where(property.eq(value)).list() + markerLocalBeanDao.queryBuilder().where(property.eq(value)).list() } } - fun loadLabelByDate(startDate: String, endDate: String): MutableList { - return labelBeanDao.queryBuilder().where( - LabelBeanDao.Properties.ConstructTime.gt(startDate), - LabelBeanDao.Properties.ConstructTime.lt(endDate) + fun loadLabelByDate(startDate: String, endDate: String): MutableList { + return markerLocalBeanDao.queryBuilder().where( + MarkerLocalBeanDao.Properties.ConstructTime.gt(startDate), + MarkerLocalBeanDao.Properties.ConstructTime.lt(endDate) ).list() } - fun queryLabelById(markerId: String): List { - return labelBeanDao.queryBuilder() - .where(LabelBeanDao.Properties.MarkerId.eq(markerId)) - .list() + fun saveSmallMarkerInLocale(bean: SmallMarkerLocalBean) { + smallMarkerLocalBeanDao.insert(bean) } - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } -// queryTaskById(taskId).forEach { -// taskBeanDao.delete(it) -// } - } - /******************************* Lable *** End **********************************************/ - - /******************************* Small Lable *** Start **************************************/ - - //下载服务器表格后存本地 - fun insertSmallLabel(bean: SmallLabelBean) { - smallLabelBeanDao.insert(bean) + fun loadSmallMarkers(): MutableList { + return smallMarkerLocalBeanDao.loadAll() } - //上传服务器之前存本地 - fun insertSmallLabel(labelData: SmallLabelDataClass) { - val labelBean = SmallLabelBean() - labelBean.markerId = labelData.markerId - labelBean.locationNumber = labelData.locationNo - labelBean.locationName = labelData.locationName - labelBean.electricMarkerId = labelData.smallMarkerId - labelBean.cableName = labelData.cableName - labelBean.cableNumber = labelData.cableNo - labelBean.line = labelData.line - labelBean.voltageLevel = labelData.pressLevel - labelBean.cableType = labelData.cableType - labelBean.cableSpec = labelData.cableSpec - labelBean.cableBrand = labelData.cableBrand - labelBean.cableStart = labelData.cableStart - labelBean.cableEnd = labelData.cableEnd - labelBean.hasJoint = labelData.hasJoint - labelBean.jointCreator = labelData.jointCreator - labelBean.imagePath = labelData.realPaths.toJson() - labelBean.memo1 = labelData.memo1 - labelBean.memo2 = labelData.memo2 - labelBean.memo3 = labelData.memo3 - - smallLabelBeanDao.insert(labelBean) - } - - fun clearSmallLabels() { - smallLabelBeanDao.deleteAll() - } - - fun loadSmallLabels(): MutableList { - return smallLabelBeanDao.loadAll() - } - - fun queryElectricMarkerById(electricMarkerId: String): SmallLabelBean { - return smallLabelBeanDao.queryBuilder() + fun querySmallMarkerById(electricMarkerId: String): SmallMarkerLocalBean { + return smallMarkerLocalBeanDao.queryBuilder() .where(SmallLabelBeanDao.Properties.ElectricMarkerId.eq(electricMarkerId)) .list() .first() } - /******************************* Small Lable *** End ****************************************/ + + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + + fun saveTaskInLocale(task: TaskModel.MessageModel) { + val bean = TaskLocalBean() + bean.id = task.id.toLong() + bean.taskCode = task.taskCode + bean.description = task.description + bean.createTime = task.deployDate + bean.status = task.status + bean.createUserName = task.creatorName + if (task.beginDate == null) { + bean.startTime = "" + } + if (task.endDate == null) { + bean.endTime = "" + } + bean.isFreeTask = "0" + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + fun saveTaskInLocale(bean: TaskLocalBean) { + if (!bean.isExist()) { + taskLocalBeanDao.insert(bean) + } + } + + private fun TaskLocalBean.isExist(): Boolean { + val result = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun loadLocalTask(): ArrayList { + val result = ArrayList() + + val tasks = taskLocalBeanDao.loadAll() + tasks.forEach { + val model = TaskDetailLocalModel() + model.taskId = it.id.toString() + model.taskCode = it.taskCode + model.description = it.description + model.createTime = it.createTime + model.status = it.status + model.createUserName = it.createUserName + model.isFreeTask = it.isFreeTask + + val markers = ArrayList() + if (it.isFreeTask == "0") { + //非自由巡检才有Marker + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + markerLocalBeans.forEach { marker -> + val localModel = TaskDetailLocalModel.TaskMarkerLocalModel() + localModel.markerId = marker.markerId + localModel.lng = marker.lng + localModel.lat = marker.lat + localModel.isDetected = marker.isDetected + localModel.detectedTime = marker.detectedTime + + markers.add(localModel) + } + } + model.markerModels = markers + result.add(model) + } + return result + } + + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + fun queryMarkerByState(state: String): List { + return taskMarkerLocalBeanDao.queryBuilder() + .where(TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state)) + .list() + } + + fun deleteLocalTaskById(taskId: String, taskCode: String) { + val task = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return + taskLocalBeanDao.delete(task) + + //删除此任务关联的Marker。非自由巡检才有Marker + if (task.isFreeTask == "0") { + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + } + + fun saveTaskMarkerInLocale( + taskId: Int, taskCode: String, marker: TaskModel.MessageModel.TaskDetailInfosModel + ) { + val bean = TaskMarkerLocalBean() + bean.id = marker.id.toLong() + bean.taskId = taskId.toString() + bean.taskCode = taskCode + bean.markerId = marker.markerIdReal + bean.lng = marker.longitude + bean.lat = marker.latitude + bean.isDetected = "0" + bean.detectedTime = "" + if (!bean.isExist()) { + taskMarkerLocalBeanDao.insert(bean) + } + } + + private fun TaskMarkerLocalBean.isExist(): Boolean { + val result = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.Id.eq(this.id) + ).list() + return !result.isNullOrEmpty() + } + + fun queryTaskMarkerById( + taskId: String, taskCode: String, markerId: String, state: String + ): TaskMarkerLocalBean? { + return taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode), + TaskMarkerLocalBeanDao.Properties.MarkerId.eq(markerId), + TaskMarkerLocalBeanDao.Properties.IsDetected.eq(state) + ).list().firstOrNull() + } + + fun updateLocalTaskMarkerState(marker: TaskMarkerLocalBean) { + marker.isDetected = "1" + taskMarkerLocalBeanDao.update(marker) + } } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt index 1963ae9..f9b8693 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/ExcelHub.kt @@ -1,13 +1,13 @@ package com.casic.electric.detector.utils -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import jxl.Workbook import java.io.File object ExcelHub { - fun readLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -17,60 +17,60 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = LabelBean() - labelBean.markerObjType = sheet.getCell(0, i).contents - labelBean.markerNumber = sheet.getCell(1, i).contents - labelBean.objectName = sheet.getCell(2, i).contents - labelBean.voltageLevel = sheet.getCell(3, i).contents - labelBean.transformerModel = sheet.getCell(4, i).contents - labelBean.holeCount = sheet.getCell(5, i).contents - labelBean.capacity = sheet.getCell(6, i).contents - labelBean.wellCoverMaterial = sheet.getCell(7, i).contents - labelBean.coverDepth = sheet.getCell(8, i).contents - labelBean.transformerSpec = sheet.getCell(9, i).contents - labelBean.inlineName = sheet.getCell(10, i).contents - labelBean.size = sheet.getCell(11, i).contents - labelBean.bottomDepth = sheet.getCell(12, i).contents - labelBean.height = sheet.getCell(13, i).contents - labelBean.crossPipeLine = sheet.getCell(14, i).contents - labelBean.inlineCount = sheet.getCell(15, i).contents - labelBean.lineNumber = sheet.getCell(16, i).contents - labelBean.jointCount = sheet.getCell(17, i).contents - labelBean.outlineCount = sheet.getCell(18, i).contents - labelBean.remainingChannels = sheet.getCell(19, i).contents - labelBean.cabinetType = sheet.getCell(20, i).contents - labelBean.tieCable1 = sheet.getCell(21, i).contents - labelBean.tieCable2 = sheet.getCell(22, i).contents - labelBean.casingMaterial = sheet.getCell(23, i).contents - labelBean.casingSpec = sheet.getCell(24, i).contents - labelBean.constructTime = sheet.getCell(25, i).contents - labelBean.inspectionUnit = sheet.getCell(26, i).contents - labelBean.area = sheet.getCell(27, i).contents - labelBean.road = sheet.getCell(28, i).contents - labelBean.memo1 = sheet.getCell(29, i).contents - labelBean.memo2 = sheet.getCell(30, i).contents - labelBean.memo3 = sheet.getCell(31, i).contents - labelBean.markerId = sheet.getCell(32, i).contents - labelBean.markerType = sheet.getCell(33, i).contents - labelBean.owner = sheet.getCell(34, i).contents - labelBean.markerDepth = sheet.getCell(35, i).contents - labelBean.electricTagCount = sheet.getCell(36, i).contents - labelBean.installedTime = sheet.getCell(37, i).contents - labelBean.longitude = sheet.getCell(38, i).contents - labelBean.latitude = sheet.getCell(39, i).contents - labelBean.markerMemo1 = sheet.getCell(40, i).contents - labelBean.markerMemo2 = sheet.getCell(41, i).contents - labelBean.markerMemo3 = sheet.getCell(42, i).contents + val marker = MarkerLocalBean() +// labelBean.markerObjType = sheet.getCell(0, i).contents +// labelBean.markerNumber = sheet.getCell(1, i).contents +// labelBean.objectName = sheet.getCell(2, i).contents +// labelBean.voltageLevel = sheet.getCell(3, i).contents +// labelBean.transformerModel = sheet.getCell(4, i).contents +// labelBean.holeCount = sheet.getCell(5, i).contents +// labelBean.capacity = sheet.getCell(6, i).contents +// labelBean.wellCoverMaterial = sheet.getCell(7, i).contents +// labelBean.coverDepth = sheet.getCell(8, i).contents +// labelBean.transformerSpec = sheet.getCell(9, i).contents +// labelBean.inlineName = sheet.getCell(10, i).contents +// labelBean.size = sheet.getCell(11, i).contents +// labelBean.bottomDepth = sheet.getCell(12, i).contents +// labelBean.height = sheet.getCell(13, i).contents +// labelBean.crossPipeLine = sheet.getCell(14, i).contents +// labelBean.inlineCount = sheet.getCell(15, i).contents +// labelBean.lineNumber = sheet.getCell(16, i).contents +// labelBean.jointCount = sheet.getCell(17, i).contents +// labelBean.outlineCount = sheet.getCell(18, i).contents +// labelBean.remainingChannels = sheet.getCell(19, i).contents +// labelBean.cabinetType = sheet.getCell(20, i).contents +// labelBean.tieCable1 = sheet.getCell(21, i).contents +// labelBean.tieCable2 = sheet.getCell(22, i).contents +// labelBean.casingMaterial = sheet.getCell(23, i).contents +// labelBean.casingSpec = sheet.getCell(24, i).contents +// labelBean.constructTime = sheet.getCell(25, i).contents +// labelBean.inspectionUnit = sheet.getCell(26, i).contents +// labelBean.area = sheet.getCell(27, i).contents +// labelBean.road = sheet.getCell(28, i).contents +// labelBean.memo1 = sheet.getCell(29, i).contents +// labelBean.memo2 = sheet.getCell(30, i).contents +// labelBean.memo3 = sheet.getCell(31, i).contents +// labelBean.markerId = sheet.getCell(32, i).contents +// labelBean.markerType = sheet.getCell(33, i).contents +// labelBean.owner = sheet.getCell(34, i).contents +// labelBean.markerDepth = sheet.getCell(35, i).contents +// labelBean.electricTagCount = sheet.getCell(36, i).contents +// labelBean.installedTime = sheet.getCell(37, i).contents +// labelBean.longitude = sheet.getCell(38, i).contents +// labelBean.latitude = sheet.getCell(39, i).contents +// labelBean.markerMemo1 = sheet.getCell(40, i).contents +// labelBean.markerMemo2 = sheet.getCell(41, i).contents +// labelBean.markerMemo3 = sheet.getCell(42, i).contents - result.add(labelBean) + result.add(marker) } workbook.close() return result } - fun readSmallLabel(filePath: String?): ArrayList { - val result = ArrayList() + fun readSmallLabel(filePath: String?): ArrayList { + val result = ArrayList() if (filePath.isNullOrBlank()) { return result @@ -80,7 +80,8 @@ val sheet = workbook.getSheet(0) for (i in 1 until sheet.rows) { - val labelBean = SmallLabelBean() + val labelBean = + SmallMarkerLocalBean() labelBean.markerId = sheet.getCell(0, i).contents labelBean.locationNumber = sheet.getCell(1, i).contents labelBean.locationName = sheet.getCell(2, i).contents diff --git a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt index 566996e..4ee3169 100644 --- a/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/electric/detector/utils/LocaleConstant.kt @@ -24,6 +24,7 @@ const val USER_COMPANY_ID = "USER_COMPANY_ID" const val OBJECT_ID = "OBJECT_ID" const val TASK_ID = "TASK_ID" + const val TASK_CODE = "TASK_CODE" const val SERVER_IP = "SERVER_IP" const val SERVER_PORT = "SERVER_PORT" const val APP_AUTHORITY = "com.casic.electric.detector.fileprovider" diff --git a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt index 33bf42d..a59269e 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ElectricMarkerDetailActivity.kt @@ -4,7 +4,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.SmallLabelBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean import com.casic.electric.detector.databinding.ActivityElectricMarkerDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.DataBaseManager @@ -19,7 +19,7 @@ //TODO 改为Dialog class ElectricMarkerDetailActivity : KotlinBaseActivity() { - private lateinit var smallLabel: SmallLabelBean + private lateinit var smallLabel: SmallMarkerLocalBean override fun initViewBinding(): ActivityElectricMarkerDetailBinding { return ActivityElectricMarkerDetailBinding.inflate(layoutInflater) @@ -36,7 +36,7 @@ val electricMarkerId = intent.getStringExtra(Constant.INTENT_PARAM)!! - smallLabel = DataBaseManager.get.queryElectricMarkerById(electricMarkerId) + smallLabel = DataBaseManager.get.querySmallMarkerById(electricMarkerId) binding.markerIdView.text = smallLabel.markerId binding.locationNumberView.text = smallLabel.locationNumber diff --git a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt index 837ae86..2f1bb58 100644 --- a/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/InstallSmallLabelActivity.kt @@ -276,7 +276,7 @@ //先存本地 lifecycleScope.launch { withContext(Dispatchers.IO) { - DataBaseManager.get.insertSmallLabel(smallLabelData) +// DataBaseManager.get.insertSmallLabel(smallLabelData) } } @@ -339,7 +339,7 @@ gpioManager.setGpioLow("18") //查本地库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isEmpty()) { binding.objectAttrInclude.markerIdView.text = markerId } else { diff --git a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt index d3ffdd3..a5834bd 100644 --- a/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/MainActivity.kt @@ -6,6 +6,7 @@ import android.app.Dialog import android.content.Context import android.content.DialogInterface +import android.graphics.BitmapFactory import android.graphics.Color import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable @@ -19,16 +20,16 @@ import android.os.CountDownTimer import android.os.Handler import android.os.Message +import android.util.Log import android.view.KeyEvent import android.view.View -import android.view.animation.Animation -import android.view.animation.RotateAnimation import android.widget.AdapterView import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import com.amap.api.location.AMapLocation import com.amap.api.maps.AMap import com.amap.api.maps.AMapOptions +import com.amap.api.maps.AMapUtils import com.amap.api.maps.CameraUpdateFactory import com.amap.api.maps.CoordinateConverter import com.amap.api.maps.model.BitmapDescriptorFactory @@ -39,8 +40,9 @@ import com.casic.electric.detector.R import com.casic.electric.detector.adapter.EditableImageAdapter import com.casic.electric.detector.base.SerialPortActivity -import com.casic.electric.detector.bean.LabelBean -import com.casic.electric.detector.bean.TaskBean +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.bean.SmallMarkerLocalBean +import com.casic.electric.detector.bean.TaskLocalBean import com.casic.electric.detector.callback.OnGetLocationListener import com.casic.electric.detector.callback.OnImageCompressListener import com.casic.electric.detector.cluster.ClusterItem @@ -49,9 +51,10 @@ import com.casic.electric.detector.databinding.ActivityMainBinding import com.casic.electric.detector.databinding.DialogInstallMarkerBinding import com.casic.electric.detector.databinding.DialogInstallSmallMarkerBinding -import com.casic.electric.detector.databinding.DialogSearchMarkerBinding +import com.casic.electric.detector.databinding.DialogSearchMarkerNewBinding import com.casic.electric.detector.extensions.appendExcelDownloadUrl import com.casic.electric.detector.extensions.compressImage +import com.casic.electric.detector.extensions.createTaskCode import com.casic.electric.detector.extensions.drawCircle import com.casic.electric.detector.extensions.getDefaultValue import com.casic.electric.detector.extensions.hexToString @@ -61,6 +64,7 @@ import com.casic.electric.detector.extensions.setDefaultValue import com.casic.electric.detector.extensions.show import com.casic.electric.detector.extensions.toHex +import com.casic.electric.detector.model.TaskDetailLocalModel import com.casic.electric.detector.model.TaskModel import com.casic.electric.detector.utils.DataBaseManager import com.casic.electric.detector.utils.ExcelHub @@ -70,9 +74,10 @@ import com.casic.electric.detector.utils.LocationHub import com.casic.electric.detector.utils.RouteOnMap import com.casic.electric.detector.vm.TaskViewModel +import com.casic.electric.detector.widgets.MarkerDetailDialog import com.casic.electric.detector.widgets.QueryMarkerDialog +import com.casic.electric.detector.widgets.RadarScanView import com.casic.electric.detector.widgets.SamplePopupWindow -import com.google.gson.Gson import com.luck.picture.lib.basic.PictureSelector import com.luck.picture.lib.config.SelectMimeType import com.luck.picture.lib.entity.LocalMedia @@ -81,8 +86,10 @@ import com.pengxh.kt.lite.extensions.binding import com.pengxh.kt.lite.extensions.convertColor import com.pengxh.kt.lite.extensions.createDownloadFileDir +import com.pengxh.kt.lite.extensions.createLogFile import com.pengxh.kt.lite.extensions.dateToTimestamp import com.pengxh.kt.lite.extensions.dp2px +import com.pengxh.kt.lite.extensions.getSystemService import com.pengxh.kt.lite.extensions.initDialogLayoutParams import com.pengxh.kt.lite.extensions.isNetworkConnected import com.pengxh.kt.lite.extensions.navigatePageTo @@ -90,6 +97,7 @@ import com.pengxh.kt.lite.extensions.timestampToCompleteDate import com.pengxh.kt.lite.extensions.timestampToTime import com.pengxh.kt.lite.extensions.toJson +import com.pengxh.kt.lite.extensions.writeToFile import com.pengxh.kt.lite.utils.FileDownloadManager import com.pengxh.kt.lite.utils.LoadState import com.pengxh.kt.lite.utils.LoadingDialogHub @@ -103,47 +111,50 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File +import java.math.RoundingMode import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer import java.util.TimerTask +import kotlin.math.atan2 @SuppressLint("all") class MainActivity : SerialPortActivity(), SensorEventListener, Handler.Callback { private val kTag = "MainActivity" - private val context = this@MainActivity + private val context = this private val samplePopupWindow by lazy { SamplePopupWindow(this) } - private val gson by lazy { Gson() } private val regionRadius by lazy { LocaleConstant.RADIUS_SIZE.dp2px(this) } private val backDrawables by lazy { HashMap() } private val installDialog by lazy { InstallMarkerDialog(this) } - private val searchDialog by lazy { SearchMarkerDialog(this) } + private val searchNewDialog by lazy { SearchMarkerNewDialog(this) } + private val detailDialog by lazy { MarkerDetailDialog(this) } + private val locationHub by lazy { LocationHub(this) } + private val decimalFormat by lazy { DecimalFormat("0.00") } private val sensorMessageCode = 2024022301 private val rotationMatrix = FloatArray(9)//旋转矩阵缓存 private val valueArray = FloatArray(3)//方位角数值 private var clickTime: Long = 0 - private var labelBeans = ArrayList() + private var markers = ArrayList() + private var smallMarkers = ArrayList() private var clusterOverlay: ClusterOverlay? = null - private var latitude: Double = 0.0 - private var longitude: Double = 0.0 private var isFreeTask = false + private var freeTaskTitle = "" private var ids = HashSet() private var signalTask: TimerTask? = null + private var energyTask: TimerTask? = null private var searchMarkerTimer: Timer? = null - private var taskId: String? = null + private var freeTaskId: String? = null private var gravity: FloatArray? = null private var geomagnetic: FloatArray? = null private lateinit var aMap: AMap - private lateinit var task: TaskBean private lateinit var sensorManager: SensorManager private lateinit var weakReferenceHandler: WeakReferenceHandler /***inner class 需要用到*****start*/ private val gpioManager by lazy { GpioManager() } - private val locationHub by lazy { LocationHub(this) } private val taskViewModel by lazy { ViewModelProvider(this)[TaskViewModel::class.java] } private val attr = AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ALARM) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build() @@ -168,6 +179,9 @@ slowSoundResourceId = soundPool.load(this, R.raw.ring4, 1) fastSoundResourceId = soundPool.load(this, R.raw.ring2, 1) + //保留小数2位 + decimalFormat.roundingMode = RoundingMode.HALF_UP + "登录成功".show(this) //地图初始化 @@ -177,12 +191,14 @@ samplePopupWindow.setPopupMenuItem(LocaleConstant.POPUP_TITLES) samplePopupWindow.setBackgroundDrawable(null) + sensorManager = getSystemService()!! + weakReferenceHandler = WeakReferenceHandler(this) + //task网络请求监听 taskViewModel.markerFileResult.observe(this) { if (it.success == "true") { //清空之前的数据 - DataBaseManager.get.clearLabels() - DataBaseManager.get.clearSmallLabels() + DataBaseManager.get.clearMarkers() /** * "data":"/xls/marker1.xls,/xls/smallMarker1.xls" * 有两份excel表格需要下载 @@ -200,10 +216,10 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { - labelBeans = ExcelHub.readLabel(file.absolutePath) + markers = ExcelHub.readLabel(file.absolutePath) withContext(Dispatchers.IO) { - labelBeans.forEach { label -> - DataBaseManager.get.insertLabel(label) + markers.forEach { marker -> + DataBaseManager.get.saveMarkerInLocale(marker) } } LoadingDialogHub.dismiss() @@ -227,12 +243,12 @@ FileDownloadManager.OnFileDownloadListener { override fun onDownloadEnd(file: File) { lifecycleScope.launch { -// smallLabels = ExcelHub.readSmallLabel(file.absolutePath) -// withContext(Dispatchers.IO) { -// smallLabels.forEach { label -> -// DataBaseManager.get.insertSmallLabel(label) -// } -// } + smallMarkers = ExcelHub.readSmallLabel(file.absolutePath) + withContext(Dispatchers.IO) { + smallMarkers.forEach { marker -> + DataBaseManager.get.saveSmallMarkerInLocale(marker) + } + } } } @@ -250,18 +266,35 @@ taskViewModel.taskResult.observe(this) { if (it.success == "true") { //清空之前的数据 -// DataBaseManager.get.clearTasks() AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") .setMessage("您有${it.message.size}个新任务!").setPositiveButton("知道了") .setOnDialogButtonClickListener(object : AlertMessageDialog.OnDialogButtonClickListener { override fun onConfirmClick() { - saveTaskInformation(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { + freeTaskId = it + // 自由巡检保存在本地 + val bean = TaskLocalBean() + bean.id = freeTaskId.toString().toLong() + val currentTimeMillis = System.currentTimeMillis() + bean.taskCode = currentTimeMillis.createTaskCode() + bean.description = freeTaskTitle + val time = currentTimeMillis.timestampToCompleteDate() + bean.createTime = time + bean.status = "0" + val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + bean.createUserName = userName + bean.startTime = time + bean.endTime = "" + bean.isFreeTask = "1" + DataBaseManager.get.saveTaskInLocale(bean) + } + taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -290,10 +323,11 @@ }).build().show() } else { lifecycleScope.launch(Dispatchers.Main) { - val labels = withContext(Dispatchers.IO) { - DataBaseManager.get.queryLabelById("0") + val markers = withContext(Dispatchers.IO) { + DataBaseManager.get.queryMarkerByState("0") } - if (labels.isNotEmpty()) { + //如果有需要补全的标识器,Popup右侧会有小圆点提示 + if (markers.isNotEmpty()) { samplePopupWindow.setShowPosition(4) } val x = @@ -307,37 +341,42 @@ SamplePopupWindow.OnPopupWindowClickListener { override fun onPopupItemClicked(position: Int) { when (position) { - 0 -> updateLabels() + 0 -> updateMarkers() 1 -> downloadTask() 2 -> navigatePageTo() 3 -> uploadEvent() -// 4 -> uploadLabel() +// 4 -> completionMarker() } } }) //安装。上传,然后存入本地库 binding.installButton.setOnClickListener { - AlertControlDialog.Builder().setContext(context).setTitle("提示") - .setMessage("请选择安装对象").setPositiveButton("标识器") - .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : - AlertControlDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - //标识器 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installMarkerDialog.show() - } + if (isFreeTask) { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("正在自由巡检任务中,请完成此次任务之后再使用此功能") + .setPositiveButton("好的").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { - override fun onCancelClick() { - //电子标签 - /** - * 改为Dialog方式,避免频繁打开/关闭串口 - * */ -// installSmallMarkerDialog.show() - } - }).build().show() + } + }).build().show() + } else { + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择安装对象").setPositiveButton("标识器") + .setNegativeButton("电子标签").setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + //标识器 +// installMarkerDialog.show() + } + + override fun onCancelClick() { + //电子标签 +// installSmallMarkerDialog.show() + } + }).build().show() + } } //查看 @@ -351,24 +390,24 @@ ) { //查询数据库 lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { + markers = withContext(Dispatchers.IO) { if (contentValue.size == 1) { - DataBaseManager.get.loadLabelByCondition( + DataBaseManager.get.loadMarkerByCondition( selectedCondition, contentValue[0] - ) as ArrayList + ) as ArrayList } else { DataBaseManager.get.loadLabelByDate( contentValue[0], contentValue[1] - ) as ArrayList + ) as ArrayList } } val latitudeList = ArrayList() val longitudeList = ArrayList() - labelBeans.forEach { - val latitude = it.latitude - val longitude = it.longitude + markers.forEach { + val latitude = markers.first().lat + val longitude = markers.first().lng if (latitude.isNotBlank() && longitude.isNotBlank()) { if (CoordinateConverter.isAMapDataAvailable( latitude.toDouble(), longitude.toDouble() @@ -400,52 +439,63 @@ //巡检 binding.inspectionButton.setOnClickListener { -// val task = DataBaseManager.get.queryDistinctTask() -// if (task.isNotEmpty()) { -// val arrayList = ArrayList() -// task.forEachIndexed { index, taskBean -> -// arrayList.add("任务${index + 1}:${taskBean.taskId},${taskBean.desc}") -// } -// -// BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) -// .setActionItemTitle(arrayList) -// .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { -// override fun onActionItemClick(position: Int) { -// val taskBean = task[position] -// SaveKeyValues.putValue(LocaleConstant.TASK_ID, taskBean.taskId) -// AlertControlDialog.Builder().setContext(context).setTitle("提示") -// .setMessage("请选择操作方式").setPositiveButton("执行工单") -// .setNegativeButton("提交工单") -// .setOnDialogButtonClickListener(object : -// AlertControlDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// detectRedrawGraphic(taskBean.taskId) -// -// val latLng = LatLng( -// taskBean.lat.toDouble(), taskBean.lng.toDouble() -// ) -// aMap.moveCamera( -// CameraUpdateFactory.newLatLngZoom(latLng, 16f) -// ) -// uploadTask(taskBean.taskId, "1") -// } -// -// override fun onCancelClick() { -// uploadTask(taskBean.taskId, "2") -// } -// }).build().show() -// } -// }).build().show() -// } else { -// AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") -// .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") -// .setPositiveButton("知道了").setOnDialogButtonClickListener(object : -// AlertMessageDialog.OnDialogButtonClickListener { -// override fun onConfirmClick() { -// startFreeTask() -// } -// }).build().show() -// } + val tasks = DataBaseManager.get.loadLocalTask() + if (tasks.isNotEmpty()) { + val arrayList = ArrayList() + tasks.forEachIndexed { index, task -> + arrayList.add("任务${index + 1}:${task.taskId},${task.description}") + } + + BottomActionSheet.Builder().setContext(this).setItemTextColor(Color.BLUE) + .setActionItemTitle(arrayList) + .setOnActionSheetListener(object : BottomActionSheet.OnActionSheetListener { + override fun onActionItemClick(position: Int) { + val task = tasks[position] + Log.d(kTag, task.toJson()) + SaveKeyValues.putValue(LocaleConstant.TASK_ID, task.taskId) + SaveKeyValues.putValue(LocaleConstant.TASK_CODE, task.taskCode) + AlertControlDialog.Builder().setContext(context).setTitle("提示") + .setMessage("请选择操作方式").setPositiveButton("执行工单") + .setNegativeButton("提交工单") + .setOnDialogButtonClickListener(object : + AlertControlDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + if (task.markerModels.isNotEmpty()) { + //移到Task下属第一个标识器位置 + val firstMarker = task.markerModels.first() + val latLng = LatLng(firstMarker.lat, firstMarker.lng) + aMap.moveCamera( + CameraUpdateFactory.newLatLngZoom(latLng, 16f) + ) + //执行工单 + uploadTask(task.taskId, task.taskCode, "1") + detectRedrawGraphic(task) + isExecuteTask = true + } else { + "此工单下无标识器,将执行自由巡检任务".show(context) + freeTaskId = task.taskId + openSerialPort() + } + } + + override fun onCancelClick() { + //提交工单 + uploadTask(task.taskId, task.taskCode, "2") + isExecuteTask = false + } + }).build().show() + } + }).build().show() + } else { + AlertMessageDialog.Builder().setContext(this).setTitle("温馨提示") + .setMessage("现有任务已完成,请点击右上角菜单下载新工单或者开始自由巡检") + .setPositiveButton("知道了").setOnDialogButtonClickListener(object : + AlertMessageDialog.OnDialogButtonClickListener { + override fun onConfirmClick() { + startFreeTask() + } + }).build().show() + } } //探测 @@ -465,7 +515,7 @@ } }).build().show() } else { - searchDialog.show() + searchNewDialog.show() } } @@ -479,16 +529,21 @@ isFreeTask = false soundPool.autoPause() + //停止信号和ID搜索定时器 + signalTask?.cancel() + energyTask?.cancel() + searchMarkerTimer?.cancel() + //降低串口电位 gpioManager.setGpioLow("18") binding.stopFreeTaskButton.visibility = View.GONE - if (taskId.isNullOrBlank()) { + if (freeTaskId.isNullOrBlank()) { "任务ID异常,无法提交任务,请联系服务器管理员".show(context) return } - taskId?.apply { + freeTaskId?.apply { taskViewModel.uploadTaskMarker(context, this, ArrayList(ids)) } } @@ -497,42 +552,65 @@ } } + private fun uploadTask(taskId: String, taskCode: String, state: String) { + if (isNetworkConnected()) { + val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) + } else { + "网络连接已断开,请检查".show(this) + } + } + private fun startFreeTask() { AlertInputDialog.Builder().setContext(this).setTitle("新建自由巡检任务") .setHintMessage("请输入自由巡检任务简要描述").setNegativeButton("取消") .setPositiveButton("确定") .setOnDialogButtonClickListener(object : AlertInputDialog.OnDialogButtonClickListener { override fun onConfirmClick(value: String) { + freeTaskTitle = value val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String taskViewModel.createFreeTask(context, userId, value) - //调高串口电位 - gpioManager.setGpioHigh("18") - - isFreeTask = true - //自由巡检 - signalTask = object : TimerTask() { - override fun run() { - out?.write('2'.code) - out?.flush() - } - } - searchMarkerTimer = Timer() - searchMarkerTimer?.apply { - schedule(signalTask, 0, 100) - } - - binding.stopFreeTaskButton.visibility = View.VISIBLE + openSerialPort() } override fun onCancelClick() {} }).build().show() } + private fun openSerialPort() { + //调高串口电位 + gpioManager.setGpioHigh("18") + + isFreeTask = true + //自由巡检 + signalTask = object : TimerTask() { + override fun run() { + out.write('2'.code) + out.flush() + } + } + + energyTask = object : TimerTask() { + override fun run() { + out.write('6'.code) + out.flush() + } + } + + searchMarkerTimer = Timer() + searchMarkerTimer?.apply { + schedule(signalTask, 0, 200) + schedule(energyTask, 0, 251) + } + + binding.stopFreeTaskButton.visibility = View.VISIBLE + } + override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) + if (searchNewDialog.isDetectMarker) { + searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() if (markerId.isNumber()) { @@ -540,26 +618,47 @@ } } else if (isFreeTask) { val markerId = hex.take(20).hexToString() + if (markerId.isNumber()) { //只响一次,因为探测频率高,所以依旧是连续的报警声 soundPool.play(soundResourceId, 1f, 1f, 0, 0, 1f) - "标识器${markerId}已探测".show(this) //添加地图Marker if (!ids.contains(markerId)) { //根据markerId查询标识器经纬度 - val labels = DataBaseManager.get.queryLabelById(markerId) - if (labels.isNotEmpty()) { - val bean = labels.first() + val markers = DataBaseManager.get.queryMarkerById(markerId) + if (markers.isNotEmpty()) { + val bean = markers.first() aMap.addMarker( MarkerOptions().position( - LatLng( - bean.latitude.toDouble(), bean.longitude.toDouble() - ) + LatLng(bean.lat.toDouble(), bean.lng.toDouble()) ).icon(BitmapDescriptorFactory.fromResource(R.mipmap.label_blue1)) ) } } ids.add(markerId) + + //显示标识器详细信息 + if (!detailDialog.isShowing) { + val markerBean = DataBaseManager.get.queryMarkerById(markerId).firstOrNull() + if (markerBean == null) { + "无法查询到此ID【${markerId}】的信息".show(context) + } else { + detailDialog.setMarker(markerBean) + detailDialog.show() + } + } + } + + if (hex.startsWith("4E")) { + val energyResponse = hex.take(10).hexToString() + try { + val energy = energyResponse.substring(1).toInt() + if (energy <= 500 && detailDialog.isShowing) { + detailDialog.dismiss() + } + } catch (e: NumberFormatException) { + e.printStackTrace() + } } } } @@ -570,31 +669,21 @@ LoadState.Loading -> { if (installDialog.isInstallMarker) { LoadingDialogHub.show(this, "标识器安装中,请稍后...") - } else if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - "标识器${this.markerRealId}已探测!".show(context) -// DataBaseManager.get.updateTaskLabel(this) - } } else { LoadingDialogHub.show(this, "提交工单中,请稍后") } } - else -> { + LoadState.Success -> { if (installDialog.isInstallMarker) { -// installDialog.clearDefaultData() + installDialog.clearDefaultData() installDialog.dismiss() - "${installDialog.markerId}安装成功".show(context) + "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } } @@ -618,8 +707,6 @@ aMap.myLocationStyle = locationStyle//设置定位蓝点的Style aMap.isMyLocationEnabled = true//设置是否显示定位小蓝点 aMap.setOnMyLocationChangeListener { - longitude = it.longitude - latitude = it.latitude //经纬度逆编码 locationHub.antiCodingLocation(it) { address -> binding.currentLocationView.text = address @@ -631,19 +718,20 @@ aMap.setOnMapLongClickListener { lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } - //显示标签 - showLabelsOnMap() } //虽然不用显示附属标签,但是需要和标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } + + //显示标签 + showLabelsOnMap() } //自定义定位按钮 @@ -666,39 +754,28 @@ }) } - private fun saveTaskInformation(it: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String - if (it.message.size > 0) { - it.message.forEach { messageModel -> -// val count = DataBaseManager.get.countTaskById(messageModel.id.toString()) -// if (count == 0) { -// messageModel.taskDetailInfos.forEach { info -> -// DataBaseManager.get.insertTaskInformation( -// userName, -// messageModel.description, -// info.taskId.toString(), -// info.id.toString(), -// info.markerId.toString(), -// info.markerIdReal.toString(), -// info.longitude.toString(), -// info.latitude.toString(), -// messageModel.status -// ) -// } -// } + private fun saveUserTasks(task: TaskModel) { + task.message.forEach { model -> + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) + } } - "工单下载成功!".show(context) } + "工单下载成功!".show(this) } private fun showLabelsOnMap() { clusterOverlay?.onDestroy() val clusterItems = ArrayList() - labelBeans.forEach { - if (it.latitude.isNotEmpty() && it.longitude.isNotEmpty()) { - val latitude = it.latitude.toDouble() - val longitude = it.longitude.toDouble() + markers.forEach { + if (it.lat.isNotEmpty() && it.lng.isNotEmpty()) { + val latitude = it.lat.toDouble() + val longitude = it.lng.toDouble() val latLng = LatLng(latitude, longitude, false) val regionItem = RegionItem(latLng, it.id.toString()) @@ -717,7 +794,6 @@ ) backDrawables[0] = bitmapDrawable } - bitmapDrawable } if (clusterNum == 1) { var bitmapDrawable = backDrawables[1] @@ -780,8 +856,8 @@ override fun onActionItemClick(position: Int) { when (position) { 0 -> { - labelBeans.forEach { - if (it.markerId.toString() == item.tag) { + markers.forEach { + if (it.id.toString() == item.tag) { navigatePageTo(it.toJson()) } } @@ -789,11 +865,11 @@ 1 -> { val electricMarkers = ArrayList() -// smallLabels.forEach { -// if (it.markerId.toString() == item.tag) { -// electricMarkers.add(it.electricMarkerId) -// } -// } + smallMarkers.forEach { + if (it.id.toString() == item.tag) { + electricMarkers.add(it.electricMarkerId) + } + } if (electricMarkers.isEmpty()) { "此标识器没有绑定的电子标签".show(context) @@ -818,44 +894,32 @@ }.show() } - private fun detectRedrawGraphic(taskId: String) { -// val tasks = DataBaseManager.get.queryTaskById(taskId) -// if (tasks.isNotEmpty()) { -// tasks.forEach { -// val latLng = LatLng(it.lat.toDouble(), it.lng.toDouble()) -// val otMarkerOptions = MarkerOptions() -// otMarkerOptions.position(latLng) -// otMarkerOptions.visible(true) // 设置可见 -// if (it.state == "未开始") { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_red1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } else { -// otMarkerOptions.icon( -// BitmapDescriptorFactory.fromBitmap( -// BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) -// ) -// ).period(99).title("工单标识器").snippet(it.markerId) -// } -// aMap.addMarker(otMarkerOptions) -// } -// } + private fun detectRedrawGraphic(task: TaskDetailLocalModel) { + task.markerModels.forEach { + val latLng = LatLng(it.lat, it.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (it.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(it.markerId) + } + aMap.addMarker(otMarkerOptions) + } showLabelsOnMap() } - private fun uploadTask(taskId: String?, state: String) { - if (isNetworkConnected()) { - val userId = SaveKeyValues.getValue(LocaleConstant.USER_ID, "") as String - taskViewModel.uploadTask(userId, taskId, state) - } else { - "网络连接已断开,请检查".show(this) - } - } - //更新数据 - private fun updateLabels() { + private fun updateMarkers() { AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") .setNegativeButton("取消").setPositiveButton("确定") .setOnDialogButtonClickListener(object : @@ -941,7 +1005,7 @@ SensorManager.getOrientation(rotationMatrix, valueArray) val degree = ((360f + valueArray[0] * 180f / Math.PI) % 360).toInt() -// searchNewDialog.updateDegreeValue(degree) + searchNewDialog.updateDegreeValue(degree) } } return true @@ -953,8 +1017,8 @@ super.onResume() binding.mapView.onResume() lifecycleScope.launch { - labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabels() as ArrayList + markers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkers() as ArrayList } //显示标签 showLabelsOnMap() @@ -962,9 +1026,9 @@ //虽然不用显示附属标签,但是需要喝标签做到数据同步,所以标签重新加载数据时候附属标签也需要重新加载 lifecycleScope.launch { -// smallLabels = withContext(Dispatchers.IO) { -// DataBaseManager.get.loadSmallLabels() as ArrayList -// } + smallMarkers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadSmallMarkers() as ArrayList + } } //注册加速度传感器监听 @@ -990,8 +1054,6 @@ override fun onDestroy() { super.onDestroy() binding.mapView.onDestroy() - signalTask?.cancel() - searchMarkerTimer?.cancel() soundPool.release() locationHub.stopLocation() //降低串口电位 @@ -1006,6 +1068,7 @@ private val realPaths = ArrayList() //真实图片路径 private lateinit var imageAdapter: EditableImageAdapter private lateinit var countDownTimer: CountDownTimer + private lateinit var locationManager: LocationHub var isReadMarker = false var isInstallMarker = false @@ -1150,8 +1213,8 @@ soundPool.play(soundResourceId, 1f, 1f, 0, -1, 1f) - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() countDownTimer = object : CountDownTimer(5 * 1000, 1000) { override fun onTick(millisUntilFinished: Long) { @@ -1174,6 +1237,21 @@ } } + override fun show() { + super.show() + locationManager = LocationHub(context) + locationManager.getCurrentLocation(true, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + if (location != null) { + binding.markerAttrInclude.lngView.text = location.longitude.toString() + binding.markerAttrInclude.latView.text = location.latitude.toString() + } else { + "当前位置信号差,无法获取定位".show(context) + } + } + }) + } + fun bindingValue(markerId: String) { this.markerId = markerId LoadingDialogHub.dismiss() @@ -1193,6 +1271,7 @@ gpioManager.setGpioLow("18") soundPool.autoPause() isInstallMarker = false + locationManager.stopLocation() super.dismiss() } @@ -1515,6 +1594,21 @@ }) } + //清除默认数据 + fun clearDefaultData() { +// "markerObjectTypeView".setDefaultValue("") +// "pipelineDiameterView".setDefaultValue("") +// "buryDeepView".setDefaultValue("") +// "bottomPipeDiameterView".setDefaultValue("") +// "bottomPointDeepView".setDefaultValue("") +// "areaView".setDefaultValue("") +// "lineView".setDefaultValue("") +// "roadView".setDefaultValue("") +// "ownerView".setDefaultValue("") +// "identifierDeepView".setDefaultValue("") +// "personDeptView".setDefaultValue("") + } + //根据选择类型控制界面某些区域显隐 private fun setLayoutVisibility(vararg args: Int) { binding.objectAttrInclude.objectModeLayout.visibility = args[0] @@ -1566,21 +1660,23 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(context: Context) : Dialog(context) { + /**探测标识器新对话框******************************************************************************/ + inner class SearchMarkerNewDialog(context: Context) : Dialog(context) { - private val binding: DialogSearchMarkerBinding by binding() - private val decimal by lazy { DecimalFormat("0.0") } - private val degreeCache by lazy { HashMap() } - private var isPlaying = false + private val taskId by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_ID, "") as String + } + private val taskCode by lazy { + SaveKeyValues.getValue(LocaleConstant.TASK_CODE, "") as String + } + private val binding: DialogSearchMarkerNewBinding by binding() private var markerId = "" private lateinit var searchMarkerTimer: Timer private lateinit var signalTask: TimerTask private lateinit var energyTask: TimerTask private lateinit var countDownTimer: CountDownTimer - + private lateinit var locationManager: LocationHub var isDetectMarker = false - var taskBean: TaskBean? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -1590,47 +1686,111 @@ energyTask.cancel() searchMarkerTimer.cancel() - out?.write('3'.code) -// val result = DataBaseManager.get.queryLabelById(markerId) -// if (result.isNotEmpty()) { -// val tag = when (result.first().identifierType) { -// "EM30" -> '7' -// "EM50" -> '8' -// "EM14" -> '9' -// else -> '1' -// } -// if (tag == '1') { -// "此标识器无法读取埋深!".show(context) -// } else { -// // 发送读取标识器埋设深度指令 -// LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") -// out.write(tag.code) -// out.flush() -// countDownTimer = object : CountDownTimer(15 * 1000, 1000) { -// override fun onTick(millisUntilFinished: Long) { -// -// } -// -// override fun onFinish() { -// LoadingDialogHub.dismiss() -// "探测此标识器深度超时,请重试".show(context) -// initTimer() -// } -// } -// countDownTimer.start() -// } -// } else { -// "标识器未安装,安装成功后才可读取埋深!".show(context) -// } + out.write('3'.code) + val result = DataBaseManager.get.queryMarkerById(markerId) + if (result.isNotEmpty()) { + val tag = when (result.first().markerType) { + "EM30" -> '7' + "EM50" -> '8' + "EM14" -> '9' + else -> '1' + } + if (tag == '1') { + "此标识器无法读取埋深!".show(context) + initTimer() + } else { + // 发送读取标识器埋设深度指令 + LoadingDialogHub.show(this@MainActivity, "正在测距,请稍后...") + out.write(tag.code) + out.flush() + countDownTimer = object : CountDownTimer(15 * 1000, 1000) { + override fun onTick(millisUntilFinished: Long) { + + } + + override fun onFinish() { + LoadingDialogHub.dismiss() + "探测此标识器深度超时,请重试".show(context) + initTimer() + } + } + countDownTimer.start() + } + } else { + "标识器未安装,安装成功后才可读取埋深!".show(context) + initTimer() + } } binding.markerInfoButton.setOnClickListener { //查库 - val result = DataBaseManager.get.queryLabelById(markerId) + val result = DataBaseManager.get.queryMarkerById(markerId) if (result.isNotEmpty()) { -// context.navigatePageTo(result.first().toJson()) + context.navigatePageTo(result.first().toJson()) } else { -// context.navigatePageTo(markerId) + context.navigatePageTo(markerId) + } + } + } + + override fun show() { + super.show() + locationManager = LocationHub(context) + //点位渲染,每次定位都计算当前位置与符合条件的点距离 + locationManager.getCurrentLocation(false, object : OnGetLocationListener { + override fun onAMapLocationGet(location: AMapLocation?) { + location?.apply { + renderDataPoint(this) + } + } + }) + } + + /** + * 计算并渲染数据点。点太多采用协程计算,不然会有点卡顿 + * @param location 定位点(天宝RTK获取) + * */ + private fun renderDataPoint(location: AMapLocation) { + val longitude = location.longitude + val latitude = location.latitude + lifecycleScope.launch(Dispatchers.IO) { + val dataPoints = ArrayList() + DataBaseManager.get.loadMarkers().forEach { + val distance = AMapUtils.calculateLineDistance( + LatLng(it.lat.toDouble(), it.lng.toDouble()), LatLng(latitude, longitude) + ) + val formatDistance = decimalFormat.format(distance).toFloat() + if (formatDistance <= LocaleConstant.MAX_DISTANCE) { + val angle = atan2( + (it.lat.toDouble() - latitude), (it.lng.toDouble() - longitude) + ) + Math.PI + val formatAngle = decimalFormat.format(angle).toDouble() + + "[$longitude, $latitude,$formatDistance, $formatAngle]".writeToFile( + createLogFile() + ) + dataPoints.add(RadarScanView.DataPoint(formatAngle, formatDistance)) + } + } + withContext(Dispatchers.Main) { + binding.radarScanView.renderPointData(dataPoints, + object : RadarScanView.OnGetNearestPointCallback { + override fun getNearestPoint(point: RadarScanView.DataPoint?) { + if (point == null) { + binding.distanceValueView.text = "大于5.5m" + binding.distancePgBar.progress = 100 + } else { + binding.distanceValueView.text = "${point.distance}m" + val progress = + if (point.distance > LocaleConstant.MAX_DISTANCE) { + 100 + } else { + (point.distance / LocaleConstant.MAX_DISTANCE) * 100 + } + binding.distancePgBar.progress = progress.toInt() + } + } + }) } } } @@ -1644,60 +1804,33 @@ isDetectMarker = true - //角度 - degreeCache["lastDegree"] = 0f + if (isExecuteTask) { + binding.taskStateView.visibility = View.GONE + binding.taskStateView.isSelected = false + } else { + binding.taskStateView.visibility = View.VISIBLE + binding.taskStateView.isSelected = true + } } fun bindingValue(hex: String) { if (hex.startsWith("4E")) { try { //4E转为String为N,代表能量值 - //用能量值转动表盘 val energyResponse = hex.take(10).hexToString() val energy = energyResponse.substring(1).toInt() if (energy >= 4000) { - isPlaying = if (!isPlaying) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(fastSoundResourceId) - false - } + soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) } else { - isPlaying = if (!isPlaying) { - soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) - true - } else { - soundPool.pause(slowSoundResourceId) - false - } + soundPool.play(slowSoundResourceId, 1f, 1f, 0, 0, 1f) } - binding.resultTextView.text = "信号能量值:${energyResponse}" - - //转换为转动的角度 - val degree = (energy.toFloat() / (50 * 100)) * 180 - binding.energyValueView.text = decimal.format(degree) - - degreeCache["lastDegree"]?.apply { - val animation = RotateAnimation( - this, - degree, - Animation.RELATIVE_TO_SELF, - 0.5f, - Animation.RELATIVE_TO_SELF, - 0.5f - ) - animation.duration = 0 - animation.fillAfter = true - binding.needleView.startAnimation(animation) - } - - //保存旋转后的角度 - degreeCache["lastDegree"] = degree + //通过设置进度条表示能量值 + binding.energyPgBar.progress = energy + binding.energyValueView.text = "${energy}dB" if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" + binding.energyTipsView.text = "信号较弱,可能距离较远" binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) @@ -1712,11 +1845,11 @@ binding.searchResultView.setTextColor(Color.parseColor("#8D1717")) binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_red) } else if (energy >= 4100) {//148° - binding.energyTipsView.text = "标识器信号极强,可能在正下方" + binding.energyTipsView.text = "信号极强,接近标识器正上方" binding.energyTipsView.setTextColor(Color.parseColor("#428d00")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" + binding.energyTipsView.text = "已靠近,请继续移动位置" binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) } @@ -1757,31 +1890,37 @@ binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) //自动上传标识器 -// taskBean = DataBaseManager.get.queryTaskLabelByIdAndState(markerId, "未开始") -// taskBean?.apply { -// /** -// * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 -// * */ -// taskViewModel.uploadMarker(taskCode) -// } + if (isExecuteTask) { + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) + } + } } } } + //更新罗盘角度 + fun updateDegreeValue(degree: Int) { + binding.radarScanView.setDegreeValue(degree) + } + private fun initTimer() { searchMarkerTimer = Timer() signalTask = object : TimerTask() { override fun run() { - out?.write('2'.code) - out?.flush() + out.write('2'.code) + out.flush() } } energyTask = object : TimerTask() { override fun run() { - out?.write('6'.code) - out?.flush() + out.write('6'.code) + out.flush() } } @@ -1798,6 +1937,7 @@ gpioManager.setGpioLow("18") isDetectMarker = false soundPool.autoPause() + locationManager.stopLocation() super.dismiss() } } diff --git a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt index f092eb0..040eb10 100644 --- a/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt +++ b/app/src/main/java/com/casic/electric/detector/view/ObjectDetailActivity.kt @@ -5,7 +5,7 @@ import android.graphics.drawable.ColorDrawable import android.os.Bundle import android.view.Gravity -import com.casic.electric.detector.bean.LabelBean +import com.casic.electric.detector.bean.MarkerLocalBean import com.casic.electric.detector.databinding.ActivityObjectDetailBinding import com.casic.electric.detector.extensions.appendDownloadUrl import com.casic.electric.detector.utils.FileType @@ -23,7 +23,7 @@ private val kTag = "ObjectDetailActivity" private val context: Context = this@ObjectDetailActivity private val gson by lazy { Gson() } - private lateinit var labelBean: LabelBean + private lateinit var markerLocalBean: MarkerLocalBean override fun initOnCreate(savedInstanceState: Bundle?) { window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) @@ -36,37 +36,37 @@ val objectJson = intent.getStringExtra(Constant.INTENT_PARAM)!! try { - labelBean = gson.fromJson(objectJson, object : TypeToken() {}.type) + markerLocalBean = gson.fromJson(objectJson, object : TypeToken() {}.type) - binding.markerObjTypeView.text = labelBean.markerObjType - binding.markerNumberView.text = labelBean.markerNumber - binding.objectNameView.text = labelBean.objectName - binding.voltageLevelView.text = labelBean.voltageLevel - binding.transformerModelView.text = labelBean.transformerModel - binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial - binding.sizeView.text = labelBean.size - binding.bottomDepthView.text = labelBean.bottomDepth - binding.jointCountView.text = labelBean.jointCount - binding.casingMaterialView.text = labelBean.casingMaterial - binding.casingSpecView.text = labelBean.casingSpec - binding.constructTimeView.text = labelBean.constructTime - binding.inspectionUnitView.text = labelBean.inspectionUnit - binding.areaView.text = labelBean.area - binding.roadView.text = labelBean.road - binding.memo1View.text = labelBean.memo1 - binding.memo2View.text = labelBean.memo2 - binding.memo3View.text = labelBean.memo3 - binding.markerIdView.text = labelBean.markerId - binding.markerTypeView.text = labelBean.markerType - binding.ownerView.text = labelBean.owner - binding.markerDepthView.text = labelBean.markerDepth - binding.electricTagCountView.text = labelBean.electricTagCount - binding.installedTimeView.text = labelBean.installedTime - binding.longitudeView.text = labelBean.longitude - binding.latitudeView.text = labelBean.latitude - binding.markerMemo1View.text = labelBean.markerMemo1 - binding.markerMemo2View.text = labelBean.markerMemo2 - binding.markerMemo3View.text = labelBean.markerMemo3 +// binding.markerObjTypeView.text = labelBean.markerObjType +// binding.markerNumberView.text = labelBean.markerNumber +// binding.objectNameView.text = labelBean.objectName +// binding.voltageLevelView.text = labelBean.voltageLevel +// binding.transformerModelView.text = labelBean.transformerModel +// binding.wellCoverMaterialView.text = labelBean.wellCoverMaterial +// binding.sizeView.text = labelBean.size +// binding.bottomDepthView.text = labelBean.bottomDepth +// binding.jointCountView.text = labelBean.jointCount +// binding.casingMaterialView.text = labelBean.casingMaterial +// binding.casingSpecView.text = labelBean.casingSpec +// binding.constructTimeView.text = labelBean.constructTime +// binding.inspectionUnitView.text = labelBean.inspectionUnit +// binding.areaView.text = labelBean.area +// binding.roadView.text = labelBean.road +// binding.memo1View.text = labelBean.memo1 +// binding.memo2View.text = labelBean.memo2 +// binding.memo3View.text = labelBean.memo3 +// binding.markerIdView.text = labelBean.markerId +// binding.markerTypeView.text = labelBean.markerType +// binding.ownerView.text = labelBean.owner +// binding.markerDepthView.text = labelBean.markerDepth +// binding.electricTagCountView.text = labelBean.electricTagCount +// binding.installedTimeView.text = labelBean.installedTime +// binding.longitudeView.text = labelBean.longitude +// binding.latitudeView.text = labelBean.latitude +// binding.markerMemo1View.text = labelBean.markerMemo1 +// binding.markerMemo2View.text = labelBean.markerMemo2 +// binding.markerMemo3View.text = labelBean.markerMemo3 } catch (e: NumberFormatException) { e.printStackTrace() } @@ -77,7 +77,7 @@ binding.showImageView.setOnClickListener { //查数据库 - if (labelBean.imagePath.isNullOrEmpty()) { + if (markerLocalBean.imagePath.isNullOrEmpty()) { "此标识器无图片".show(context) } else { val realPaths: ArrayList = ArrayList() //真实图片路径 @@ -85,7 +85,7 @@ /** * /images/markers/202307/0008818922_EVENT_20230704_160349_0_1.jpg,/images/markers/202307/0008818922_EVENT_20230704_160406_0_2.jpg * */ - val imagePath = labelBean.imagePath + val imagePath = markerLocalBean.imagePath if (imagePath.contains(",")) { val list = imagePath.split(",") list.forEach { path -> diff --git a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt index ea74e8a..57c93fe 100644 --- a/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt +++ b/app/src/main/java/com/casic/electric/detector/vm/TaskViewModel.kt @@ -1,8 +1,10 @@ package com.casic.electric.detector.vm import android.content.Context +import android.util.Log import androidx.lifecycle.MutableLiveData import com.casic.electric.detector.base.BaseApplication +import com.casic.electric.detector.bean.TaskMarkerLocalBean import com.casic.electric.detector.extensions.getResponseMessage import com.casic.electric.detector.extensions.getResponseState import com.casic.electric.detector.model.MarkerFileModel @@ -21,6 +23,8 @@ import com.pengxh.kt.lite.utils.SaveKeyValues class TaskViewModel : BaseViewModel() { + + private val kTag = "TaskViewModel" private val gson by lazy { Gson() } val markerFileResult = MutableLiveData() val taskResult = MutableLiveData() @@ -165,40 +169,25 @@ loadState.value = LoadState.Fail }) - fun uploadTask(userId: String, taskId: String?, state: String) = launch({ + fun uploadTask( + context: Context, userId: String, taskId: String, taskCode: String, state: String + ) = launch({ loadState.value = LoadState.Loading val response = RetrofitServiceManager.uploadTask(userId, taskId, state) if (response.getResponseState()) { loadState.value = LoadState.Success - if (state == "2") { - "工单${taskId}已提交!".show(BaseApplication.get()) - //删除本地数据库 -// DataBaseManager.get.deleteTaskById(taskId) - SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") - } - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(BaseApplication.get()) - } - }, { - it.printStackTrace() - loadState.value = LoadState.Fail - }) - - fun uploadTask(context: Context, userId: String, taskId: String?, state: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadTask(userId, taskId, state) - if (response.getResponseState()) { - loadState.value = LoadState.Success + //工单提交之后,并且状态是2,删除本地Task记录 if (state == "2") { "工单${taskId}已提交!".show(context) //删除本地数据库 - DataBaseManager.get.deleteTaskById(taskId) + DataBaseManager.get.deleteLocalTaskById(taskId, taskCode) SaveKeyValues.putValue(LocaleConstant.TASK_ID, "") val element = JsonParser.parseString(response) val jsonObject = element.asJsonObject executeTaskResult.value = jsonObject.get("success").asString + } else { + Log.d(kTag, "uploadTask: 仅执行工单,不删除本地工单数据") } } else { loadState.value = LoadState.Fail @@ -225,17 +214,12 @@ loadState.value = LoadState.Fail }) - fun uploadMarker(context: Context, taskDetailId: String) = launch({ - loadState.value = LoadState.Loading - val response = RetrofitServiceManager.uploadMarker(taskDetailId) - if (response.getResponseState()) { - loadState.value = LoadState.Success - } else { - loadState.value = LoadState.Fail - response.getResponseMessage().show(context) - } + fun uploadMarker(context: Context, marker: TaskMarkerLocalBean) = launch({ + //主键ID代替MarkerId + RetrofitServiceManager.uploadMarker(marker.id.toString()) + "标识器${marker.markerId}已探测!".show(context) + DataBaseManager.get.updateLocalTaskMarkerState(marker) }, { it.printStackTrace() - loadState.value = LoadState.Fail }) } \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt new file mode 100644 index 0000000..e3831d6 --- /dev/null +++ b/app/src/main/java/com/casic/electric/detector/widgets/MarkerDetailDialog.kt @@ -0,0 +1,60 @@ +package com.casic.electric.detector.widgets + +import android.app.Dialog +import android.content.Context +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Bundle +import com.casic.electric.detector.R +import com.casic.electric.detector.bean.MarkerLocalBean +import com.casic.electric.detector.databinding.DialogMarkerDetailBinding +import com.casic.electric.detector.utils.LocaleConstant +import com.pengxh.kt.lite.extensions.binding +import com.pengxh.kt.lite.extensions.getScreenHeight +import com.pengxh.kt.lite.extensions.getScreenWidth + +class MarkerDetailDialog constructor(context: Context) : + Dialog(context, R.style.UserDefinedDialogStyle) { + + private lateinit var marker: MarkerLocalBean + + fun setMarker(marker: MarkerLocalBean) { + this.marker = marker + } + + private val binding: DialogMarkerDetailBinding by binding() + + private fun Dialog.initDialogLayoutParams() { + val window = this.window ?: return + window.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + window.decorView.setBackgroundColor(Color.TRANSPARENT) + val params = window.attributes + params.width = ((context.getScreenWidth() * 0.8).toInt()) + params.height = ((context.getScreenHeight() * 0.7).toInt()) + window.attributes = params + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + this.initDialogLayoutParams() + setCanceledOnTouchOutside(true) + + binding.objectTypeView.text = LocaleConstant.POINT_TYPE_ARRAY[marker.objectType.toInt() - 1] + binding.pipelineTypeView.text = marker.pipelineType + binding.pipelineDiameterView.text = marker.pipelineDiameter + binding.pipelineMaterialView.text = marker.pipelineMaterial + binding.buryMethodView.text = marker.buryMethod + binding.buryDeepView.text = marker.buryDepth + binding.areaView.text = marker.area + binding.lineView.text = marker.line + binding.roadView.text = marker.road + binding.constructTimeView.text = marker.constructTime + binding.ownerView.text = marker.owner + binding.identifierIdView.text = marker.markerId + binding.identifierTypeView.text = marker.markerType + binding.identifierDeepView.text = marker.markerDepth + binding.personView.text = marker.installationDept + binding.installTimeView.text = marker.updateTime + binding.remarkView.text = marker.remark + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt b/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt index 169147b..b6b710b 100644 --- a/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt +++ b/app/src/main/java/com/casic/electric/detector/widgets/QueryMarkerDialog.kt @@ -223,18 +223,18 @@ //查库 val autoCompleteData = HashSet() CoroutineScope(Dispatchers.Main).launch { - val labelBeans = withContext(Dispatchers.IO) { - DataBaseManager.get.loadLabelByCondition(conditionArray[position], null) + val makers = withContext(Dispatchers.IO) { + DataBaseManager.get.loadMarkerByCondition(conditionArray[position], null) } - for (labelBean in labelBeans) { + for (marker in makers) { when (position) { - 1 -> autoCompleteData.add(labelBean.markerNumber) - 2 -> autoCompleteData.add(labelBean.objectName) - 3 -> autoCompleteData.add(labelBean.area) - 4 -> autoCompleteData.add(labelBean.road) - 5 -> autoCompleteData.add(labelBean.inspectionUnit) - 6 -> autoCompleteData.add(labelBean.owner) - 8 -> autoCompleteData.add(labelBean.markerId) +// 1 -> autoCompleteData.add(marker.markerNumber) +// 2 -> autoCompleteData.add(marker.objectName) + 3 -> autoCompleteData.add(marker.area) + 4 -> autoCompleteData.add(marker.road) + 5 -> autoCompleteData.add(marker.installationDept) + 6 -> autoCompleteData.add(marker.owner) + 8 -> autoCompleteData.add(marker.markerId) } } diff --git a/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt b/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt index 372d973..7c74215 100644 --- a/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt +++ b/app/src/main/java/com/casic/electric/detector/widgets/RadarScanView.kt @@ -70,6 +70,7 @@ private lateinit var borderPaint: Paint private lateinit var shaderPaint: Paint private lateinit var dataPaint: Paint + private lateinit var targetPaint: Paint private lateinit var outerPaint: TextPaint private lateinit var outerTextPath: Path @@ -172,6 +173,12 @@ dataPaint.isAntiAlias = true dataPaint.style = Paint.Style.FILL + //最近点画笔 + targetPaint = Paint() + targetPaint.color = Color.GREEN + targetPaint.isAntiAlias = true + targetPaint.style = Paint.Style.FILL + //矩阵 matrix = Matrix() } @@ -331,9 +338,9 @@ canvas.drawCircle(it.x, it.y, 10f, dataPaint) } - //画最近的点最外层圆环 + //画最近的点 targetPoint?.apply { - canvas.drawCircle(x, y, 12f, borderPaint) + canvas.drawCircle(x, y, 10f, targetPaint) } /** @@ -394,14 +401,12 @@ * dataPoint转为PointF * */ private fun DataPoint.convertPointF(): PointF { - val dataAngle = (this.angle * Math.PI / 180).toFloat() - /** * 距离最大5.5米,表盘四个环,一个环距离1.5米,半径124dp(248px) * */ val dataDistance = (this.distance / LocaleConstant.MAX_DISTANCE) * radius - val x = dataDistance * cos(dataAngle) - val y = dataDistance * sin(dataAngle) + val x = dataDistance * cos(this.angle).toFloat() + val y = dataDistance * sin(this.angle).toFloat() return PointF(x, y) } @@ -410,5 +415,5 @@ * @param angle 数据点和圆心的方位角 * @param distance 数据点和圆心的相对距离 * */ - data class DataPoint(var angle: Int, var distance: Float) + data class DataPoint(var angle: Double, var distance: Float) } \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_progress_bar.xml b/app/src/main/res/drawable/bg_progress_bar.xml new file mode 100644 index 0000000..8a6cd5f --- /dev/null +++ b/app/src/main/res/drawable/bg_progress_bar.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/dialog_marker_detail.xml b/app/src/main/res/layout/dialog_marker_detail.xml new file mode 100644 index 0000000..651d755 --- /dev/null +++ b/app/src/main/res/layout/dialog_marker_detail.xml @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_search_marker_new.xml b/app/src/main/res/layout/dialog_search_marker_new.xml new file mode 100644 index 0000000..20bf4ac --- /dev/null +++ b/app/src/main/res/layout/dialog_search_marker_new.xml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +