diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..d7cb739 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,218 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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 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 + } + + /** + * 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); + } + } + + @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); + } + } + + @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 + ); + 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)); + } + + @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/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..d7cb739 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,218 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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 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 + } + + /** + * 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); + } + } + + @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); + } + } + + @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 + ); + 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)); + } + + @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/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..2de65b9 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,202 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..d7cb739 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,218 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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 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 + } + + /** + * 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); + } + } + + @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); + } + } + + @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 + ); + 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)); + } + + @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/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..2de65b9 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,202 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..b485eda --- /dev/null +++ b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,138 @@ +package com.casic.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 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 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/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..d7cb739 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,218 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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 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 + } + + /** + * 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); + } + } + + @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); + } + } + + @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 + ); + 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)); + } + + @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/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..2de65b9 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,202 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..b485eda --- /dev/null +++ b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,138 @@ +package com.casic.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 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 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/detector/model/TaskModel.java b/app/src/main/java/com/casic/detector/model/TaskModel.java index 4530941..ed842f3 100644 --- a/app/src/main/java/com/casic/detector/model/TaskModel.java +++ b/app/src/main/java/com/casic/detector/model/TaskModel.java @@ -28,8 +28,8 @@ private String taskCode; private String description; private String deployDate; - private Object beginDate; - private Object endDate; + private String beginDate; + private String endDate; private String status; private String creatorId; private String creatorName; @@ -70,19 +70,19 @@ this.deployDate = deployDate; } - public Object getBeginDate() { + public String getBeginDate() { return beginDate; } - public void setBeginDate(Object beginDate) { + public void setBeginDate(String beginDate) { this.beginDate = beginDate; } - public Object getEndDate() { + public String getEndDate() { return endDate; } - public void setEndDate(Object endDate) { + public void setEndDate(String endDate) { this.endDate = endDate; } diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..d7cb739 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,218 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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 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 + } + + /** + * 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); + } + } + + @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); + } + } + + @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 + ); + 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)); + } + + @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/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..2de65b9 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,202 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..b485eda --- /dev/null +++ b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,138 @@ +package com.casic.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 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 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/detector/model/TaskModel.java b/app/src/main/java/com/casic/detector/model/TaskModel.java index 4530941..ed842f3 100644 --- a/app/src/main/java/com/casic/detector/model/TaskModel.java +++ b/app/src/main/java/com/casic/detector/model/TaskModel.java @@ -28,8 +28,8 @@ private String taskCode; private String description; private String deployDate; - private Object beginDate; - private Object endDate; + private String beginDate; + private String endDate; private String status; private String creatorId; private String creatorName; @@ -70,19 +70,19 @@ this.deployDate = deployDate; } - public Object getBeginDate() { + public String getBeginDate() { return beginDate; } - public void setBeginDate(Object beginDate) { + public void setBeginDate(String beginDate) { this.beginDate = beginDate; } - public Object getEndDate() { + public String getEndDate() { return endDate; } - public void setEndDate(Object endDate) { + public void setEndDate(String endDate) { this.endDate = endDate; } diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt index 2be5e7b..440a648 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt @@ -30,16 +30,10 @@ ): String /** - * 获取标识器图片 - */ - @POST("/ems/marker/get-marker-images.do") - suspend fun getLabelPicture(@Body requestBody: RequestBody): String - - /** * 获取巡检工单 */ @GET("/ems/rs/task/get") - suspend fun getTask(@Query("userName") userName: String): String + suspend fun getTasksByUser(@Query("userName") userName: String): String /** * 提交工单 @@ -77,12 +71,12 @@ ): String /** + * TODO 返回值为空,待调整 * 上传工单中标识器信息 - * info中的主键 */ @GET("/ems/rs/task/update-task-mark") suspend fun uploadMarker( - @Query("taskDetailId") taskId: String + @Query("taskDetailId") markerId: String ): String /** diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..d7cb739 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,218 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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 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 + } + + /** + * 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); + } + } + + @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); + } + } + + @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 + ); + 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)); + } + + @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/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..2de65b9 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,202 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..b485eda --- /dev/null +++ b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,138 @@ +package com.casic.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 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 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/detector/model/TaskModel.java b/app/src/main/java/com/casic/detector/model/TaskModel.java index 4530941..ed842f3 100644 --- a/app/src/main/java/com/casic/detector/model/TaskModel.java +++ b/app/src/main/java/com/casic/detector/model/TaskModel.java @@ -28,8 +28,8 @@ private String taskCode; private String description; private String deployDate; - private Object beginDate; - private Object endDate; + private String beginDate; + private String endDate; private String status; private String creatorId; private String creatorName; @@ -70,19 +70,19 @@ this.deployDate = deployDate; } - public Object getBeginDate() { + public String getBeginDate() { return beginDate; } - public void setBeginDate(Object beginDate) { + public void setBeginDate(String beginDate) { this.beginDate = beginDate; } - public Object getEndDate() { + public String getEndDate() { return endDate; } - public void setEndDate(Object endDate) { + public void setEndDate(String endDate) { this.endDate = endDate; } diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt index 2be5e7b..440a648 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt @@ -30,16 +30,10 @@ ): String /** - * 获取标识器图片 - */ - @POST("/ems/marker/get-marker-images.do") - suspend fun getLabelPicture(@Body requestBody: RequestBody): String - - /** * 获取巡检工单 */ @GET("/ems/rs/task/get") - suspend fun getTask(@Query("userName") userName: String): String + suspend fun getTasksByUser(@Query("userName") userName: String): String /** * 提交工单 @@ -77,12 +71,12 @@ ): String /** + * TODO 返回值为空,待调整 * 上传工单中标识器信息 - * info中的主键 */ @GET("/ems/rs/task/update-task-mark") suspend fun uploadMarker( - @Query("taskDetailId") taskId: String + @Query("taskDetailId") markerId: String ): String /** diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt index 143fb8b..f87932a 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt @@ -52,24 +52,12 @@ return createApi().getMarkerFile(userId, companyId) } - /** - * 获取标识器图片 - */ - suspend fun getLabelPicture(markerId: String): String { - val param = JsonObject() - param.addProperty("markerId", markerId) - val requestBody = param.toString().toRequestBody( - "application/json;charset=UTF-8".toMediaType() - ) - - return createApi().getLabelPicture(requestBody) - } /** * 获取巡检工单 */ - suspend fun getTask(userName: String): String { - return createApi().getTask(userName) + suspend fun getTasksByUser(userName: String): String { + return createApi().getTasksByUser(userName) } /** @@ -225,8 +213,8 @@ /** * 上传工单中标识器信息 */ - suspend fun uploadMarker(taskDetailId: String): String { - return createApi().uploadMarker(taskDetailId) + suspend fun uploadMarker(markerId: String): String { + return createApi().uploadMarker(markerId) } /** diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..d7cb739 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,218 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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 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 + } + + /** + * 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); + } + } + + @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); + } + } + + @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 + ); + 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)); + } + + @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/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..2de65b9 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,202 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..b485eda --- /dev/null +++ b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,138 @@ +package com.casic.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 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 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/detector/model/TaskModel.java b/app/src/main/java/com/casic/detector/model/TaskModel.java index 4530941..ed842f3 100644 --- a/app/src/main/java/com/casic/detector/model/TaskModel.java +++ b/app/src/main/java/com/casic/detector/model/TaskModel.java @@ -28,8 +28,8 @@ private String taskCode; private String description; private String deployDate; - private Object beginDate; - private Object endDate; + private String beginDate; + private String endDate; private String status; private String creatorId; private String creatorName; @@ -70,19 +70,19 @@ this.deployDate = deployDate; } - public Object getBeginDate() { + public String getBeginDate() { return beginDate; } - public void setBeginDate(Object beginDate) { + public void setBeginDate(String beginDate) { this.beginDate = beginDate; } - public Object getEndDate() { + public String getEndDate() { return endDate; } - public void setEndDate(Object endDate) { + public void setEndDate(String endDate) { this.endDate = endDate; } diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt index 2be5e7b..440a648 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt @@ -30,16 +30,10 @@ ): String /** - * 获取标识器图片 - */ - @POST("/ems/marker/get-marker-images.do") - suspend fun getLabelPicture(@Body requestBody: RequestBody): String - - /** * 获取巡检工单 */ @GET("/ems/rs/task/get") - suspend fun getTask(@Query("userName") userName: String): String + suspend fun getTasksByUser(@Query("userName") userName: String): String /** * 提交工单 @@ -77,12 +71,12 @@ ): String /** + * TODO 返回值为空,待调整 * 上传工单中标识器信息 - * info中的主键 */ @GET("/ems/rs/task/update-task-mark") suspend fun uploadMarker( - @Query("taskDetailId") taskId: String + @Query("taskDetailId") markerId: String ): String /** diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt index 143fb8b..f87932a 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt @@ -52,24 +52,12 @@ return createApi().getMarkerFile(userId, companyId) } - /** - * 获取标识器图片 - */ - suspend fun getLabelPicture(markerId: String): String { - val param = JsonObject() - param.addProperty("markerId", markerId) - val requestBody = param.toString().toRequestBody( - "application/json;charset=UTF-8".toMediaType() - ) - - return createApi().getLabelPicture(requestBody) - } /** * 获取巡检工单 */ - suspend fun getTask(userName: String): String { - return createApi().getTask(userName) + suspend fun getTasksByUser(userName: String): String { + return createApi().getTasksByUser(userName) } /** @@ -225,8 +213,8 @@ /** * 上传工单中标识器信息 */ - suspend fun uploadMarker(taskDetailId: String): String { - return createApi().uploadMarker(taskDetailId) + suspend fun uploadMarker(markerId: String): String { + return createApi().uploadMarker(markerId) } /** diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index 446f2f8..67d4f53 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -3,10 +3,14 @@ import com.casic.detector.base.BaseApplication import com.casic.detector.bean.LabelBean import com.casic.detector.bean.PipeLocalBean -import com.casic.detector.bean.TaskBean +import com.casic.detector.bean.TaskLocalBean +import com.casic.detector.bean.TaskMarkerLocalBean import com.casic.detector.greendao.LabelBeanDao -import com.casic.detector.greendao.TaskBeanDao +import com.casic.detector.greendao.TaskLocalBeanDao +import com.casic.detector.greendao.TaskMarkerLocalBeanDao import com.casic.detector.model.PipelineModel +import com.casic.detector.model.TaskDetailLocalModel +import com.casic.detector.model.TaskModel class DataBaseManager private constructor() { companion object { @@ -16,8 +20,162 @@ } } + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + 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 = "" + } + 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 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 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 + + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + val markers = ArrayList() + 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 + } + + 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 + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + + fun queryTaskById(taskId: String, taskCode: String): TaskDetailLocalModel? { + val taskLocalBean = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return null + + val model = TaskDetailLocalModel() + model.taskId = taskId + model.taskCode = taskCode + model.description = taskLocalBean.description + model.createTime = taskLocalBean.createTime + model.status = taskLocalBean.status + model.createUserName = taskLocalBean.createUserName + + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(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 + } + + return model + } + + 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) + } + +// ============================================================================================= + private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var taskBeanDao = BaseApplication.get().getDaoSession().taskBeanDao private val pipeLocalBeanDao = BaseApplication.get().getDaoSession().pipeLocalBeanDao fun clearTaskLabels() { @@ -56,73 +214,6 @@ .list() } - fun clearTasks() { - taskBeanDao.deleteAll() - } - - fun insertTask( - scanner: String, - desc: String, - taskId: String, - taskCode: String, - markerId: String, - markerRealId: String, - lng: String, - lat: String, - state: String - ) { - val task = TaskBean() - task.scanner = scanner - task.desc = desc - task.taskId = taskId - task.taskCode = taskCode - task.markerId = markerId - task.markerRealId = markerRealId - task.lng = lng - task.lat = lat - task.state = state - - taskBeanDao.insert(task) - } - - fun queryDistinctTask(): List { - val result = ArrayList() - taskBeanDao.loadAll().forEach { - result.add(it) - } - //根据TaskId去重 - return result.distinctBy { it.taskId } - } - - fun queryTaskById(taskId: String): List { - return taskBeanDao.queryBuilder().where(TaskBeanDao.Properties.TaskId.eq(taskId)).list() - } - - fun queryTaskMarkerById(markerId: String, state: String): TaskBean? { - return taskBeanDao.queryBuilder() - .where( - TaskBeanDao.Properties.MarkerRealId.eq(markerId), - TaskBeanDao.Properties.State.eq(state) - ).list().firstOrNull() - } - - fun updateTaskLabel(taskBean: TaskBean?) { - if (taskBean == null) { - return - } - taskBean.state = "已探测" - taskBeanDao.update(taskBean) - } - - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } - queryTaskById(taskId).forEach { - taskBeanDao.delete(it) - } - } - /** * 清除管线本地缓存 * */ diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..d7cb739 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,218 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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 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 + } + + /** + * 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); + } + } + + @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); + } + } + + @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 + ); + 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)); + } + + @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/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..2de65b9 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,202 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..b485eda --- /dev/null +++ b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,138 @@ +package com.casic.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 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 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/detector/model/TaskModel.java b/app/src/main/java/com/casic/detector/model/TaskModel.java index 4530941..ed842f3 100644 --- a/app/src/main/java/com/casic/detector/model/TaskModel.java +++ b/app/src/main/java/com/casic/detector/model/TaskModel.java @@ -28,8 +28,8 @@ private String taskCode; private String description; private String deployDate; - private Object beginDate; - private Object endDate; + private String beginDate; + private String endDate; private String status; private String creatorId; private String creatorName; @@ -70,19 +70,19 @@ this.deployDate = deployDate; } - public Object getBeginDate() { + public String getBeginDate() { return beginDate; } - public void setBeginDate(Object beginDate) { + public void setBeginDate(String beginDate) { this.beginDate = beginDate; } - public Object getEndDate() { + public String getEndDate() { return endDate; } - public void setEndDate(Object endDate) { + public void setEndDate(String endDate) { this.endDate = endDate; } diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt index 2be5e7b..440a648 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt @@ -30,16 +30,10 @@ ): String /** - * 获取标识器图片 - */ - @POST("/ems/marker/get-marker-images.do") - suspend fun getLabelPicture(@Body requestBody: RequestBody): String - - /** * 获取巡检工单 */ @GET("/ems/rs/task/get") - suspend fun getTask(@Query("userName") userName: String): String + suspend fun getTasksByUser(@Query("userName") userName: String): String /** * 提交工单 @@ -77,12 +71,12 @@ ): String /** + * TODO 返回值为空,待调整 * 上传工单中标识器信息 - * info中的主键 */ @GET("/ems/rs/task/update-task-mark") suspend fun uploadMarker( - @Query("taskDetailId") taskId: String + @Query("taskDetailId") markerId: String ): String /** diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt index 143fb8b..f87932a 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt @@ -52,24 +52,12 @@ return createApi().getMarkerFile(userId, companyId) } - /** - * 获取标识器图片 - */ - suspend fun getLabelPicture(markerId: String): String { - val param = JsonObject() - param.addProperty("markerId", markerId) - val requestBody = param.toString().toRequestBody( - "application/json;charset=UTF-8".toMediaType() - ) - - return createApi().getLabelPicture(requestBody) - } /** * 获取巡检工单 */ - suspend fun getTask(userName: String): String { - return createApi().getTask(userName) + suspend fun getTasksByUser(userName: String): String { + return createApi().getTasksByUser(userName) } /** @@ -225,8 +213,8 @@ /** * 上传工单中标识器信息 */ - suspend fun uploadMarker(taskDetailId: String): String { - return createApi().uploadMarker(taskDetailId) + suspend fun uploadMarker(markerId: String): String { + return createApi().uploadMarker(markerId) } /** diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index 446f2f8..67d4f53 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -3,10 +3,14 @@ import com.casic.detector.base.BaseApplication import com.casic.detector.bean.LabelBean import com.casic.detector.bean.PipeLocalBean -import com.casic.detector.bean.TaskBean +import com.casic.detector.bean.TaskLocalBean +import com.casic.detector.bean.TaskMarkerLocalBean import com.casic.detector.greendao.LabelBeanDao -import com.casic.detector.greendao.TaskBeanDao +import com.casic.detector.greendao.TaskLocalBeanDao +import com.casic.detector.greendao.TaskMarkerLocalBeanDao import com.casic.detector.model.PipelineModel +import com.casic.detector.model.TaskDetailLocalModel +import com.casic.detector.model.TaskModel class DataBaseManager private constructor() { companion object { @@ -16,8 +20,162 @@ } } + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + 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 = "" + } + 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 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 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 + + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + val markers = ArrayList() + 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 + } + + 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 + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + + fun queryTaskById(taskId: String, taskCode: String): TaskDetailLocalModel? { + val taskLocalBean = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return null + + val model = TaskDetailLocalModel() + model.taskId = taskId + model.taskCode = taskCode + model.description = taskLocalBean.description + model.createTime = taskLocalBean.createTime + model.status = taskLocalBean.status + model.createUserName = taskLocalBean.createUserName + + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(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 + } + + return model + } + + 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) + } + +// ============================================================================================= + private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var taskBeanDao = BaseApplication.get().getDaoSession().taskBeanDao private val pipeLocalBeanDao = BaseApplication.get().getDaoSession().pipeLocalBeanDao fun clearTaskLabels() { @@ -56,73 +214,6 @@ .list() } - fun clearTasks() { - taskBeanDao.deleteAll() - } - - fun insertTask( - scanner: String, - desc: String, - taskId: String, - taskCode: String, - markerId: String, - markerRealId: String, - lng: String, - lat: String, - state: String - ) { - val task = TaskBean() - task.scanner = scanner - task.desc = desc - task.taskId = taskId - task.taskCode = taskCode - task.markerId = markerId - task.markerRealId = markerRealId - task.lng = lng - task.lat = lat - task.state = state - - taskBeanDao.insert(task) - } - - fun queryDistinctTask(): List { - val result = ArrayList() - taskBeanDao.loadAll().forEach { - result.add(it) - } - //根据TaskId去重 - return result.distinctBy { it.taskId } - } - - fun queryTaskById(taskId: String): List { - return taskBeanDao.queryBuilder().where(TaskBeanDao.Properties.TaskId.eq(taskId)).list() - } - - fun queryTaskMarkerById(markerId: String, state: String): TaskBean? { - return taskBeanDao.queryBuilder() - .where( - TaskBeanDao.Properties.MarkerRealId.eq(markerId), - TaskBeanDao.Properties.State.eq(state) - ).list().firstOrNull() - } - - fun updateTaskLabel(taskBean: TaskBean?) { - if (taskBean == null) { - return - } - taskBean.state = "已探测" - taskBeanDao.update(taskBean) - } - - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } - queryTaskById(taskId).forEach { - taskBeanDao.delete(it) - } - } - /** * 清除管线本地缓存 * */ diff --git a/app/src/main/java/com/casic/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/detector/utils/LocaleConstant.kt index f80138e..f6f659c 100644 --- a/app/src/main/java/com/casic/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/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.detector.fileprovider" diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..d7cb739 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,218 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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 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 + } + + /** + * 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); + } + } + + @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); + } + } + + @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 + ); + 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)); + } + + @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/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..2de65b9 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,202 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..b485eda --- /dev/null +++ b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,138 @@ +package com.casic.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 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 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/detector/model/TaskModel.java b/app/src/main/java/com/casic/detector/model/TaskModel.java index 4530941..ed842f3 100644 --- a/app/src/main/java/com/casic/detector/model/TaskModel.java +++ b/app/src/main/java/com/casic/detector/model/TaskModel.java @@ -28,8 +28,8 @@ private String taskCode; private String description; private String deployDate; - private Object beginDate; - private Object endDate; + private String beginDate; + private String endDate; private String status; private String creatorId; private String creatorName; @@ -70,19 +70,19 @@ this.deployDate = deployDate; } - public Object getBeginDate() { + public String getBeginDate() { return beginDate; } - public void setBeginDate(Object beginDate) { + public void setBeginDate(String beginDate) { this.beginDate = beginDate; } - public Object getEndDate() { + public String getEndDate() { return endDate; } - public void setEndDate(Object endDate) { + public void setEndDate(String endDate) { this.endDate = endDate; } diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt index 2be5e7b..440a648 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt @@ -30,16 +30,10 @@ ): String /** - * 获取标识器图片 - */ - @POST("/ems/marker/get-marker-images.do") - suspend fun getLabelPicture(@Body requestBody: RequestBody): String - - /** * 获取巡检工单 */ @GET("/ems/rs/task/get") - suspend fun getTask(@Query("userName") userName: String): String + suspend fun getTasksByUser(@Query("userName") userName: String): String /** * 提交工单 @@ -77,12 +71,12 @@ ): String /** + * TODO 返回值为空,待调整 * 上传工单中标识器信息 - * info中的主键 */ @GET("/ems/rs/task/update-task-mark") suspend fun uploadMarker( - @Query("taskDetailId") taskId: String + @Query("taskDetailId") markerId: String ): String /** diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt index 143fb8b..f87932a 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt @@ -52,24 +52,12 @@ return createApi().getMarkerFile(userId, companyId) } - /** - * 获取标识器图片 - */ - suspend fun getLabelPicture(markerId: String): String { - val param = JsonObject() - param.addProperty("markerId", markerId) - val requestBody = param.toString().toRequestBody( - "application/json;charset=UTF-8".toMediaType() - ) - - return createApi().getLabelPicture(requestBody) - } /** * 获取巡检工单 */ - suspend fun getTask(userName: String): String { - return createApi().getTask(userName) + suspend fun getTasksByUser(userName: String): String { + return createApi().getTasksByUser(userName) } /** @@ -225,8 +213,8 @@ /** * 上传工单中标识器信息 */ - suspend fun uploadMarker(taskDetailId: String): String { - return createApi().uploadMarker(taskDetailId) + suspend fun uploadMarker(markerId: String): String { + return createApi().uploadMarker(markerId) } /** diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index 446f2f8..67d4f53 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -3,10 +3,14 @@ import com.casic.detector.base.BaseApplication import com.casic.detector.bean.LabelBean import com.casic.detector.bean.PipeLocalBean -import com.casic.detector.bean.TaskBean +import com.casic.detector.bean.TaskLocalBean +import com.casic.detector.bean.TaskMarkerLocalBean import com.casic.detector.greendao.LabelBeanDao -import com.casic.detector.greendao.TaskBeanDao +import com.casic.detector.greendao.TaskLocalBeanDao +import com.casic.detector.greendao.TaskMarkerLocalBeanDao import com.casic.detector.model.PipelineModel +import com.casic.detector.model.TaskDetailLocalModel +import com.casic.detector.model.TaskModel class DataBaseManager private constructor() { companion object { @@ -16,8 +20,162 @@ } } + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + 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 = "" + } + 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 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 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 + + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + val markers = ArrayList() + 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 + } + + 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 + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + + fun queryTaskById(taskId: String, taskCode: String): TaskDetailLocalModel? { + val taskLocalBean = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return null + + val model = TaskDetailLocalModel() + model.taskId = taskId + model.taskCode = taskCode + model.description = taskLocalBean.description + model.createTime = taskLocalBean.createTime + model.status = taskLocalBean.status + model.createUserName = taskLocalBean.createUserName + + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(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 + } + + return model + } + + 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) + } + +// ============================================================================================= + private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var taskBeanDao = BaseApplication.get().getDaoSession().taskBeanDao private val pipeLocalBeanDao = BaseApplication.get().getDaoSession().pipeLocalBeanDao fun clearTaskLabels() { @@ -56,73 +214,6 @@ .list() } - fun clearTasks() { - taskBeanDao.deleteAll() - } - - fun insertTask( - scanner: String, - desc: String, - taskId: String, - taskCode: String, - markerId: String, - markerRealId: String, - lng: String, - lat: String, - state: String - ) { - val task = TaskBean() - task.scanner = scanner - task.desc = desc - task.taskId = taskId - task.taskCode = taskCode - task.markerId = markerId - task.markerRealId = markerRealId - task.lng = lng - task.lat = lat - task.state = state - - taskBeanDao.insert(task) - } - - fun queryDistinctTask(): List { - val result = ArrayList() - taskBeanDao.loadAll().forEach { - result.add(it) - } - //根据TaskId去重 - return result.distinctBy { it.taskId } - } - - fun queryTaskById(taskId: String): List { - return taskBeanDao.queryBuilder().where(TaskBeanDao.Properties.TaskId.eq(taskId)).list() - } - - fun queryTaskMarkerById(markerId: String, state: String): TaskBean? { - return taskBeanDao.queryBuilder() - .where( - TaskBeanDao.Properties.MarkerRealId.eq(markerId), - TaskBeanDao.Properties.State.eq(state) - ).list().firstOrNull() - } - - fun updateTaskLabel(taskBean: TaskBean?) { - if (taskBean == null) { - return - } - taskBean.state = "已探测" - taskBeanDao.update(taskBean) - } - - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } - queryTaskById(taskId).forEach { - taskBeanDao.delete(it) - } - } - /** * 清除管线本地缓存 * */ diff --git a/app/src/main/java/com/casic/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/detector/utils/LocaleConstant.kt index f80138e..f6f659c 100644 --- a/app/src/main/java/com/casic/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/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.detector.fileprovider" diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt index 40ba172..22de557 100644 --- a/app/src/main/java/com/casic/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt @@ -21,8 +21,6 @@ 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 @@ -41,7 +39,7 @@ import com.casic.detector.adapter.EditableImageAdapter import com.casic.detector.base.SerialPortActivity import com.casic.detector.bean.LabelBean -import com.casic.detector.bean.TaskBean +import com.casic.detector.bean.TaskMarkerLocalBean import com.casic.detector.callback.OnGetLocationListener import com.casic.detector.callback.OnImageCompressListener import com.casic.detector.cluster.ClusterItem @@ -49,7 +47,6 @@ import com.casic.detector.cluster.RegionItem import com.casic.detector.databinding.ActivityMainBinding import com.casic.detector.databinding.DialogInstallMarkerBinding -import com.casic.detector.databinding.DialogSearchMarkerBinding import com.casic.detector.databinding.DialogSearchMarkerNewBinding import com.casic.detector.extensions.appendDownloadUrl import com.casic.detector.extensions.calculateAngle @@ -64,6 +61,7 @@ import com.casic.detector.extensions.toColor import com.casic.detector.extensions.toHex import com.casic.detector.extensions.toObjectType +import com.casic.detector.model.TaskDetailLocalModel import com.casic.detector.model.TaskModel import com.casic.detector.utils.DataBaseManager import com.casic.detector.utils.ExcelHub @@ -112,7 +110,6 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File -import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer @@ -128,7 +125,6 @@ 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 lineViewModel by lazy { ViewModelProvider(this)[PipelineViewModel::class.java] } @@ -145,11 +141,10 @@ 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 @@ -229,19 +224,17 @@ } 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() { - saveTask(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { freeTaskId = it } taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -416,40 +409,46 @@ //巡检 binding.inspectionButton.setOnClickListener { - val tasks = DataBaseManager.get.queryDistinctTask() + val tasks = DataBaseManager.get.loadLocalTask() if (tasks.isNotEmpty()) { val arrayList = ArrayList() - tasks.forEachIndexed { index, bean -> - arrayList.add("任务${index + 1}:${bean.taskId},${bean.desc}") + 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) { - task = tasks[position] + 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() { - val latLng = LatLng( - task.lat.toDouble(), task.lng.toDouble() - ) - aMap.moveCamera( - CameraUpdateFactory.newLatLngZoom(latLng, 16f) - ) - //执行工单 - uploadTask(task.taskId, "1") - detectRedrawGraphic(task.taskId) - isExecuteTask = true + 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) + } } override fun onCancelClick() { //提交工单 - uploadTask(task.taskId, "2") + uploadTask(task.taskId, task.taskCode, "2") isExecuteTask = false } }).build().show() @@ -509,12 +508,12 @@ 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)) } } @@ -523,10 +522,10 @@ } } - private fun uploadTask(taskId: String?, state: String) { + 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, state) + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) } else { "网络连接已断开,请检查".show(this) } @@ -576,9 +575,7 @@ override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() // Log.d(kTag, "$kTag => $hex") - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) - } else if (searchNewDialog.isDetectMarker) { + if (searchNewDialog.isDetectMarker) { searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() @@ -638,31 +635,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.dismiss() "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } @@ -755,23 +742,14 @@ }) } - private fun saveTask(task: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + private fun saveUserTasks(task: TaskModel) { task.message.forEach { model -> - model.taskDetailInfos.forEach { info -> - //只保存有b标识器ID得数据 - if (!info.markerIdReal.isNullOrBlank()) { - DataBaseManager.get.insertTask( - userName, - model.description, - info.taskId.toString(), - info.id.toString(), - info.markerId.toString(), - info.markerIdReal.toString(), - info.longitude.toString(), - info.latitude.toString(), - model.status - ) + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) } } } @@ -880,33 +858,52 @@ } } - 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 detectRedrawGraphic(marker: TaskMarkerLocalBean) { + val latLng = LatLng(marker.lat, marker.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (marker.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(marker.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(marker.markerId) + } + aMap.addMarker(otMarkerOptions) + showLabelsOnMap() + } + //更新管线数据 // private fun updatePipeline() { // AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") @@ -959,7 +956,7 @@ private fun downloadTask() { if (isNetworkConnected()) { val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") - taskViewModel.getTask(this, userName.toString()) + taskViewModel.getTasksByUser(this, userName.toString()) } else { "网络连接已断开,请检查".show(this) } @@ -1575,242 +1572,15 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(private val 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 markerId = "" - private lateinit var searchMarkerTimer: Timer - private lateinit var signalTask: TimerTask - private lateinit var energyTask: TimerTask - private lateinit var countDownTimer: CountDownTimer - - var isDetectMarker = false - var taskBean: TaskBean? = null - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - this.initDialogLayoutParams(1f) - binding.depthButton.setOnClickListener { - signalTask.cancel() - 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) - } - } - - binding.markerInfoButton.setOnClickListener { - //查库 - val result = DataBaseManager.get.queryLabelById(markerId) - if (result.isNotEmpty()) { - context.navigatePageTo(result.first().toJson()) - } else { - context.navigatePageTo(markerId) - } - } - } - - override fun onStart() { - super.onStart() - //调高串口电位 - gpioManager.setGpioHigh("18") - - initTimer() - - 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) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - } else { - 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 - - if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" - binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) - binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) - - binding.depthButton.isEnabled = false - binding.depthButton.setTextColor(Color.parseColor("#CCCCCC")) - binding.depthButton.setBackgroundResource(R.mipmap.left_button_disable) - binding.markerInfoButton.isEnabled = false - binding.markerInfoButton.setTextColor(Color.parseColor("#CCCCCC")) - binding.markerInfoButton.setBackgroundResource(R.mipmap.right_button_disable) - - binding.searchResultView.text = "未检测到标识器" - 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.setTextColor(Color.parseColor("#428d00")) - binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) - } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" - binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) - binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) - } - } catch (e: NumberFormatException) { - e.printStackTrace() - } - } else if (hex.startsWith("53")) { - LoadingDialogHub.dismiss() - countDownTimer.cancel() - try { - val depthResponse = hex.take(10).hexToString() - val depth = depthResponse.drop(2).toInt() - AlertMessageDialog.Builder().setContext(context).setTitle("温馨提示") - .setMessage("标识器埋深:${depth}厘米").setPositiveButton("知道了") - .setOnDialogButtonClickListener(object : - AlertMessageDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - initTimer() - } - }).build().show() - } catch (e: NumberFormatException) { - e.printStackTrace() - } - } else { - val id = hex.take(20).hexToString() - if (id.isNumber()) { - markerId = id - - binding.depthButton.isEnabled = true - binding.depthButton.setTextColor(Color.WHITE) - binding.depthButton.setBackgroundResource(R.mipmap.left_button_enable) - binding.markerInfoButton.isEnabled = true - binding.markerInfoButton.setTextColor(Color.WHITE) - binding.markerInfoButton.setBackgroundResource(R.mipmap.right_button_enable) - - binding.searchResultView.text = "已检测到标识器" - binding.searchResultView.setTextColor(Color.parseColor("#428d00")) - binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) - - //工单开始后才自动上传标识器 - if (isExecuteTask) { - taskBean = DataBaseManager.get.queryTaskMarkerById(markerId, "未开始") - taskBean?.apply { - /** - * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 - * */ - taskViewModel.uploadMarker(context, taskCode) - } - } - } - } - } - - private fun initTimer() { - searchMarkerTimer = Timer() - - 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.schedule(signalTask, 0, 201) - searchMarkerTimer.schedule(energyTask, 0, 251) - } - - override fun dismiss() { - signalTask.cancel() - energyTask.cancel() - searchMarkerTimer.cancel() - //降低串口电位 - gpioManager.setGpioLow("18") - isDetectMarker = false - soundPool.autoPause() - super.dismiss() - } - } - /**探测标识器新对话框****************************************************************************/ inner class SearchMarkerNewDialog(private val context: Context) : Dialog(context) { + 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 @@ -2024,12 +1794,11 @@ //自动上传标识器 if (isExecuteTask) { - val taskBean = DataBaseManager.get.queryTaskMarkerById(markerId, "未开始") - taskBean?.apply { - /** - * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 - * */ - taskViewModel.uploadMarker(context, taskCode) + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) } } } diff --git a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java b/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java deleted file mode 100644 index 0229aca..0000000 --- a/app/src/main/java/com/casic/detector/bean/SmallLabelBean.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.casic.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 locationNo; - // 位置点名称 - private String locationName; - // 电子标签ID号 - private String smallMarkerId; - // 电缆名称 - private String cableName; - // 电缆编号 - private String cableNo; - // 所属线路 - private String line; - // 电压等级 - private String pressLevel; - // 电缆型号 - private String cableType; - // 电缆规格 - private String cableSpec; - // 电缆品牌 - private String cableBrand; - // 电缆起点 - private String cableStart; - // 电缆终点 - private String cableEnd; - // 中间接头 - private String hasJoint; - // 中间接头制作人 - private String jointCreator; - // 安装时间 - private String createTime; - // 照片路径 - private String path; - // 备注1 - private String memo1; - // 备注2 - private String memo2; - // 备注3 - private String memo3; - - @Generated(hash = 732551726) - public SmallLabelBean(Long id, String markerId, String locationNo, - String locationName, String smallMarkerId, String cableName, - String cableNo, String line, String pressLevel, String cableType, - String cableSpec, String cableBrand, String cableStart, String cableEnd, - String hasJoint, String jointCreator, String createTime, String path, - String memo1, String memo2, String memo3) { - this.id = id; - this.markerId = markerId; - this.locationNo = locationNo; - this.locationName = locationName; - this.smallMarkerId = smallMarkerId; - this.cableName = cableName; - this.cableNo = cableNo; - this.line = line; - this.pressLevel = pressLevel; - this.cableType = cableType; - this.cableSpec = cableSpec; - this.cableBrand = cableBrand; - this.cableStart = cableStart; - this.cableEnd = cableEnd; - this.hasJoint = hasJoint; - this.jointCreator = jointCreator; - this.createTime = createTime; - this.path = path; - 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 getLocationNo() { - return this.locationNo; - } - - public void setLocationNo(String locationNo) { - this.locationNo = locationNo; - } - - public String getLocationName() { - return this.locationName; - } - - public void setLocationName(String locationName) { - this.locationName = locationName; - } - - public String getSmallMarkerId() { - return this.smallMarkerId; - } - - public void setSmallMarkerId(String smallMarkerId) { - this.smallMarkerId = smallMarkerId; - } - - public String getCableName() { - return this.cableName; - } - - public void setCableName(String cableName) { - this.cableName = cableName; - } - - public String getCableNo() { - return this.cableNo; - } - - public void setCableNo(String cableNo) { - this.cableNo = cableNo; - } - - public String getLine() { - return this.line; - } - - public void setLine(String line) { - this.line = line; - } - - public String getPressLevel() { - return this.pressLevel; - } - - public void setPressLevel(String pressLevel) { - this.pressLevel = pressLevel; - } - - 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 getCreateTime() { - return this.createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - - 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/detector/bean/TaskBean.java b/app/src/main/java/com/casic/detector/bean/TaskBean.java deleted file mode 100644 index f398288..0000000 --- a/app/src/main/java/com/casic/detector/bean/TaskBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.casic.detector.bean; - -import com.casic.detector.model.TaskModel; - -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 - - /** - * { - * "id": 5703, - * "isChecked": 0, - * "isNormal": 1, - * "latitude": 30.56693088, - * "longitude": 104.2848611, - * "markerId": 26, - * "markerIdReal": "0008798066", - * "taskCode": "20240418195448", - * "taskId": "346" - * } - */ - - private String scanner; - private String desc; - - /** - * 真实任务ID - */ - private String taskId; - - /** - * 用 {@link TaskModel.MessageModel.TaskDetailInfosModel#id} 存 - */ - private String taskCode; - private String markerId; - - /** - * 探测仪扫描出来的ID - */ - private String markerRealId; - private String lng; - private String lat; - private String state; - - @Generated(hash = 1891433912) - public TaskBean(Long id, String scanner, String desc, String taskId, - String taskCode, String markerId, String markerRealId, String lng, - String lat, String state) { - this.id = id; - this.scanner = scanner; - this.desc = desc; - this.taskId = taskId; - this.taskCode = taskCode; - this.markerId = markerId; - this.markerRealId = markerRealId; - this.lng = lng; - this.lat = lat; - this.state = state; - } - - @Generated(hash = 1443476586) - public TaskBean() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getScanner() { - return this.scanner; - } - - public void setScanner(String scanner) { - this.scanner = scanner; - } - - public String getDesc() { - return this.desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - 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 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; - } -} diff --git a/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java new file mode 100644 index 0000000..dd93541 --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskLocalBean.java @@ -0,0 +1,104 @@ +package com.casic.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;//任务执行结束的时间 + + @Generated(hash = 931317614) + public TaskLocalBean(Long id, String taskCode, String description, + String createTime, String status, String createUserName, + String startTime, String endTime) { + this.id = id; + this.taskCode = taskCode; + this.description = description; + this.createTime = createTime; + this.status = status; + this.createUserName = createUserName; + this.startTime = startTime; + this.endTime = endTime; + } + + @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; + } +} diff --git a/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java new file mode 100644 index 0000000..3e7494d --- /dev/null +++ b/app/src/main/java/com/casic/detector/bean/TaskMarkerLocalBean.java @@ -0,0 +1,128 @@ +package com.casic.detector.bean; + +import com.casic.detector.model.TaskModel; + +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/detector/greendao/DaoMaster.java b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java index 6fcf37f..ec4425f 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoMaster.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoMaster.java @@ -26,8 +26,8 @@ public static void createAllTables(Database db, boolean ifNotExists) { LabelBeanDao.createTable(db, ifNotExists); PipeLocalBeanDao.createTable(db, ifNotExists); - SmallLabelBeanDao.createTable(db, ifNotExists); - TaskBeanDao.createTable(db, ifNotExists); + TaskLocalBeanDao.createTable(db, ifNotExists); + TaskMarkerLocalBeanDao.createTable(db, ifNotExists); } /** @@ -36,8 +36,8 @@ public static void dropAllTables(Database db, boolean ifExists) { LabelBeanDao.dropTable(db, ifExists); PipeLocalBeanDao.dropTable(db, ifExists); - SmallLabelBeanDao.dropTable(db, ifExists); - TaskBeanDao.dropTable(db, ifExists); + TaskLocalBeanDao.dropTable(db, ifExists); + TaskMarkerLocalBeanDao.dropTable(db, ifExists); } /** @@ -58,8 +58,8 @@ super(db, SCHEMA_VERSION); registerDaoClass(LabelBeanDao.class); registerDaoClass(PipeLocalBeanDao.class); - registerDaoClass(SmallLabelBeanDao.class); - registerDaoClass(TaskBeanDao.class); + registerDaoClass(TaskLocalBeanDao.class); + registerDaoClass(TaskMarkerLocalBeanDao.class); } public DaoSession newSession() { diff --git a/app/src/main/java/com/casic/detector/greendao/DaoSession.java b/app/src/main/java/com/casic/detector/greendao/DaoSession.java index ba848ae..4f9bdff 100644 --- a/app/src/main/java/com/casic/detector/greendao/DaoSession.java +++ b/app/src/main/java/com/casic/detector/greendao/DaoSession.java @@ -2,8 +2,8 @@ import com.casic.detector.bean.LabelBean; import com.casic.detector.bean.PipeLocalBean; -import com.casic.detector.bean.SmallLabelBean; -import com.casic.detector.bean.TaskBean; +import com.casic.detector.bean.TaskLocalBean; +import com.casic.detector.bean.TaskMarkerLocalBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.AbstractDaoSession; @@ -24,13 +24,13 @@ private final DaoConfig labelBeanDaoConfig; private final DaoConfig pipeLocalBeanDaoConfig; - private final DaoConfig smallLabelBeanDaoConfig; - private final DaoConfig taskBeanDaoConfig; + private final DaoConfig taskLocalBeanDaoConfig; + private final DaoConfig taskMarkerLocalBeanDaoConfig; private final LabelBeanDao labelBeanDao; private final PipeLocalBeanDao pipeLocalBeanDao; - private final SmallLabelBeanDao smallLabelBeanDao; - private final TaskBeanDao taskBeanDao; + private final TaskLocalBeanDao taskLocalBeanDao; + private final TaskMarkerLocalBeanDao taskMarkerLocalBeanDao; public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig> daoConfigMap) { @@ -42,28 +42,28 @@ pipeLocalBeanDaoConfig = daoConfigMap.get(PipeLocalBeanDao.class).clone(); pipeLocalBeanDaoConfig.initIdentityScope(type); - smallLabelBeanDaoConfig = daoConfigMap.get(SmallLabelBeanDao.class).clone(); - smallLabelBeanDaoConfig.initIdentityScope(type); + taskLocalBeanDaoConfig = daoConfigMap.get(TaskLocalBeanDao.class).clone(); + taskLocalBeanDaoConfig.initIdentityScope(type); - taskBeanDaoConfig = daoConfigMap.get(TaskBeanDao.class).clone(); - taskBeanDaoConfig.initIdentityScope(type); + taskMarkerLocalBeanDaoConfig = daoConfigMap.get(TaskMarkerLocalBeanDao.class).clone(); + taskMarkerLocalBeanDaoConfig.initIdentityScope(type); labelBeanDao = new LabelBeanDao(labelBeanDaoConfig, this); pipeLocalBeanDao = new PipeLocalBeanDao(pipeLocalBeanDaoConfig, this); - smallLabelBeanDao = new SmallLabelBeanDao(smallLabelBeanDaoConfig, this); - taskBeanDao = new TaskBeanDao(taskBeanDaoConfig, this); + taskLocalBeanDao = new TaskLocalBeanDao(taskLocalBeanDaoConfig, this); + taskMarkerLocalBeanDao = new TaskMarkerLocalBeanDao(taskMarkerLocalBeanDaoConfig, this); registerDao(LabelBean.class, labelBeanDao); registerDao(PipeLocalBean.class, pipeLocalBeanDao); - registerDao(SmallLabelBean.class, smallLabelBeanDao); - registerDao(TaskBean.class, taskBeanDao); + registerDao(TaskLocalBean.class, taskLocalBeanDao); + registerDao(TaskMarkerLocalBean.class, taskMarkerLocalBeanDao); } public void clear() { labelBeanDaoConfig.clearIdentityScope(); pipeLocalBeanDaoConfig.clearIdentityScope(); - smallLabelBeanDaoConfig.clearIdentityScope(); - taskBeanDaoConfig.clearIdentityScope(); + taskLocalBeanDaoConfig.clearIdentityScope(); + taskMarkerLocalBeanDaoConfig.clearIdentityScope(); } public LabelBeanDao getLabelBeanDao() { @@ -74,12 +74,12 @@ return pipeLocalBeanDao; } - public SmallLabelBeanDao getSmallLabelBeanDao() { - return smallLabelBeanDao; + public TaskLocalBeanDao getTaskLocalBeanDao() { + return taskLocalBeanDao; } - public TaskBeanDao getTaskBeanDao() { - return taskBeanDao; + public TaskMarkerLocalBeanDao getTaskMarkerLocalBeanDao() { + return taskMarkerLocalBeanDao; } } diff --git a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java b/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java deleted file mode 100644 index 1d82f51..0000000 --- a/app/src/main/java/com/casic/detector/greendao/SmallLabelBeanDao.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.detector.bean.SmallLabelBean; - -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_LABEL_BEAN". - */ -public class SmallLabelBeanDao extends AbstractDao { - - public static final String TABLENAME = "SMALL_LABEL_BEAN"; - - /** - * Properties of entity SmallLabelBean.
- * 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 LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO"); - public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME"); - public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID"); - public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME"); - public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO"); - public final static Property Line = new Property(7, String.class, "line", false, "LINE"); - public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_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 CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME"); - public final static Property Path = new Property(17, String.class, "path", false, "PATH"); - public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1"); - public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2"); - public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3"); - } - - - public SmallLabelBeanDao(DaoConfig config) { - super(config); - } - - public SmallLabelBeanDao(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_LABEL_BEAN\" (" + // - "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id - "\"MARKER_ID\" TEXT," + // 1: markerId - "\"LOCATION_NO\" TEXT," + // 2: locationNo - "\"LOCATION_NAME\" TEXT," + // 3: locationName - "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId - "\"CABLE_NAME\" TEXT," + // 5: cableName - "\"CABLE_NO\" TEXT," + // 6: cableNo - "\"LINE\" TEXT," + // 7: line - "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel - "\"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 - "\"CREATE_TIME\" TEXT," + // 16: createTime - "\"PATH\" TEXT," + // 17: path - "\"MEMO1\" TEXT," + // 18: memo1 - "\"MEMO2\" TEXT," + // 19: memo2 - "\"MEMO3\" TEXT);"); // 20: memo3 - } - - /** - * 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) { - 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, SmallLabelBean 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 locationNo = entity.getLocationNo(); - if (locationNo != null) { - stmt.bindString(3, locationNo); - } - - String locationName = entity.getLocationName(); - if (locationName != null) { - stmt.bindString(4, locationName); - } - - String smallMarkerId = entity.getSmallMarkerId(); - if (smallMarkerId != null) { - stmt.bindString(5, smallMarkerId); - } - - String cableName = entity.getCableName(); - if (cableName != null) { - stmt.bindString(6, cableName); - } - - String cableNo = entity.getCableNo(); - if (cableNo != null) { - stmt.bindString(7, cableNo); - } - - String line = entity.getLine(); - if (line != null) { - stmt.bindString(8, line); - } - - String pressLevel = entity.getPressLevel(); - if (pressLevel != null) { - stmt.bindString(9, pressLevel); - } - - 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 createTime = entity.getCreateTime(); - if (createTime != null) { - stmt.bindString(17, createTime); - } - - String path = entity.getPath(); - if (path != null) { - stmt.bindString(18, path); - } - - String memo1 = entity.getMemo1(); - if (memo1 != null) { - stmt.bindString(19, memo1); - } - - String memo2 = entity.getMemo2(); - if (memo2 != null) { - stmt.bindString(20, memo2); - } - - String memo3 = entity.getMemo3(); - if (memo3 != null) { - stmt.bindString(21, memo3); - } - } - - @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), // locationNo - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel - 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), // createTime - cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path - cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1 - cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2 - cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3 - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, SmallLabelBean 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.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setPressLevel(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.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); - entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); - entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); - entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); - entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20)); - } - - @Override - protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) { - entity.setId(rowId); - return rowId; - } - - @Override - public Long getKey(SmallLabelBean entity) { - if (entity != null) { - return entity.getId(); - } else { - return null; - } - } - - @Override - public boolean hasKey(SmallLabelBean entity) { - return entity.getId() != null; - } - - @Override - protected final boolean isEntityUpdateable() { - return true; - } - -} diff --git a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java deleted file mode 100644 index 59eee37..0000000 --- a/app/src/main/java/com/casic/detector/greendao/TaskBeanDao.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.casic.detector.greendao; - -import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; - -import com.casic.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 Scanner = new Property(1, String.class, "scanner", false, "SCANNER"); - public final static Property Desc = new Property(2, String.class, "desc", false, "DESC"); - public final static Property TaskId = new Property(3, String.class, "taskId", false, "TASK_ID"); - public final static Property TaskCode = new Property(4, String.class, "taskCode", false, "TASK_CODE"); - public final static Property MarkerId = new Property(5, String.class, "markerId", false, "MARKER_ID"); - public final static Property MarkerRealId = new Property(6, String.class, "markerRealId", false, "MARKER_REAL_ID"); - public final static Property Lng = new Property(7, String.class, "lng", false, "LNG"); - public final static Property Lat = new Property(8, String.class, "lat", false, "LAT"); - public final static Property State = new Property(9, String.class, "state", false, "STATE"); - } - - - 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 - "\"SCANNER\" TEXT," + // 1: scanner - "\"DESC\" TEXT," + // 2: desc - "\"TASK_ID\" TEXT," + // 3: taskId - "\"TASK_CODE\" TEXT," + // 4: taskCode - "\"MARKER_ID\" TEXT," + // 5: markerId - "\"MARKER_REAL_ID\" TEXT," + // 6: markerRealId - "\"LNG\" TEXT," + // 7: lng - "\"LAT\" TEXT," + // 8: lat - "\"STATE\" TEXT);"); // 9: state - } - - /** - * 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 scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @Override - protected final void bindValues(SQLiteStatement stmt, TaskBean entity) { - stmt.clearBindings(); - - Long id = entity.getId(); - if (id != null) { - stmt.bindLong(1, id); - } - - String scanner = entity.getScanner(); - if (scanner != null) { - stmt.bindString(2, scanner); - } - - String desc = entity.getDesc(); - if (desc != null) { - stmt.bindString(3, desc); - } - - String taskId = entity.getTaskId(); - if (taskId != null) { - stmt.bindString(4, taskId); - } - - String taskCode = entity.getTaskCode(); - if (taskCode != null) { - stmt.bindString(5, taskCode); - } - - String markerId = entity.getMarkerId(); - if (markerId != null) { - stmt.bindString(6, markerId); - } - - String markerRealId = entity.getMarkerRealId(); - if (markerRealId != null) { - stmt.bindString(7, markerRealId); - } - - String lng = entity.getLng(); - if (lng != null) { - stmt.bindString(8, lng); - } - - String lat = entity.getLat(); - if (lat != null) { - stmt.bindString(9, lat); - } - - String state = entity.getState(); - if (state != null) { - stmt.bindString(10, state); - } - } - - @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), // scanner - cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // desc - cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // taskId - cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // taskCode - cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // markerId - cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // markerRealId - cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lng - cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lat - cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // state - ); - return entity; - } - - @Override - public void readEntity(Cursor cursor, TaskBean entity, int offset) { - entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); - entity.setScanner(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); - entity.setDesc(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); - entity.setTaskId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); - entity.setTaskCode(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); - entity.setMarkerId(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); - entity.setMarkerRealId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); - entity.setLng(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); - entity.setLat(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); - entity.setState(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/detector/greendao/TaskLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java new file mode 100644 index 0000000..d7cb739 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskLocalBeanDao.java @@ -0,0 +1,218 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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 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 + } + + /** + * 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); + } + } + + @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); + } + } + + @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 + ); + 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)); + } + + @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/detector/greendao/TaskMarkerLocalBeanDao.java b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java new file mode 100644 index 0000000..2de65b9 --- /dev/null +++ b/app/src/main/java/com/casic/detector/greendao/TaskMarkerLocalBeanDao.java @@ -0,0 +1,202 @@ +package com.casic.detector.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import com.casic.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/detector/model/TaskDetailLocalModel.java b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java new file mode 100644 index 0000000..b485eda --- /dev/null +++ b/app/src/main/java/com/casic/detector/model/TaskDetailLocalModel.java @@ -0,0 +1,138 @@ +package com.casic.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 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 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/detector/model/TaskModel.java b/app/src/main/java/com/casic/detector/model/TaskModel.java index 4530941..ed842f3 100644 --- a/app/src/main/java/com/casic/detector/model/TaskModel.java +++ b/app/src/main/java/com/casic/detector/model/TaskModel.java @@ -28,8 +28,8 @@ private String taskCode; private String description; private String deployDate; - private Object beginDate; - private Object endDate; + private String beginDate; + private String endDate; private String status; private String creatorId; private String creatorName; @@ -70,19 +70,19 @@ this.deployDate = deployDate; } - public Object getBeginDate() { + public String getBeginDate() { return beginDate; } - public void setBeginDate(Object beginDate) { + public void setBeginDate(String beginDate) { this.beginDate = beginDate; } - public Object getEndDate() { + public String getEndDate() { return endDate; } - public void setEndDate(Object endDate) { + public void setEndDate(String endDate) { this.endDate = endDate; } diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt index 2be5e7b..440a648 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitService.kt @@ -30,16 +30,10 @@ ): String /** - * 获取标识器图片 - */ - @POST("/ems/marker/get-marker-images.do") - suspend fun getLabelPicture(@Body requestBody: RequestBody): String - - /** * 获取巡检工单 */ @GET("/ems/rs/task/get") - suspend fun getTask(@Query("userName") userName: String): String + suspend fun getTasksByUser(@Query("userName") userName: String): String /** * 提交工单 @@ -77,12 +71,12 @@ ): String /** + * TODO 返回值为空,待调整 * 上传工单中标识器信息 - * info中的主键 */ @GET("/ems/rs/task/update-task-mark") suspend fun uploadMarker( - @Query("taskDetailId") taskId: String + @Query("taskDetailId") markerId: String ): String /** diff --git a/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt index 143fb8b..f87932a 100644 --- a/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/detector/retrofit/RetrofitServiceManager.kt @@ -52,24 +52,12 @@ return createApi().getMarkerFile(userId, companyId) } - /** - * 获取标识器图片 - */ - suspend fun getLabelPicture(markerId: String): String { - val param = JsonObject() - param.addProperty("markerId", markerId) - val requestBody = param.toString().toRequestBody( - "application/json;charset=UTF-8".toMediaType() - ) - - return createApi().getLabelPicture(requestBody) - } /** * 获取巡检工单 */ - suspend fun getTask(userName: String): String { - return createApi().getTask(userName) + suspend fun getTasksByUser(userName: String): String { + return createApi().getTasksByUser(userName) } /** @@ -225,8 +213,8 @@ /** * 上传工单中标识器信息 */ - suspend fun uploadMarker(taskDetailId: String): String { - return createApi().uploadMarker(taskDetailId) + suspend fun uploadMarker(markerId: String): String { + return createApi().uploadMarker(markerId) } /** diff --git a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt index 446f2f8..67d4f53 100644 --- a/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt +++ b/app/src/main/java/com/casic/detector/utils/DataBaseManager.kt @@ -3,10 +3,14 @@ import com.casic.detector.base.BaseApplication import com.casic.detector.bean.LabelBean import com.casic.detector.bean.PipeLocalBean -import com.casic.detector.bean.TaskBean +import com.casic.detector.bean.TaskLocalBean +import com.casic.detector.bean.TaskMarkerLocalBean import com.casic.detector.greendao.LabelBeanDao -import com.casic.detector.greendao.TaskBeanDao +import com.casic.detector.greendao.TaskLocalBeanDao +import com.casic.detector.greendao.TaskMarkerLocalBeanDao import com.casic.detector.model.PipelineModel +import com.casic.detector.model.TaskDetailLocalModel +import com.casic.detector.model.TaskModel class DataBaseManager private constructor() { companion object { @@ -16,8 +20,162 @@ } } + private var taskLocalBeanDao = BaseApplication.get().getDaoSession().taskLocalBeanDao + private var taskMarkerLocalBeanDao = + BaseApplication.get().getDaoSession().taskMarkerLocalBeanDao + + 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 = "" + } + 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 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 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 + + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(it.id), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(it.taskCode) + ).list() + val markers = ArrayList() + 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 + } + + 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 + val markers = taskMarkerLocalBeanDao.queryBuilder() + .where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list() + markers.forEach { + taskMarkerLocalBeanDao.delete(it) + } + } + + fun queryTaskById(taskId: String, taskCode: String): TaskDetailLocalModel? { + val taskLocalBean = taskLocalBeanDao.queryBuilder().where( + TaskLocalBeanDao.Properties.Id.eq(taskId), + TaskLocalBeanDao.Properties.TaskCode.eq(taskCode) + ).list().firstOrNull() ?: return null + + val model = TaskDetailLocalModel() + model.taskId = taskId + model.taskCode = taskCode + model.description = taskLocalBean.description + model.createTime = taskLocalBean.createTime + model.status = taskLocalBean.status + model.createUserName = taskLocalBean.createUserName + + val markerLocalBeans = taskMarkerLocalBeanDao.queryBuilder().where( + TaskMarkerLocalBeanDao.Properties.TaskId.eq(taskId), + TaskMarkerLocalBeanDao.Properties.TaskCode.eq(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 + } + + return model + } + + 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) + } + +// ============================================================================================= + private var labelBeanDao = BaseApplication.get().getDaoSession().labelBeanDao - private var taskBeanDao = BaseApplication.get().getDaoSession().taskBeanDao private val pipeLocalBeanDao = BaseApplication.get().getDaoSession().pipeLocalBeanDao fun clearTaskLabels() { @@ -56,73 +214,6 @@ .list() } - fun clearTasks() { - taskBeanDao.deleteAll() - } - - fun insertTask( - scanner: String, - desc: String, - taskId: String, - taskCode: String, - markerId: String, - markerRealId: String, - lng: String, - lat: String, - state: String - ) { - val task = TaskBean() - task.scanner = scanner - task.desc = desc - task.taskId = taskId - task.taskCode = taskCode - task.markerId = markerId - task.markerRealId = markerRealId - task.lng = lng - task.lat = lat - task.state = state - - taskBeanDao.insert(task) - } - - fun queryDistinctTask(): List { - val result = ArrayList() - taskBeanDao.loadAll().forEach { - result.add(it) - } - //根据TaskId去重 - return result.distinctBy { it.taskId } - } - - fun queryTaskById(taskId: String): List { - return taskBeanDao.queryBuilder().where(TaskBeanDao.Properties.TaskId.eq(taskId)).list() - } - - fun queryTaskMarkerById(markerId: String, state: String): TaskBean? { - return taskBeanDao.queryBuilder() - .where( - TaskBeanDao.Properties.MarkerRealId.eq(markerId), - TaskBeanDao.Properties.State.eq(state) - ).list().firstOrNull() - } - - fun updateTaskLabel(taskBean: TaskBean?) { - if (taskBean == null) { - return - } - taskBean.state = "已探测" - taskBeanDao.update(taskBean) - } - - fun deleteTaskById(taskId: String?) { - if (taskId.isNullOrBlank()) { - return - } - queryTaskById(taskId).forEach { - taskBeanDao.delete(it) - } - } - /** * 清除管线本地缓存 * */ diff --git a/app/src/main/java/com/casic/detector/utils/LocaleConstant.kt b/app/src/main/java/com/casic/detector/utils/LocaleConstant.kt index f80138e..f6f659c 100644 --- a/app/src/main/java/com/casic/detector/utils/LocaleConstant.kt +++ b/app/src/main/java/com/casic/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.detector.fileprovider" diff --git a/app/src/main/java/com/casic/detector/view/MainActivity.kt b/app/src/main/java/com/casic/detector/view/MainActivity.kt index 40ba172..22de557 100644 --- a/app/src/main/java/com/casic/detector/view/MainActivity.kt +++ b/app/src/main/java/com/casic/detector/view/MainActivity.kt @@ -21,8 +21,6 @@ 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 @@ -41,7 +39,7 @@ import com.casic.detector.adapter.EditableImageAdapter import com.casic.detector.base.SerialPortActivity import com.casic.detector.bean.LabelBean -import com.casic.detector.bean.TaskBean +import com.casic.detector.bean.TaskMarkerLocalBean import com.casic.detector.callback.OnGetLocationListener import com.casic.detector.callback.OnImageCompressListener import com.casic.detector.cluster.ClusterItem @@ -49,7 +47,6 @@ import com.casic.detector.cluster.RegionItem import com.casic.detector.databinding.ActivityMainBinding import com.casic.detector.databinding.DialogInstallMarkerBinding -import com.casic.detector.databinding.DialogSearchMarkerBinding import com.casic.detector.databinding.DialogSearchMarkerNewBinding import com.casic.detector.extensions.appendDownloadUrl import com.casic.detector.extensions.calculateAngle @@ -64,6 +61,7 @@ import com.casic.detector.extensions.toColor import com.casic.detector.extensions.toHex import com.casic.detector.extensions.toObjectType +import com.casic.detector.model.TaskDetailLocalModel import com.casic.detector.model.TaskModel import com.casic.detector.utils.DataBaseManager import com.casic.detector.utils.ExcelHub @@ -112,7 +110,6 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File -import java.text.DecimalFormat import java.util.Calendar import java.util.Date import java.util.Timer @@ -128,7 +125,6 @@ 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 lineViewModel by lazy { ViewModelProvider(this)[PipelineViewModel::class.java] } @@ -145,11 +141,10 @@ 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 @@ -229,19 +224,17 @@ } 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() { - saveTask(it) + saveUserTasks(it) } }).build().show() } } - taskViewModel.freeTaskResult.observe(this) { taskId = it } + taskViewModel.freeTaskResult.observe(this) { freeTaskId = it } taskViewModel.uploadTaskMarkerResult.observe(this) { "自由巡检任务已完成".show(this) ids.clear() @@ -416,40 +409,46 @@ //巡检 binding.inspectionButton.setOnClickListener { - val tasks = DataBaseManager.get.queryDistinctTask() + val tasks = DataBaseManager.get.loadLocalTask() if (tasks.isNotEmpty()) { val arrayList = ArrayList() - tasks.forEachIndexed { index, bean -> - arrayList.add("任务${index + 1}:${bean.taskId},${bean.desc}") + 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) { - task = tasks[position] + 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() { - val latLng = LatLng( - task.lat.toDouble(), task.lng.toDouble() - ) - aMap.moveCamera( - CameraUpdateFactory.newLatLngZoom(latLng, 16f) - ) - //执行工单 - uploadTask(task.taskId, "1") - detectRedrawGraphic(task.taskId) - isExecuteTask = true + 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) + } } override fun onCancelClick() { //提交工单 - uploadTask(task.taskId, "2") + uploadTask(task.taskId, task.taskCode, "2") isExecuteTask = false } }).build().show() @@ -509,12 +508,12 @@ 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)) } } @@ -523,10 +522,10 @@ } } - private fun uploadTask(taskId: String?, state: String) { + 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, state) + taskViewModel.uploadTask(this, userId, taskId, taskCode, state) } else { "网络连接已断开,请检查".show(this) } @@ -576,9 +575,7 @@ override fun onDataReceived(buffer: ByteArray) { val hex = buffer.toHex() // Log.d(kTag, "$kTag => $hex") - if (searchDialog.isDetectMarker) { - searchDialog.bindingValue(hex) - } else if (searchNewDialog.isDetectMarker) { + if (searchNewDialog.isDetectMarker) { searchNewDialog.bindingValue(hex) } else if (installDialog.isReadMarker) { val markerId = hex.take(20).hexToString() @@ -638,31 +635,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.dismiss() "${installDialog.markerId}安装成功".show(this) } - - if (searchDialog.isDetectMarker) { - searchDialog.taskBean?.apply { - detectRedrawGraphic(taskId) - } - } - LoadingDialogHub.dismiss() } + + else -> LoadingDialogHub.dismiss() } } @@ -755,23 +742,14 @@ }) } - private fun saveTask(task: TaskModel) { - val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") as String + private fun saveUserTasks(task: TaskModel) { task.message.forEach { model -> - model.taskDetailInfos.forEach { info -> - //只保存有b标识器ID得数据 - if (!info.markerIdReal.isNullOrBlank()) { - DataBaseManager.get.insertTask( - userName, - model.description, - info.taskId.toString(), - info.id.toString(), - info.markerId.toString(), - info.markerIdReal.toString(), - info.longitude.toString(), - info.latitude.toString(), - model.status - ) + //保存任务详情 + DataBaseManager.get.saveTaskInLocale(model) + model.taskDetailInfos.forEach { marker -> + //只保存有标识器ID得数据 + if (!marker.markerIdReal.isNullOrBlank()) { + DataBaseManager.get.saveTaskMarkerInLocale(model.id, model.taskCode, marker) } } } @@ -880,33 +858,52 @@ } } - 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 detectRedrawGraphic(marker: TaskMarkerLocalBean) { + val latLng = LatLng(marker.lat, marker.lng) + val otMarkerOptions = MarkerOptions() + otMarkerOptions.position(latLng) + otMarkerOptions.visible(true) // 设置可见 + if (marker.isDetected == "0") { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_red1) + ) + ).period(99).title("工单标识器").snippet(marker.markerId) + } else { + otMarkerOptions.icon( + BitmapDescriptorFactory.fromBitmap( + BitmapFactory.decodeResource(resources, R.mipmap.label_blue1) + ) + ).period(99).title("工单标识器").snippet(marker.markerId) + } + aMap.addMarker(otMarkerOptions) + showLabelsOnMap() + } + //更新管线数据 // private fun updatePipeline() { // AlertControlDialog.Builder().setContext(this).setTitle("提示").setMessage("是否更新数据?") @@ -959,7 +956,7 @@ private fun downloadTask() { if (isNetworkConnected()) { val userName = SaveKeyValues.getValue(LocaleConstant.USER_NAME, "") - taskViewModel.getTask(this, userName.toString()) + taskViewModel.getTasksByUser(this, userName.toString()) } else { "网络连接已断开,请检查".show(this) } @@ -1575,242 +1572,15 @@ } } - /**探测标识器对话框******************************************************************************/ - inner class SearchMarkerDialog(private val 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 markerId = "" - private lateinit var searchMarkerTimer: Timer - private lateinit var signalTask: TimerTask - private lateinit var energyTask: TimerTask - private lateinit var countDownTimer: CountDownTimer - - var isDetectMarker = false - var taskBean: TaskBean? = null - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - this.initDialogLayoutParams(1f) - binding.depthButton.setOnClickListener { - signalTask.cancel() - 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) - } - } - - binding.markerInfoButton.setOnClickListener { - //查库 - val result = DataBaseManager.get.queryLabelById(markerId) - if (result.isNotEmpty()) { - context.navigatePageTo(result.first().toJson()) - } else { - context.navigatePageTo(markerId) - } - } - } - - override fun onStart() { - super.onStart() - //调高串口电位 - gpioManager.setGpioHigh("18") - - initTimer() - - 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) { - soundPool.play(fastSoundResourceId, 1f, 1f, 0, 0, 1f) - } else { - 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 - - if (energy <= 700) {//18° - binding.energyTipsView.text = "标识器信号较弱,可能距离较远" - binding.energyTipsView.setTextColor(Color.parseColor("#8D1717")) - binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_red) - - binding.depthButton.isEnabled = false - binding.depthButton.setTextColor(Color.parseColor("#CCCCCC")) - binding.depthButton.setBackgroundResource(R.mipmap.left_button_disable) - binding.markerInfoButton.isEnabled = false - binding.markerInfoButton.setTextColor(Color.parseColor("#CCCCCC")) - binding.markerInfoButton.setBackgroundResource(R.mipmap.right_button_disable) - - binding.searchResultView.text = "未检测到标识器" - 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.setTextColor(Color.parseColor("#428d00")) - binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_green) - } else {//[18°,148°] - binding.energyTipsView.text = "已靠近标识器,请继续移动位置" - binding.energyTipsView.setTextColor(Color.parseColor("#8C5700")) - binding.energyTipsView.setBackgroundResource(R.mipmap.bg_large_text_yellow) - } - } catch (e: NumberFormatException) { - e.printStackTrace() - } - } else if (hex.startsWith("53")) { - LoadingDialogHub.dismiss() - countDownTimer.cancel() - try { - val depthResponse = hex.take(10).hexToString() - val depth = depthResponse.drop(2).toInt() - AlertMessageDialog.Builder().setContext(context).setTitle("温馨提示") - .setMessage("标识器埋深:${depth}厘米").setPositiveButton("知道了") - .setOnDialogButtonClickListener(object : - AlertMessageDialog.OnDialogButtonClickListener { - override fun onConfirmClick() { - initTimer() - } - }).build().show() - } catch (e: NumberFormatException) { - e.printStackTrace() - } - } else { - val id = hex.take(20).hexToString() - if (id.isNumber()) { - markerId = id - - binding.depthButton.isEnabled = true - binding.depthButton.setTextColor(Color.WHITE) - binding.depthButton.setBackgroundResource(R.mipmap.left_button_enable) - binding.markerInfoButton.isEnabled = true - binding.markerInfoButton.setTextColor(Color.WHITE) - binding.markerInfoButton.setBackgroundResource(R.mipmap.right_button_enable) - - binding.searchResultView.text = "已检测到标识器" - binding.searchResultView.setTextColor(Color.parseColor("#428d00")) - binding.searchResultView.setBackgroundResource(R.mipmap.bg_small_text_green) - - //工单开始后才自动上传标识器 - if (isExecuteTask) { - taskBean = DataBaseManager.get.queryTaskMarkerById(markerId, "未开始") - taskBean?.apply { - /** - * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 - * */ - taskViewModel.uploadMarker(context, taskCode) - } - } - } - } - } - - private fun initTimer() { - searchMarkerTimer = Timer() - - 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.schedule(signalTask, 0, 201) - searchMarkerTimer.schedule(energyTask, 0, 251) - } - - override fun dismiss() { - signalTask.cancel() - energyTask.cancel() - searchMarkerTimer.cancel() - //降低串口电位 - gpioManager.setGpioLow("18") - isDetectMarker = false - soundPool.autoPause() - super.dismiss() - } - } - /**探测标识器新对话框****************************************************************************/ inner class SearchMarkerNewDialog(private val context: Context) : Dialog(context) { + 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 @@ -2024,12 +1794,11 @@ //自动上传标识器 if (isExecuteTask) { - val taskBean = DataBaseManager.get.queryTaskMarkerById(markerId, "未开始") - taskBean?.apply { - /** - * 此taskCode是 [com.casic.detector.model.TaskModel.MessageModel.TaskDetailInfosModel] 里面的主键,也就是这个标签在数据库里面的主键 - * */ - taskViewModel.uploadMarker(context, taskCode) + val taskMarkerLocalBean = DataBaseManager.get.queryTaskMarkerById( + taskId, taskCode, markerId, "0" + ) + taskMarkerLocalBean?.apply { + taskViewModel.uploadMarker(context, this) } } } diff --git a/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt b/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt index e0dc287..d048cc3 100644 --- a/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt +++ b/app/src/main/java/com/casic/detector/vm/TaskViewModel.kt @@ -3,6 +3,7 @@ import android.content.Context import android.util.Log import androidx.lifecycle.MutableLiveData +import com.casic.detector.bean.TaskMarkerLocalBean import com.casic.detector.extensions.getResponseMessage import com.casic.detector.extensions.getResponseState import com.casic.detector.model.MarkerFileModel @@ -68,8 +69,8 @@ it.printStackTrace() }) - fun getTask(context: Context, userName: String) = launch({ - val response = RetrofitServiceManager.getTask(userName) + fun getTasksByUser(context: Context, userName: String) = launch({ + val response = RetrofitServiceManager.getTasksByUser(userName) if (response.getResponseState()) { taskResult.value = gson.fromJson( response, object : TypeToken() {}.type @@ -152,15 +153,18 @@ loadState.value = LoadState.Fail }) - fun uploadTask(context: Context, 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 + //工单提交之后,并且状态是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) @@ -194,11 +198,10 @@ loadState.value = LoadState.Fail }) - fun uploadMarker(context: Context, taskDetailId: String) = launch({ - val response = RetrofitServiceManager.uploadMarker(taskDetailId) - if (response.getResponseState()) { - "${taskDetailId}上传成功".show(context) - } + fun uploadMarker(context: Context, marker: TaskMarkerLocalBean) = launch({ + RetrofitServiceManager.uploadMarker(marker.markerId) + "标识器${marker.markerId}已探测!".show(context) + DataBaseManager.get.updateLocalTaskMarkerState(marker) }, { it.printStackTrace() })