diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt index 816d63c..49c43e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt +++ b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt @@ -69,6 +69,7 @@ //窨井类型转换 fun String.valueToType(): String { return when (this) { + "" -> "全部" "1" -> "雨水井" "2" -> "污水井" "3" -> "燃气井" diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt index 816d63c..49c43e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt +++ b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt @@ -69,6 +69,7 @@ //窨井类型转换 fun String.valueToType(): String { return when (this) { + "" -> "全部" "1" -> "雨水井" "2" -> "污水井" "3" -> "燃气井" diff --git a/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java new file mode 100644 index 0000000..8f9f95d --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java @@ -0,0 +1,118 @@ +package com.casic.app.smartwell.model; + +import java.util.List; + +public class AuthorDeptModel { + + private int code; + private DataModel data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataModel { + private String area; + private List communications; + private String deptid; + private List deviceTypes; + private String id; + private String lat; + private String lng; + private List wellTypes; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public List getCommunications() { + return communications; + } + + public void setCommunications(List communications) { + this.communications = communications; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public List getDeviceTypes() { + return deviceTypes; + } + + public void setDeviceTypes(List deviceTypes) { + this.deviceTypes = deviceTypes; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public List getWellTypes() { + return wellTypes; + } + + public void setWellTypes(List wellTypes) { + this.wellTypes = wellTypes; + } + } +} \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt index 816d63c..49c43e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt +++ b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt @@ -69,6 +69,7 @@ //窨井类型转换 fun String.valueToType(): String { return when (this) { + "" -> "全部" "1" -> "雨水井" "2" -> "污水井" "3" -> "燃气井" diff --git a/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java new file mode 100644 index 0000000..8f9f95d --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java @@ -0,0 +1,118 @@ +package com.casic.app.smartwell.model; + +import java.util.List; + +public class AuthorDeptModel { + + private int code; + private DataModel data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataModel { + private String area; + private List communications; + private String deptid; + private List deviceTypes; + private String id; + private String lat; + private String lng; + private List wellTypes; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public List getCommunications() { + return communications; + } + + public void setCommunications(List communications) { + this.communications = communications; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public List getDeviceTypes() { + return deviceTypes; + } + + public void setDeviceTypes(List deviceTypes) { + this.deviceTypes = deviceTypes; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public List getWellTypes() { + return wellTypes; + } + + public void setWellTypes(List wellTypes) { + this.wellTypes = wellTypes; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java new file mode 100644 index 0000000..c573c72 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java @@ -0,0 +1,27 @@ +package com.casic.app.smartwell.model; + +public class WellTypeModel { + private String typeValue; + private String wellType; + + public WellTypeModel(String typeValue, String wellType) { + this.typeValue = typeValue; + this.wellType = wellType; + } + + public String getTypeValue() { + return typeValue; + } + + public void setTypeValue(String typeValue) { + this.typeValue = typeValue; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } +} diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt index 816d63c..49c43e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt +++ b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt @@ -69,6 +69,7 @@ //窨井类型转换 fun String.valueToType(): String { return when (this) { + "" -> "全部" "1" -> "雨水井" "2" -> "污水井" "3" -> "燃气井" diff --git a/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java new file mode 100644 index 0000000..8f9f95d --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java @@ -0,0 +1,118 @@ +package com.casic.app.smartwell.model; + +import java.util.List; + +public class AuthorDeptModel { + + private int code; + private DataModel data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataModel { + private String area; + private List communications; + private String deptid; + private List deviceTypes; + private String id; + private String lat; + private String lng; + private List wellTypes; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public List getCommunications() { + return communications; + } + + public void setCommunications(List communications) { + this.communications = communications; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public List getDeviceTypes() { + return deviceTypes; + } + + public void setDeviceTypes(List deviceTypes) { + this.deviceTypes = deviceTypes; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public List getWellTypes() { + return wellTypes; + } + + public void setWellTypes(List wellTypes) { + this.wellTypes = wellTypes; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java new file mode 100644 index 0000000..c573c72 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java @@ -0,0 +1,27 @@ +package com.casic.app.smartwell.model; + +public class WellTypeModel { + private String typeValue; + private String wellType; + + public WellTypeModel(String typeValue, String wellType) { + this.typeValue = typeValue; + this.wellType = wellType; + } + + public String getTypeValue() { + return typeValue; + } + + public void setTypeValue(String typeValue) { + this.typeValue = typeValue; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt deleted file mode 100644 index cac523d..0000000 --- a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.casic.app.smartwell.model - -class WellTypeModel { - /** - * code : 200 - * data : [{"name":"雨水井","id":"61","value":"1"},{"name":"污水井","id":"62","value":"2"},{"name":"燃气井","id":"63","value":"3"},{"name":"热力井","id":"64","value":"4"},{"name":"电力井","id":"65","value":"5"},{"name":"交通井","id":"88","value":"6"},{"name":"路灯井","id":"89","value":"7"},{"name":"通信井","id":"90","value":"8"},{"name":"监控井","id":"91","value":"9"},{"name":"其他","id":"92","value":"10"}] - * message : 请求成功 - * success : true - */ - var code = 0 - var message: String? = null - var isSuccess = false - var data: List? = null - - class DataBean { - /** - * name : 雨水井 - * id : 61 - * value : 1 - */ - var name: String? = null - var id: String? = null - var value: String? = null - } -} \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt index 816d63c..49c43e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt +++ b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt @@ -69,6 +69,7 @@ //窨井类型转换 fun String.valueToType(): String { return when (this) { + "" -> "全部" "1" -> "雨水井" "2" -> "污水井" "3" -> "燃气井" diff --git a/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java new file mode 100644 index 0000000..8f9f95d --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java @@ -0,0 +1,118 @@ +package com.casic.app.smartwell.model; + +import java.util.List; + +public class AuthorDeptModel { + + private int code; + private DataModel data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataModel { + private String area; + private List communications; + private String deptid; + private List deviceTypes; + private String id; + private String lat; + private String lng; + private List wellTypes; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public List getCommunications() { + return communications; + } + + public void setCommunications(List communications) { + this.communications = communications; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public List getDeviceTypes() { + return deviceTypes; + } + + public void setDeviceTypes(List deviceTypes) { + this.deviceTypes = deviceTypes; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public List getWellTypes() { + return wellTypes; + } + + public void setWellTypes(List wellTypes) { + this.wellTypes = wellTypes; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java new file mode 100644 index 0000000..c573c72 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java @@ -0,0 +1,27 @@ +package com.casic.app.smartwell.model; + +public class WellTypeModel { + private String typeValue; + private String wellType; + + public WellTypeModel(String typeValue, String wellType) { + this.typeValue = typeValue; + this.wellType = wellType; + } + + public String getTypeValue() { + return typeValue; + } + + public void setTypeValue(String typeValue) { + this.typeValue = typeValue; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt deleted file mode 100644 index cac523d..0000000 --- a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.casic.app.smartwell.model - -class WellTypeModel { - /** - * code : 200 - * data : [{"name":"雨水井","id":"61","value":"1"},{"name":"污水井","id":"62","value":"2"},{"name":"燃气井","id":"63","value":"3"},{"name":"热力井","id":"64","value":"4"},{"name":"电力井","id":"65","value":"5"},{"name":"交通井","id":"88","value":"6"},{"name":"路灯井","id":"89","value":"7"},{"name":"通信井","id":"90","value":"8"},{"name":"监控井","id":"91","value":"9"},{"name":"其他","id":"92","value":"10"}] - * message : 请求成功 - * success : true - */ - var code = 0 - var message: String? = null - var isSuccess = false - var data: List? = null - - class DataBean { - /** - * name : 雨水井 - * id : 61 - * value : 1 - */ - var name: String? = null - var id: String? = null - var value: String? = null - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt index 051bfb8..d4138fc 100644 --- a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt @@ -39,7 +39,7 @@ /** * 获取闸井类别 */ - @GET("/sys/dict/code/sluicewellType") + @GET("/config/getAuthorByDept") suspend fun obtainWellType(@Header("token") token: String): String /** @@ -235,7 +235,6 @@ ): String /** - * TODO 特定POST请求 * 查询工单 * */ @POST("/job/searchList") @@ -274,16 +273,11 @@ /** * 修改密码 - * - * @param oldPwd 旧密码 - * @param newPwd 新密码 */ - @FormUrlEncoded - @POST("/mgr/changePwd") + @POST("/sys/mgr/changePwd") suspend fun changePassword( @Header("token") token: String, - @Field("oldPwd") oldPwd: String, - @Field("newPwd") newPwd: String + @Body requestBody: RequestBody ): String /** diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt index 816d63c..49c43e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt +++ b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt @@ -69,6 +69,7 @@ //窨井类型转换 fun String.valueToType(): String { return when (this) { + "" -> "全部" "1" -> "雨水井" "2" -> "污水井" "3" -> "燃气井" diff --git a/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java new file mode 100644 index 0000000..8f9f95d --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java @@ -0,0 +1,118 @@ +package com.casic.app.smartwell.model; + +import java.util.List; + +public class AuthorDeptModel { + + private int code; + private DataModel data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataModel { + private String area; + private List communications; + private String deptid; + private List deviceTypes; + private String id; + private String lat; + private String lng; + private List wellTypes; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public List getCommunications() { + return communications; + } + + public void setCommunications(List communications) { + this.communications = communications; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public List getDeviceTypes() { + return deviceTypes; + } + + public void setDeviceTypes(List deviceTypes) { + this.deviceTypes = deviceTypes; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public List getWellTypes() { + return wellTypes; + } + + public void setWellTypes(List wellTypes) { + this.wellTypes = wellTypes; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java new file mode 100644 index 0000000..c573c72 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java @@ -0,0 +1,27 @@ +package com.casic.app.smartwell.model; + +public class WellTypeModel { + private String typeValue; + private String wellType; + + public WellTypeModel(String typeValue, String wellType) { + this.typeValue = typeValue; + this.wellType = wellType; + } + + public String getTypeValue() { + return typeValue; + } + + public void setTypeValue(String typeValue) { + this.typeValue = typeValue; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt deleted file mode 100644 index cac523d..0000000 --- a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.casic.app.smartwell.model - -class WellTypeModel { - /** - * code : 200 - * data : [{"name":"雨水井","id":"61","value":"1"},{"name":"污水井","id":"62","value":"2"},{"name":"燃气井","id":"63","value":"3"},{"name":"热力井","id":"64","value":"4"},{"name":"电力井","id":"65","value":"5"},{"name":"交通井","id":"88","value":"6"},{"name":"路灯井","id":"89","value":"7"},{"name":"通信井","id":"90","value":"8"},{"name":"监控井","id":"91","value":"9"},{"name":"其他","id":"92","value":"10"}] - * message : 请求成功 - * success : true - */ - var code = 0 - var message: String? = null - var isSuccess = false - var data: List? = null - - class DataBean { - /** - * name : 雨水井 - * id : 61 - * value : 1 - */ - var name: String? = null - var id: String? = null - var value: String? = null - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt index 051bfb8..d4138fc 100644 --- a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt @@ -39,7 +39,7 @@ /** * 获取闸井类别 */ - @GET("/sys/dict/code/sluicewellType") + @GET("/config/getAuthorByDept") suspend fun obtainWellType(@Header("token") token: String): String /** @@ -235,7 +235,6 @@ ): String /** - * TODO 特定POST请求 * 查询工单 * */ @POST("/job/searchList") @@ -274,16 +273,11 @@ /** * 修改密码 - * - * @param oldPwd 旧密码 - * @param newPwd 新密码 */ - @FormUrlEncoded - @POST("/mgr/changePwd") + @POST("/sys/mgr/changePwd") suspend fun changePassword( @Header("token") token: String, - @Field("oldPwd") oldPwd: String, - @Field("newPwd") newPwd: String + @Body requestBody: RequestBody ): String /** diff --git a/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt index 6987ed1..2d6fbc4 100644 --- a/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt +++ b/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt @@ -34,8 +34,8 @@ private lateinit var weakReferenceHandler: WeakReferenceHandler private lateinit var wellListAdapter: WellListAdapter private val context: Context = this@WellManagementActivity - private var items: MutableList = ArrayList() - private var wellTypeModel = WellTypeModel.DataBean() + private var items: MutableList = ArrayList() + private var wellTypeModel = WellTypeModel("", "") private var dataBeans: MutableList = ArrayList() private var keywords = "" private var wellType = "" @@ -53,30 +53,16 @@ override fun initData() { easyPopupWindow = WellTypePopupWindow(this) easyPopupWindow.setBackgroundDrawable(null) - wellViewModel = ViewModelProvider(this).get(WellViewModel::class.java) - wellListViewModel = ViewModelProvider(this).get(WellListViewModel::class.java) + wellViewModel = ViewModelProvider(this)[WellViewModel::class.java] + wellListViewModel = ViewModelProvider(this)[WellListViewModel::class.java] weakReferenceHandler = WeakReferenceHandler(callback) - } - override fun observeRequestState() { - - } - - override fun initEvent() { wellViewModel.obtainWellType() wellViewModel.wellTypeModel.observe(this, { if (it.code == 200) { - it.data!!.forEachIndexed { index, dataBean -> - val bean: WellTypeModel.DataBean - if (index == 0) { - bean = WellTypeModel.DataBean() - bean.id = "" - bean.name = "全\u3000部" - bean.value = "" - } else { - bean = dataBean - } - items.add(bean) + items.add(WellTypeModel("", "全\u3000部")) + it.data.wellTypes!!.forEach { value -> + items.add(WellTypeModel(value, value.valueToType())) } easyPopupWindow.setupPopupData(items) } @@ -108,23 +94,32 @@ weakReferenceHandler.sendEmptyMessage(2022032501) } }) + } - wellTypeLayout.setOnClickListener { - arrowImageView.arrowAnimation(180f) - easyPopupWindow.showAsDropDown(wellTypeLayout) + override fun observeRequestState() { + + } + + override fun initEvent() { + wellTypeView.setOnClickListener { + easyPopupWindow.showAsDropDown(wellTypeView) easyPopupWindow.setOnPopupWindowClickListener(object : WellTypePopupWindow.OnPopupWindowClickListener { override fun onPopupClick(position: Int) { - arrowImageView.arrowAnimation(0f) wellTypeModel = items[position] - wellTypeView.text = wellTypeModel.name + wellTypeView.text = wellTypeModel.typeValue.valueToType() + + //查询数据 + wellType = wellTypeModel.typeValue.toString() + pageIndex = 1 + obtainWellList() } }) } searchTextView.setOnClickListener { keywords = searchInputView.text.toString().trim() - wellType = wellTypeModel.value.toString() + wellType = wellTypeModel.typeValue.toString() pageIndex = 1 obtainWellList() } diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt index 816d63c..49c43e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt +++ b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt @@ -69,6 +69,7 @@ //窨井类型转换 fun String.valueToType(): String { return when (this) { + "" -> "全部" "1" -> "雨水井" "2" -> "污水井" "3" -> "燃气井" diff --git a/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java new file mode 100644 index 0000000..8f9f95d --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java @@ -0,0 +1,118 @@ +package com.casic.app.smartwell.model; + +import java.util.List; + +public class AuthorDeptModel { + + private int code; + private DataModel data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataModel { + private String area; + private List communications; + private String deptid; + private List deviceTypes; + private String id; + private String lat; + private String lng; + private List wellTypes; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public List getCommunications() { + return communications; + } + + public void setCommunications(List communications) { + this.communications = communications; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public List getDeviceTypes() { + return deviceTypes; + } + + public void setDeviceTypes(List deviceTypes) { + this.deviceTypes = deviceTypes; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public List getWellTypes() { + return wellTypes; + } + + public void setWellTypes(List wellTypes) { + this.wellTypes = wellTypes; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java new file mode 100644 index 0000000..c573c72 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java @@ -0,0 +1,27 @@ +package com.casic.app.smartwell.model; + +public class WellTypeModel { + private String typeValue; + private String wellType; + + public WellTypeModel(String typeValue, String wellType) { + this.typeValue = typeValue; + this.wellType = wellType; + } + + public String getTypeValue() { + return typeValue; + } + + public void setTypeValue(String typeValue) { + this.typeValue = typeValue; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt deleted file mode 100644 index cac523d..0000000 --- a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.casic.app.smartwell.model - -class WellTypeModel { - /** - * code : 200 - * data : [{"name":"雨水井","id":"61","value":"1"},{"name":"污水井","id":"62","value":"2"},{"name":"燃气井","id":"63","value":"3"},{"name":"热力井","id":"64","value":"4"},{"name":"电力井","id":"65","value":"5"},{"name":"交通井","id":"88","value":"6"},{"name":"路灯井","id":"89","value":"7"},{"name":"通信井","id":"90","value":"8"},{"name":"监控井","id":"91","value":"9"},{"name":"其他","id":"92","value":"10"}] - * message : 请求成功 - * success : true - */ - var code = 0 - var message: String? = null - var isSuccess = false - var data: List? = null - - class DataBean { - /** - * name : 雨水井 - * id : 61 - * value : 1 - */ - var name: String? = null - var id: String? = null - var value: String? = null - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt index 051bfb8..d4138fc 100644 --- a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt @@ -39,7 +39,7 @@ /** * 获取闸井类别 */ - @GET("/sys/dict/code/sluicewellType") + @GET("/config/getAuthorByDept") suspend fun obtainWellType(@Header("token") token: String): String /** @@ -235,7 +235,6 @@ ): String /** - * TODO 特定POST请求 * 查询工单 * */ @POST("/job/searchList") @@ -274,16 +273,11 @@ /** * 修改密码 - * - * @param oldPwd 旧密码 - * @param newPwd 新密码 */ - @FormUrlEncoded - @POST("/mgr/changePwd") + @POST("/sys/mgr/changePwd") suspend fun changePassword( @Header("token") token: String, - @Field("oldPwd") oldPwd: String, - @Field("newPwd") newPwd: String + @Body requestBody: RequestBody ): String /** diff --git a/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt index 6987ed1..2d6fbc4 100644 --- a/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt +++ b/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt @@ -34,8 +34,8 @@ private lateinit var weakReferenceHandler: WeakReferenceHandler private lateinit var wellListAdapter: WellListAdapter private val context: Context = this@WellManagementActivity - private var items: MutableList = ArrayList() - private var wellTypeModel = WellTypeModel.DataBean() + private var items: MutableList = ArrayList() + private var wellTypeModel = WellTypeModel("", "") private var dataBeans: MutableList = ArrayList() private var keywords = "" private var wellType = "" @@ -53,30 +53,16 @@ override fun initData() { easyPopupWindow = WellTypePopupWindow(this) easyPopupWindow.setBackgroundDrawable(null) - wellViewModel = ViewModelProvider(this).get(WellViewModel::class.java) - wellListViewModel = ViewModelProvider(this).get(WellListViewModel::class.java) + wellViewModel = ViewModelProvider(this)[WellViewModel::class.java] + wellListViewModel = ViewModelProvider(this)[WellListViewModel::class.java] weakReferenceHandler = WeakReferenceHandler(callback) - } - override fun observeRequestState() { - - } - - override fun initEvent() { wellViewModel.obtainWellType() wellViewModel.wellTypeModel.observe(this, { if (it.code == 200) { - it.data!!.forEachIndexed { index, dataBean -> - val bean: WellTypeModel.DataBean - if (index == 0) { - bean = WellTypeModel.DataBean() - bean.id = "" - bean.name = "全\u3000部" - bean.value = "" - } else { - bean = dataBean - } - items.add(bean) + items.add(WellTypeModel("", "全\u3000部")) + it.data.wellTypes!!.forEach { value -> + items.add(WellTypeModel(value, value.valueToType())) } easyPopupWindow.setupPopupData(items) } @@ -108,23 +94,32 @@ weakReferenceHandler.sendEmptyMessage(2022032501) } }) + } - wellTypeLayout.setOnClickListener { - arrowImageView.arrowAnimation(180f) - easyPopupWindow.showAsDropDown(wellTypeLayout) + override fun observeRequestState() { + + } + + override fun initEvent() { + wellTypeView.setOnClickListener { + easyPopupWindow.showAsDropDown(wellTypeView) easyPopupWindow.setOnPopupWindowClickListener(object : WellTypePopupWindow.OnPopupWindowClickListener { override fun onPopupClick(position: Int) { - arrowImageView.arrowAnimation(0f) wellTypeModel = items[position] - wellTypeView.text = wellTypeModel.name + wellTypeView.text = wellTypeModel.typeValue.valueToType() + + //查询数据 + wellType = wellTypeModel.typeValue.toString() + pageIndex = 1 + obtainWellList() } }) } searchTextView.setOnClickListener { keywords = searchInputView.text.toString().trim() - wellType = wellTypeModel.value.toString() + wellType = wellTypeModel.typeValue.toString() pageIndex = 1 obtainWellList() } diff --git a/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt index 6b7d0dd..9463e79 100644 --- a/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt +++ b/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt @@ -36,8 +36,8 @@ private lateinit var weakReferenceHandler: WeakReferenceHandler private lateinit var wellOperationAdapter: WellOperationAdapter private val context: Context = this@WellOperationActivity - private var items: MutableList = ArrayList() - private var wellTypeModel = WellTypeModel.DataBean() + private var items: MutableList = ArrayList() + private var wellTypeModel = WellTypeModel("", "") private var dataBeans: MutableList = ArrayList() private var keywords = "" private var wellType = "" @@ -59,47 +59,18 @@ weakReferenceHandler = WeakReferenceHandler(callback) wellViewModel = ViewModelProvider(this).get(WellViewModel::class.java) wellListViewModel = ViewModelProvider(this).get(WellListViewModel::class.java) - } - override fun onResume() { - obtainWellList() - super.onResume() - } - - override fun observeRequestState() { - wellViewModel.loadState.observe(this, { - when (it) { - is LoadState.Loading -> LoadingDialogHub.show(this, "处理中,请稍后") - is LoadState.Success -> { - LoadingDialogHub.dismiss() - wellOperationAdapter.notifyItemChanged(clickedPosition) - } - else -> LoadingDialogHub.dismiss() - } - }) - } - - override fun initEvent() { wellViewModel.obtainWellType() wellViewModel.wellTypeModel.observe(this, { if (it.code == 200) { - it.data!!.forEachIndexed { index, dataBean -> - val bean: WellTypeModel.DataBean - if (index == 0) { - bean = WellTypeModel.DataBean() - bean.id = "" - bean.name = "全\u3000部" - bean.value = "" - } else { - bean = dataBean - } - items.add(bean) + items.add(WellTypeModel("", "全\u3000部")) + it.data.wellTypes!!.forEach { value -> + items.add(WellTypeModel(value, value.valueToType())) } easyPopupWindow.setupPopupData(items) } }) - //数据监听 wellListViewModel.listModel.observe(this, { if (it.code == 200) { val dataRows = it.data?.rows @@ -139,23 +110,47 @@ } } }) + } - wellTypeLayout.setOnClickListener { - arrowImageView.arrowAnimation(180f) - easyPopupWindow.showAsDropDown(wellTypeLayout) + override fun onResume() { + super.onResume() + pageIndex = 1 + obtainWellList() + } + + override fun observeRequestState() { + wellViewModel.loadState.observe(this, { + when (it) { + is LoadState.Loading -> LoadingDialogHub.show(this, "处理中,请稍后") + is LoadState.Success -> { + LoadingDialogHub.dismiss() + wellOperationAdapter.notifyItemChanged(clickedPosition) + } + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun initEvent() { + wellTypeView.setOnClickListener { + easyPopupWindow.showAsDropDown(wellTypeView) easyPopupWindow.setOnPopupWindowClickListener(object : WellTypePopupWindow.OnPopupWindowClickListener { override fun onPopupClick(position: Int) { - arrowImageView.arrowAnimation(0f) wellTypeModel = items[position] - wellTypeView.text = wellTypeModel.name + wellTypeView.text = wellTypeModel.typeValue.valueToType() + + //查询数据 + wellType = wellTypeModel.typeValue.toString() + pageIndex = 1 + obtainWellList() } }) } searchTextView.setOnClickListener { keywords = searchInputView.text.toString().trim() - wellType = wellTypeModel.value.toString() + wellType = wellTypeModel.typeValue.toString() pageIndex = 1 obtainWellList() } diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt index 816d63c..49c43e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt +++ b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt @@ -69,6 +69,7 @@ //窨井类型转换 fun String.valueToType(): String { return when (this) { + "" -> "全部" "1" -> "雨水井" "2" -> "污水井" "3" -> "燃气井" diff --git a/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java new file mode 100644 index 0000000..8f9f95d --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java @@ -0,0 +1,118 @@ +package com.casic.app.smartwell.model; + +import java.util.List; + +public class AuthorDeptModel { + + private int code; + private DataModel data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataModel { + private String area; + private List communications; + private String deptid; + private List deviceTypes; + private String id; + private String lat; + private String lng; + private List wellTypes; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public List getCommunications() { + return communications; + } + + public void setCommunications(List communications) { + this.communications = communications; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public List getDeviceTypes() { + return deviceTypes; + } + + public void setDeviceTypes(List deviceTypes) { + this.deviceTypes = deviceTypes; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public List getWellTypes() { + return wellTypes; + } + + public void setWellTypes(List wellTypes) { + this.wellTypes = wellTypes; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java new file mode 100644 index 0000000..c573c72 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java @@ -0,0 +1,27 @@ +package com.casic.app.smartwell.model; + +public class WellTypeModel { + private String typeValue; + private String wellType; + + public WellTypeModel(String typeValue, String wellType) { + this.typeValue = typeValue; + this.wellType = wellType; + } + + public String getTypeValue() { + return typeValue; + } + + public void setTypeValue(String typeValue) { + this.typeValue = typeValue; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt deleted file mode 100644 index cac523d..0000000 --- a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.casic.app.smartwell.model - -class WellTypeModel { - /** - * code : 200 - * data : [{"name":"雨水井","id":"61","value":"1"},{"name":"污水井","id":"62","value":"2"},{"name":"燃气井","id":"63","value":"3"},{"name":"热力井","id":"64","value":"4"},{"name":"电力井","id":"65","value":"5"},{"name":"交通井","id":"88","value":"6"},{"name":"路灯井","id":"89","value":"7"},{"name":"通信井","id":"90","value":"8"},{"name":"监控井","id":"91","value":"9"},{"name":"其他","id":"92","value":"10"}] - * message : 请求成功 - * success : true - */ - var code = 0 - var message: String? = null - var isSuccess = false - var data: List? = null - - class DataBean { - /** - * name : 雨水井 - * id : 61 - * value : 1 - */ - var name: String? = null - var id: String? = null - var value: String? = null - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt index 051bfb8..d4138fc 100644 --- a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt @@ -39,7 +39,7 @@ /** * 获取闸井类别 */ - @GET("/sys/dict/code/sluicewellType") + @GET("/config/getAuthorByDept") suspend fun obtainWellType(@Header("token") token: String): String /** @@ -235,7 +235,6 @@ ): String /** - * TODO 特定POST请求 * 查询工单 * */ @POST("/job/searchList") @@ -274,16 +273,11 @@ /** * 修改密码 - * - * @param oldPwd 旧密码 - * @param newPwd 新密码 */ - @FormUrlEncoded - @POST("/mgr/changePwd") + @POST("/sys/mgr/changePwd") suspend fun changePassword( @Header("token") token: String, - @Field("oldPwd") oldPwd: String, - @Field("newPwd") newPwd: String + @Body requestBody: RequestBody ): String /** diff --git a/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt index 6987ed1..2d6fbc4 100644 --- a/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt +++ b/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt @@ -34,8 +34,8 @@ private lateinit var weakReferenceHandler: WeakReferenceHandler private lateinit var wellListAdapter: WellListAdapter private val context: Context = this@WellManagementActivity - private var items: MutableList = ArrayList() - private var wellTypeModel = WellTypeModel.DataBean() + private var items: MutableList = ArrayList() + private var wellTypeModel = WellTypeModel("", "") private var dataBeans: MutableList = ArrayList() private var keywords = "" private var wellType = "" @@ -53,30 +53,16 @@ override fun initData() { easyPopupWindow = WellTypePopupWindow(this) easyPopupWindow.setBackgroundDrawable(null) - wellViewModel = ViewModelProvider(this).get(WellViewModel::class.java) - wellListViewModel = ViewModelProvider(this).get(WellListViewModel::class.java) + wellViewModel = ViewModelProvider(this)[WellViewModel::class.java] + wellListViewModel = ViewModelProvider(this)[WellListViewModel::class.java] weakReferenceHandler = WeakReferenceHandler(callback) - } - override fun observeRequestState() { - - } - - override fun initEvent() { wellViewModel.obtainWellType() wellViewModel.wellTypeModel.observe(this, { if (it.code == 200) { - it.data!!.forEachIndexed { index, dataBean -> - val bean: WellTypeModel.DataBean - if (index == 0) { - bean = WellTypeModel.DataBean() - bean.id = "" - bean.name = "全\u3000部" - bean.value = "" - } else { - bean = dataBean - } - items.add(bean) + items.add(WellTypeModel("", "全\u3000部")) + it.data.wellTypes!!.forEach { value -> + items.add(WellTypeModel(value, value.valueToType())) } easyPopupWindow.setupPopupData(items) } @@ -108,23 +94,32 @@ weakReferenceHandler.sendEmptyMessage(2022032501) } }) + } - wellTypeLayout.setOnClickListener { - arrowImageView.arrowAnimation(180f) - easyPopupWindow.showAsDropDown(wellTypeLayout) + override fun observeRequestState() { + + } + + override fun initEvent() { + wellTypeView.setOnClickListener { + easyPopupWindow.showAsDropDown(wellTypeView) easyPopupWindow.setOnPopupWindowClickListener(object : WellTypePopupWindow.OnPopupWindowClickListener { override fun onPopupClick(position: Int) { - arrowImageView.arrowAnimation(0f) wellTypeModel = items[position] - wellTypeView.text = wellTypeModel.name + wellTypeView.text = wellTypeModel.typeValue.valueToType() + + //查询数据 + wellType = wellTypeModel.typeValue.toString() + pageIndex = 1 + obtainWellList() } }) } searchTextView.setOnClickListener { keywords = searchInputView.text.toString().trim() - wellType = wellTypeModel.value.toString() + wellType = wellTypeModel.typeValue.toString() pageIndex = 1 obtainWellList() } diff --git a/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt index 6b7d0dd..9463e79 100644 --- a/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt +++ b/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt @@ -36,8 +36,8 @@ private lateinit var weakReferenceHandler: WeakReferenceHandler private lateinit var wellOperationAdapter: WellOperationAdapter private val context: Context = this@WellOperationActivity - private var items: MutableList = ArrayList() - private var wellTypeModel = WellTypeModel.DataBean() + private var items: MutableList = ArrayList() + private var wellTypeModel = WellTypeModel("", "") private var dataBeans: MutableList = ArrayList() private var keywords = "" private var wellType = "" @@ -59,47 +59,18 @@ weakReferenceHandler = WeakReferenceHandler(callback) wellViewModel = ViewModelProvider(this).get(WellViewModel::class.java) wellListViewModel = ViewModelProvider(this).get(WellListViewModel::class.java) - } - override fun onResume() { - obtainWellList() - super.onResume() - } - - override fun observeRequestState() { - wellViewModel.loadState.observe(this, { - when (it) { - is LoadState.Loading -> LoadingDialogHub.show(this, "处理中,请稍后") - is LoadState.Success -> { - LoadingDialogHub.dismiss() - wellOperationAdapter.notifyItemChanged(clickedPosition) - } - else -> LoadingDialogHub.dismiss() - } - }) - } - - override fun initEvent() { wellViewModel.obtainWellType() wellViewModel.wellTypeModel.observe(this, { if (it.code == 200) { - it.data!!.forEachIndexed { index, dataBean -> - val bean: WellTypeModel.DataBean - if (index == 0) { - bean = WellTypeModel.DataBean() - bean.id = "" - bean.name = "全\u3000部" - bean.value = "" - } else { - bean = dataBean - } - items.add(bean) + items.add(WellTypeModel("", "全\u3000部")) + it.data.wellTypes!!.forEach { value -> + items.add(WellTypeModel(value, value.valueToType())) } easyPopupWindow.setupPopupData(items) } }) - //数据监听 wellListViewModel.listModel.observe(this, { if (it.code == 200) { val dataRows = it.data?.rows @@ -139,23 +110,47 @@ } } }) + } - wellTypeLayout.setOnClickListener { - arrowImageView.arrowAnimation(180f) - easyPopupWindow.showAsDropDown(wellTypeLayout) + override fun onResume() { + super.onResume() + pageIndex = 1 + obtainWellList() + } + + override fun observeRequestState() { + wellViewModel.loadState.observe(this, { + when (it) { + is LoadState.Loading -> LoadingDialogHub.show(this, "处理中,请稍后") + is LoadState.Success -> { + LoadingDialogHub.dismiss() + wellOperationAdapter.notifyItemChanged(clickedPosition) + } + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun initEvent() { + wellTypeView.setOnClickListener { + easyPopupWindow.showAsDropDown(wellTypeView) easyPopupWindow.setOnPopupWindowClickListener(object : WellTypePopupWindow.OnPopupWindowClickListener { override fun onPopupClick(position: Int) { - arrowImageView.arrowAnimation(0f) wellTypeModel = items[position] - wellTypeView.text = wellTypeModel.name + wellTypeView.text = wellTypeModel.typeValue.valueToType() + + //查询数据 + wellType = wellTypeModel.typeValue.toString() + pageIndex = 1 + obtainWellList() } }) } searchTextView.setOnClickListener { keywords = searchInputView.text.toString().trim() - wellType = wellTypeModel.value.toString() + wellType = wellTypeModel.typeValue.toString() pageIndex = 1 obtainWellList() } diff --git a/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt b/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt index d025446..e440a62 100644 --- a/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt +++ b/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt @@ -7,7 +7,7 @@ import com.casic.app.smartwell.model.CommonResultModel import com.casic.app.smartwell.model.WellDetailModel import com.casic.app.smartwell.model.WellMonitorModel -import com.casic.app.smartwell.model.WellTypeModel +import com.casic.app.smartwell.model.AuthorDeptModel import com.casic.app.smartwell.utils.retrofit.RetrofitServiceManager import com.google.gson.Gson import com.google.gson.reflect.TypeToken @@ -21,7 +21,7 @@ private val gson = Gson() val countResultModel = MutableLiveData>() - val wellTypeModel = MutableLiveData() + val wellTypeModel = MutableLiveData() val wellDetailModel = MutableLiveData() val commonResultModel = MutableLiveData() val monitorModel = MutableLiveData() @@ -57,8 +57,8 @@ val response = RetrofitServiceManager.obtainWellType() val responseCode = response.separateResponseCode() if (responseCode == 200) { - wellTypeModel.value = gson.fromJson( - response, object : TypeToken() {}.type + wellTypeModel.value = gson.fromJson( + response, object : TypeToken() {}.type ) } else { response.toErrorMessage().show(BaseApplication.obtainInstance()) diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt index 816d63c..49c43e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt +++ b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt @@ -69,6 +69,7 @@ //窨井类型转换 fun String.valueToType(): String { return when (this) { + "" -> "全部" "1" -> "雨水井" "2" -> "污水井" "3" -> "燃气井" diff --git a/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java new file mode 100644 index 0000000..8f9f95d --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java @@ -0,0 +1,118 @@ +package com.casic.app.smartwell.model; + +import java.util.List; + +public class AuthorDeptModel { + + private int code; + private DataModel data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataModel { + private String area; + private List communications; + private String deptid; + private List deviceTypes; + private String id; + private String lat; + private String lng; + private List wellTypes; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public List getCommunications() { + return communications; + } + + public void setCommunications(List communications) { + this.communications = communications; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public List getDeviceTypes() { + return deviceTypes; + } + + public void setDeviceTypes(List deviceTypes) { + this.deviceTypes = deviceTypes; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public List getWellTypes() { + return wellTypes; + } + + public void setWellTypes(List wellTypes) { + this.wellTypes = wellTypes; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java new file mode 100644 index 0000000..c573c72 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java @@ -0,0 +1,27 @@ +package com.casic.app.smartwell.model; + +public class WellTypeModel { + private String typeValue; + private String wellType; + + public WellTypeModel(String typeValue, String wellType) { + this.typeValue = typeValue; + this.wellType = wellType; + } + + public String getTypeValue() { + return typeValue; + } + + public void setTypeValue(String typeValue) { + this.typeValue = typeValue; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt deleted file mode 100644 index cac523d..0000000 --- a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.casic.app.smartwell.model - -class WellTypeModel { - /** - * code : 200 - * data : [{"name":"雨水井","id":"61","value":"1"},{"name":"污水井","id":"62","value":"2"},{"name":"燃气井","id":"63","value":"3"},{"name":"热力井","id":"64","value":"4"},{"name":"电力井","id":"65","value":"5"},{"name":"交通井","id":"88","value":"6"},{"name":"路灯井","id":"89","value":"7"},{"name":"通信井","id":"90","value":"8"},{"name":"监控井","id":"91","value":"9"},{"name":"其他","id":"92","value":"10"}] - * message : 请求成功 - * success : true - */ - var code = 0 - var message: String? = null - var isSuccess = false - var data: List? = null - - class DataBean { - /** - * name : 雨水井 - * id : 61 - * value : 1 - */ - var name: String? = null - var id: String? = null - var value: String? = null - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt index 051bfb8..d4138fc 100644 --- a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt @@ -39,7 +39,7 @@ /** * 获取闸井类别 */ - @GET("/sys/dict/code/sluicewellType") + @GET("/config/getAuthorByDept") suspend fun obtainWellType(@Header("token") token: String): String /** @@ -235,7 +235,6 @@ ): String /** - * TODO 特定POST请求 * 查询工单 * */ @POST("/job/searchList") @@ -274,16 +273,11 @@ /** * 修改密码 - * - * @param oldPwd 旧密码 - * @param newPwd 新密码 */ - @FormUrlEncoded - @POST("/mgr/changePwd") + @POST("/sys/mgr/changePwd") suspend fun changePassword( @Header("token") token: String, - @Field("oldPwd") oldPwd: String, - @Field("newPwd") newPwd: String + @Body requestBody: RequestBody ): String /** diff --git a/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt index 6987ed1..2d6fbc4 100644 --- a/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt +++ b/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt @@ -34,8 +34,8 @@ private lateinit var weakReferenceHandler: WeakReferenceHandler private lateinit var wellListAdapter: WellListAdapter private val context: Context = this@WellManagementActivity - private var items: MutableList = ArrayList() - private var wellTypeModel = WellTypeModel.DataBean() + private var items: MutableList = ArrayList() + private var wellTypeModel = WellTypeModel("", "") private var dataBeans: MutableList = ArrayList() private var keywords = "" private var wellType = "" @@ -53,30 +53,16 @@ override fun initData() { easyPopupWindow = WellTypePopupWindow(this) easyPopupWindow.setBackgroundDrawable(null) - wellViewModel = ViewModelProvider(this).get(WellViewModel::class.java) - wellListViewModel = ViewModelProvider(this).get(WellListViewModel::class.java) + wellViewModel = ViewModelProvider(this)[WellViewModel::class.java] + wellListViewModel = ViewModelProvider(this)[WellListViewModel::class.java] weakReferenceHandler = WeakReferenceHandler(callback) - } - override fun observeRequestState() { - - } - - override fun initEvent() { wellViewModel.obtainWellType() wellViewModel.wellTypeModel.observe(this, { if (it.code == 200) { - it.data!!.forEachIndexed { index, dataBean -> - val bean: WellTypeModel.DataBean - if (index == 0) { - bean = WellTypeModel.DataBean() - bean.id = "" - bean.name = "全\u3000部" - bean.value = "" - } else { - bean = dataBean - } - items.add(bean) + items.add(WellTypeModel("", "全\u3000部")) + it.data.wellTypes!!.forEach { value -> + items.add(WellTypeModel(value, value.valueToType())) } easyPopupWindow.setupPopupData(items) } @@ -108,23 +94,32 @@ weakReferenceHandler.sendEmptyMessage(2022032501) } }) + } - wellTypeLayout.setOnClickListener { - arrowImageView.arrowAnimation(180f) - easyPopupWindow.showAsDropDown(wellTypeLayout) + override fun observeRequestState() { + + } + + override fun initEvent() { + wellTypeView.setOnClickListener { + easyPopupWindow.showAsDropDown(wellTypeView) easyPopupWindow.setOnPopupWindowClickListener(object : WellTypePopupWindow.OnPopupWindowClickListener { override fun onPopupClick(position: Int) { - arrowImageView.arrowAnimation(0f) wellTypeModel = items[position] - wellTypeView.text = wellTypeModel.name + wellTypeView.text = wellTypeModel.typeValue.valueToType() + + //查询数据 + wellType = wellTypeModel.typeValue.toString() + pageIndex = 1 + obtainWellList() } }) } searchTextView.setOnClickListener { keywords = searchInputView.text.toString().trim() - wellType = wellTypeModel.value.toString() + wellType = wellTypeModel.typeValue.toString() pageIndex = 1 obtainWellList() } diff --git a/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt index 6b7d0dd..9463e79 100644 --- a/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt +++ b/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt @@ -36,8 +36,8 @@ private lateinit var weakReferenceHandler: WeakReferenceHandler private lateinit var wellOperationAdapter: WellOperationAdapter private val context: Context = this@WellOperationActivity - private var items: MutableList = ArrayList() - private var wellTypeModel = WellTypeModel.DataBean() + private var items: MutableList = ArrayList() + private var wellTypeModel = WellTypeModel("", "") private var dataBeans: MutableList = ArrayList() private var keywords = "" private var wellType = "" @@ -59,47 +59,18 @@ weakReferenceHandler = WeakReferenceHandler(callback) wellViewModel = ViewModelProvider(this).get(WellViewModel::class.java) wellListViewModel = ViewModelProvider(this).get(WellListViewModel::class.java) - } - override fun onResume() { - obtainWellList() - super.onResume() - } - - override fun observeRequestState() { - wellViewModel.loadState.observe(this, { - when (it) { - is LoadState.Loading -> LoadingDialogHub.show(this, "处理中,请稍后") - is LoadState.Success -> { - LoadingDialogHub.dismiss() - wellOperationAdapter.notifyItemChanged(clickedPosition) - } - else -> LoadingDialogHub.dismiss() - } - }) - } - - override fun initEvent() { wellViewModel.obtainWellType() wellViewModel.wellTypeModel.observe(this, { if (it.code == 200) { - it.data!!.forEachIndexed { index, dataBean -> - val bean: WellTypeModel.DataBean - if (index == 0) { - bean = WellTypeModel.DataBean() - bean.id = "" - bean.name = "全\u3000部" - bean.value = "" - } else { - bean = dataBean - } - items.add(bean) + items.add(WellTypeModel("", "全\u3000部")) + it.data.wellTypes!!.forEach { value -> + items.add(WellTypeModel(value, value.valueToType())) } easyPopupWindow.setupPopupData(items) } }) - //数据监听 wellListViewModel.listModel.observe(this, { if (it.code == 200) { val dataRows = it.data?.rows @@ -139,23 +110,47 @@ } } }) + } - wellTypeLayout.setOnClickListener { - arrowImageView.arrowAnimation(180f) - easyPopupWindow.showAsDropDown(wellTypeLayout) + override fun onResume() { + super.onResume() + pageIndex = 1 + obtainWellList() + } + + override fun observeRequestState() { + wellViewModel.loadState.observe(this, { + when (it) { + is LoadState.Loading -> LoadingDialogHub.show(this, "处理中,请稍后") + is LoadState.Success -> { + LoadingDialogHub.dismiss() + wellOperationAdapter.notifyItemChanged(clickedPosition) + } + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun initEvent() { + wellTypeView.setOnClickListener { + easyPopupWindow.showAsDropDown(wellTypeView) easyPopupWindow.setOnPopupWindowClickListener(object : WellTypePopupWindow.OnPopupWindowClickListener { override fun onPopupClick(position: Int) { - arrowImageView.arrowAnimation(0f) wellTypeModel = items[position] - wellTypeView.text = wellTypeModel.name + wellTypeView.text = wellTypeModel.typeValue.valueToType() + + //查询数据 + wellType = wellTypeModel.typeValue.toString() + pageIndex = 1 + obtainWellList() } }) } searchTextView.setOnClickListener { keywords = searchInputView.text.toString().trim() - wellType = wellTypeModel.value.toString() + wellType = wellTypeModel.typeValue.toString() pageIndex = 1 obtainWellList() } diff --git a/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt b/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt index d025446..e440a62 100644 --- a/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt +++ b/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt @@ -7,7 +7,7 @@ import com.casic.app.smartwell.model.CommonResultModel import com.casic.app.smartwell.model.WellDetailModel import com.casic.app.smartwell.model.WellMonitorModel -import com.casic.app.smartwell.model.WellTypeModel +import com.casic.app.smartwell.model.AuthorDeptModel import com.casic.app.smartwell.utils.retrofit.RetrofitServiceManager import com.google.gson.Gson import com.google.gson.reflect.TypeToken @@ -21,7 +21,7 @@ private val gson = Gson() val countResultModel = MutableLiveData>() - val wellTypeModel = MutableLiveData() + val wellTypeModel = MutableLiveData() val wellDetailModel = MutableLiveData() val commonResultModel = MutableLiveData() val monitorModel = MutableLiveData() @@ -57,8 +57,8 @@ val response = RetrofitServiceManager.obtainWellType() val responseCode = response.separateResponseCode() if (responseCode == 200) { - wellTypeModel.value = gson.fromJson( - response, object : TypeToken() {}.type + wellTypeModel.value = gson.fromJson( + response, object : TypeToken() {}.type ) } else { response.toErrorMessage().show(BaseApplication.obtainInstance()) diff --git a/app/src/main/java/com/casic/app/smartwell/widgets/WellTypePopupWindow.kt b/app/src/main/java/com/casic/app/smartwell/widgets/WellTypePopupWindow.kt index 48d4d21..c7d4aea 100644 --- a/app/src/main/java/com/casic/app/smartwell/widgets/WellTypePopupWindow.kt +++ b/app/src/main/java/com/casic/app/smartwell/widgets/WellTypePopupWindow.kt @@ -18,7 +18,7 @@ class WellTypePopupWindow(private val ctx: Context) : PopupWindow(ctx) { private var mClickListener: OnPopupWindowClickListener? = null - private var items: List = ArrayList() + private var items: List = ArrayList() init { width = (ctx.obtainScreenWidth() * 0.25).toInt() @@ -29,7 +29,7 @@ contentView = LayoutInflater.from(ctx).inflate(R.layout.popup_well_type, null, false) } - fun setupPopupData(itemList: List) { + fun setupPopupData(itemList: List) { this.items = itemList val popupListView = contentView.findViewById(R.id.popupListView) setupListView(popupListView) @@ -77,7 +77,7 @@ view = convertView holder = view.tag as ItemViewHolder } - holder.popupTitle.text = items[position].name + holder.popupTitle.text = items[position].wellType return view } } diff --git a/app/build.gradle b/app/build.gradle index f53f7e1..e7957e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,5 @@ +import java.text.SimpleDateFormat + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' @@ -19,8 +21,8 @@ applicationId "com.casic.app.smartwell" minSdkVersion 23 targetSdkVersion 31 - versionCode 1 - versionName "1.0.0" + versionCode 6 + versionName "1.0.6" manifestPlaceholders = [GETUI_APPID: "HKv8K9qARd6WckZ1o2Vbu4"] } @@ -48,7 +50,7 @@ applicationVariants.all { variant -> variant.outputs.all { - outputFileName = defaultConfig.versionName + ".apk" + outputFileName = getBuildDate() + ".apk" } } @@ -59,6 +61,11 @@ } } +static def getBuildDate() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHMM", Locale.CHINA) + return dateFormat.format(System.currentTimeMillis()) +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //基础依赖库 diff --git a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt index 816d63c..49c43e6 100644 --- a/app/src/main/java/com/casic/app/smartwell/extensions/String.kt +++ b/app/src/main/java/com/casic/app/smartwell/extensions/String.kt @@ -69,6 +69,7 @@ //窨井类型转换 fun String.valueToType(): String { return when (this) { + "" -> "全部" "1" -> "雨水井" "2" -> "污水井" "3" -> "燃气井" diff --git a/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java new file mode 100644 index 0000000..8f9f95d --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/AuthorDeptModel.java @@ -0,0 +1,118 @@ +package com.casic.app.smartwell.model; + +import java.util.List; + +public class AuthorDeptModel { + + private int code; + private DataModel data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public DataModel getData() { + return data; + } + + public void setData(DataModel data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataModel { + private String area; + private List communications; + private String deptid; + private List deviceTypes; + private String id; + private String lat; + private String lng; + private List wellTypes; + + public String getArea() { + return area; + } + + public void setArea(String area) { + this.area = area; + } + + public List getCommunications() { + return communications; + } + + public void setCommunications(List communications) { + this.communications = communications; + } + + public String getDeptid() { + return deptid; + } + + public void setDeptid(String deptid) { + this.deptid = deptid; + } + + public List getDeviceTypes() { + return deviceTypes; + } + + public void setDeviceTypes(List deviceTypes) { + this.deviceTypes = deviceTypes; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public List getWellTypes() { + return wellTypes; + } + + public void setWellTypes(List wellTypes) { + this.wellTypes = wellTypes; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java new file mode 100644 index 0000000..c573c72 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.java @@ -0,0 +1,27 @@ +package com.casic.app.smartwell.model; + +public class WellTypeModel { + private String typeValue; + private String wellType; + + public WellTypeModel(String typeValue, String wellType) { + this.typeValue = typeValue; + this.wellType = wellType; + } + + public String getTypeValue() { + return typeValue; + } + + public void setTypeValue(String typeValue) { + this.typeValue = typeValue; + } + + public String getWellType() { + return wellType; + } + + public void setWellType(String wellType) { + this.wellType = wellType; + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt b/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt deleted file mode 100644 index cac523d..0000000 --- a/app/src/main/java/com/casic/app/smartwell/model/WellTypeModel.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.casic.app.smartwell.model - -class WellTypeModel { - /** - * code : 200 - * data : [{"name":"雨水井","id":"61","value":"1"},{"name":"污水井","id":"62","value":"2"},{"name":"燃气井","id":"63","value":"3"},{"name":"热力井","id":"64","value":"4"},{"name":"电力井","id":"65","value":"5"},{"name":"交通井","id":"88","value":"6"},{"name":"路灯井","id":"89","value":"7"},{"name":"通信井","id":"90","value":"8"},{"name":"监控井","id":"91","value":"9"},{"name":"其他","id":"92","value":"10"}] - * message : 请求成功 - * success : true - */ - var code = 0 - var message: String? = null - var isSuccess = false - var data: List? = null - - class DataBean { - /** - * name : 雨水井 - * id : 61 - * value : 1 - */ - var name: String? = null - var id: String? = null - var value: String? = null - } -} \ No newline at end of file diff --git a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt index 051bfb8..d4138fc 100644 --- a/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/utils/retrofit/RetrofitService.kt @@ -39,7 +39,7 @@ /** * 获取闸井类别 */ - @GET("/sys/dict/code/sluicewellType") + @GET("/config/getAuthorByDept") suspend fun obtainWellType(@Header("token") token: String): String /** @@ -235,7 +235,6 @@ ): String /** - * TODO 特定POST请求 * 查询工单 * */ @POST("/job/searchList") @@ -274,16 +273,11 @@ /** * 修改密码 - * - * @param oldPwd 旧密码 - * @param newPwd 新密码 */ - @FormUrlEncoded - @POST("/mgr/changePwd") + @POST("/sys/mgr/changePwd") suspend fun changePassword( @Header("token") token: String, - @Field("oldPwd") oldPwd: String, - @Field("newPwd") newPwd: String + @Body requestBody: RequestBody ): String /** diff --git a/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt index 6987ed1..2d6fbc4 100644 --- a/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt +++ b/app/src/main/java/com/casic/app/smartwell/view/WellManagementActivity.kt @@ -34,8 +34,8 @@ private lateinit var weakReferenceHandler: WeakReferenceHandler private lateinit var wellListAdapter: WellListAdapter private val context: Context = this@WellManagementActivity - private var items: MutableList = ArrayList() - private var wellTypeModel = WellTypeModel.DataBean() + private var items: MutableList = ArrayList() + private var wellTypeModel = WellTypeModel("", "") private var dataBeans: MutableList = ArrayList() private var keywords = "" private var wellType = "" @@ -53,30 +53,16 @@ override fun initData() { easyPopupWindow = WellTypePopupWindow(this) easyPopupWindow.setBackgroundDrawable(null) - wellViewModel = ViewModelProvider(this).get(WellViewModel::class.java) - wellListViewModel = ViewModelProvider(this).get(WellListViewModel::class.java) + wellViewModel = ViewModelProvider(this)[WellViewModel::class.java] + wellListViewModel = ViewModelProvider(this)[WellListViewModel::class.java] weakReferenceHandler = WeakReferenceHandler(callback) - } - override fun observeRequestState() { - - } - - override fun initEvent() { wellViewModel.obtainWellType() wellViewModel.wellTypeModel.observe(this, { if (it.code == 200) { - it.data!!.forEachIndexed { index, dataBean -> - val bean: WellTypeModel.DataBean - if (index == 0) { - bean = WellTypeModel.DataBean() - bean.id = "" - bean.name = "全\u3000部" - bean.value = "" - } else { - bean = dataBean - } - items.add(bean) + items.add(WellTypeModel("", "全\u3000部")) + it.data.wellTypes!!.forEach { value -> + items.add(WellTypeModel(value, value.valueToType())) } easyPopupWindow.setupPopupData(items) } @@ -108,23 +94,32 @@ weakReferenceHandler.sendEmptyMessage(2022032501) } }) + } - wellTypeLayout.setOnClickListener { - arrowImageView.arrowAnimation(180f) - easyPopupWindow.showAsDropDown(wellTypeLayout) + override fun observeRequestState() { + + } + + override fun initEvent() { + wellTypeView.setOnClickListener { + easyPopupWindow.showAsDropDown(wellTypeView) easyPopupWindow.setOnPopupWindowClickListener(object : WellTypePopupWindow.OnPopupWindowClickListener { override fun onPopupClick(position: Int) { - arrowImageView.arrowAnimation(0f) wellTypeModel = items[position] - wellTypeView.text = wellTypeModel.name + wellTypeView.text = wellTypeModel.typeValue.valueToType() + + //查询数据 + wellType = wellTypeModel.typeValue.toString() + pageIndex = 1 + obtainWellList() } }) } searchTextView.setOnClickListener { keywords = searchInputView.text.toString().trim() - wellType = wellTypeModel.value.toString() + wellType = wellTypeModel.typeValue.toString() pageIndex = 1 obtainWellList() } diff --git a/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt b/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt index 6b7d0dd..9463e79 100644 --- a/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt +++ b/app/src/main/java/com/casic/app/smartwell/view/WellOperationActivity.kt @@ -36,8 +36,8 @@ private lateinit var weakReferenceHandler: WeakReferenceHandler private lateinit var wellOperationAdapter: WellOperationAdapter private val context: Context = this@WellOperationActivity - private var items: MutableList = ArrayList() - private var wellTypeModel = WellTypeModel.DataBean() + private var items: MutableList = ArrayList() + private var wellTypeModel = WellTypeModel("", "") private var dataBeans: MutableList = ArrayList() private var keywords = "" private var wellType = "" @@ -59,47 +59,18 @@ weakReferenceHandler = WeakReferenceHandler(callback) wellViewModel = ViewModelProvider(this).get(WellViewModel::class.java) wellListViewModel = ViewModelProvider(this).get(WellListViewModel::class.java) - } - override fun onResume() { - obtainWellList() - super.onResume() - } - - override fun observeRequestState() { - wellViewModel.loadState.observe(this, { - when (it) { - is LoadState.Loading -> LoadingDialogHub.show(this, "处理中,请稍后") - is LoadState.Success -> { - LoadingDialogHub.dismiss() - wellOperationAdapter.notifyItemChanged(clickedPosition) - } - else -> LoadingDialogHub.dismiss() - } - }) - } - - override fun initEvent() { wellViewModel.obtainWellType() wellViewModel.wellTypeModel.observe(this, { if (it.code == 200) { - it.data!!.forEachIndexed { index, dataBean -> - val bean: WellTypeModel.DataBean - if (index == 0) { - bean = WellTypeModel.DataBean() - bean.id = "" - bean.name = "全\u3000部" - bean.value = "" - } else { - bean = dataBean - } - items.add(bean) + items.add(WellTypeModel("", "全\u3000部")) + it.data.wellTypes!!.forEach { value -> + items.add(WellTypeModel(value, value.valueToType())) } easyPopupWindow.setupPopupData(items) } }) - //数据监听 wellListViewModel.listModel.observe(this, { if (it.code == 200) { val dataRows = it.data?.rows @@ -139,23 +110,47 @@ } } }) + } - wellTypeLayout.setOnClickListener { - arrowImageView.arrowAnimation(180f) - easyPopupWindow.showAsDropDown(wellTypeLayout) + override fun onResume() { + super.onResume() + pageIndex = 1 + obtainWellList() + } + + override fun observeRequestState() { + wellViewModel.loadState.observe(this, { + when (it) { + is LoadState.Loading -> LoadingDialogHub.show(this, "处理中,请稍后") + is LoadState.Success -> { + LoadingDialogHub.dismiss() + wellOperationAdapter.notifyItemChanged(clickedPosition) + } + else -> LoadingDialogHub.dismiss() + } + }) + } + + override fun initEvent() { + wellTypeView.setOnClickListener { + easyPopupWindow.showAsDropDown(wellTypeView) easyPopupWindow.setOnPopupWindowClickListener(object : WellTypePopupWindow.OnPopupWindowClickListener { override fun onPopupClick(position: Int) { - arrowImageView.arrowAnimation(0f) wellTypeModel = items[position] - wellTypeView.text = wellTypeModel.name + wellTypeView.text = wellTypeModel.typeValue.valueToType() + + //查询数据 + wellType = wellTypeModel.typeValue.toString() + pageIndex = 1 + obtainWellList() } }) } searchTextView.setOnClickListener { keywords = searchInputView.text.toString().trim() - wellType = wellTypeModel.value.toString() + wellType = wellTypeModel.typeValue.toString() pageIndex = 1 obtainWellList() } diff --git a/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt b/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt index d025446..e440a62 100644 --- a/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt +++ b/app/src/main/java/com/casic/app/smartwell/vm/WellViewModel.kt @@ -7,7 +7,7 @@ import com.casic.app.smartwell.model.CommonResultModel import com.casic.app.smartwell.model.WellDetailModel import com.casic.app.smartwell.model.WellMonitorModel -import com.casic.app.smartwell.model.WellTypeModel +import com.casic.app.smartwell.model.AuthorDeptModel import com.casic.app.smartwell.utils.retrofit.RetrofitServiceManager import com.google.gson.Gson import com.google.gson.reflect.TypeToken @@ -21,7 +21,7 @@ private val gson = Gson() val countResultModel = MutableLiveData>() - val wellTypeModel = MutableLiveData() + val wellTypeModel = MutableLiveData() val wellDetailModel = MutableLiveData() val commonResultModel = MutableLiveData() val monitorModel = MutableLiveData() @@ -57,8 +57,8 @@ val response = RetrofitServiceManager.obtainWellType() val responseCode = response.separateResponseCode() if (responseCode == 200) { - wellTypeModel.value = gson.fromJson( - response, object : TypeToken() {}.type + wellTypeModel.value = gson.fromJson( + response, object : TypeToken() {}.type ) } else { response.toErrorMessage().show(BaseApplication.obtainInstance()) diff --git a/app/src/main/java/com/casic/app/smartwell/widgets/WellTypePopupWindow.kt b/app/src/main/java/com/casic/app/smartwell/widgets/WellTypePopupWindow.kt index 48d4d21..c7d4aea 100644 --- a/app/src/main/java/com/casic/app/smartwell/widgets/WellTypePopupWindow.kt +++ b/app/src/main/java/com/casic/app/smartwell/widgets/WellTypePopupWindow.kt @@ -18,7 +18,7 @@ class WellTypePopupWindow(private val ctx: Context) : PopupWindow(ctx) { private var mClickListener: OnPopupWindowClickListener? = null - private var items: List = ArrayList() + private var items: List = ArrayList() init { width = (ctx.obtainScreenWidth() * 0.25).toInt() @@ -29,7 +29,7 @@ contentView = LayoutInflater.from(ctx).inflate(R.layout.popup_well_type, null, false) } - fun setupPopupData(itemList: List) { + fun setupPopupData(itemList: List) { this.items = itemList val popupListView = contentView.findViewById(R.id.popupListView) setupListView(popupListView) @@ -77,7 +77,7 @@ view = convertView holder = view.tag as ItemViewHolder } - holder.popupTitle.text = items[position].name + holder.popupTitle.text = items[position].wellType return view } } diff --git a/app/src/main/res/layout/include_search_bar.xml b/app/src/main/res/layout/include_search_bar.xml index 64a106f..c64f9f5 100644 --- a/app/src/main/res/layout/include_search_bar.xml +++ b/app/src/main/res/layout/include_search_bar.xml @@ -5,30 +5,16 @@ android:background="@color/mainThemeColor" android:orientation="horizontal"> - - - - - - + android:text="全\u3000部" + android:textColor="@color/white" + android:textSize="14sp" />