修改条件限速

修改数据上传下载地址
This commit is contained in:
squallzhjch 2023-05-19 17:23:45 +08:00
parent ebe5ecc689
commit 00f39555ab
8 changed files with 89 additions and 10 deletions

View File

@ -19,6 +19,8 @@ data class SignBean(
val geometry: String,
//底部文字
val bottomText: String,
//底部右侧文字
val bottomRightText: String,
//要素code类型
val elementCode: Int
) : Parcelable

View File

@ -50,13 +50,13 @@ interface RetrofitNetworkServiceAPI {
@Url url: String
): Response<ResponseBody>
@GET("/devcp/task?evaluatType=2")
@GET("/devcp/getEvaluationTask?evaluatType=2")
suspend fun retrofitGetTaskList(
@Query("evaluatorNo") evaluatorNo: String,
): Response<DefaultTaskResponse<List<TaskBean>>>
@Headers("Content-Type: application/json")
@POST("/devcp/upload")
@POST("/devcp/uploadSceneProblem")
suspend fun postRequest(@Body listEvaluationInfo: List<EvaluationInfo>?): Response<ResponseBody>
/**

View File

@ -216,6 +216,7 @@ class MainViewModel @Inject constructor(
linkId = linkId,
geometry = element.geometry,
bottomText = SignUtil.getSignBottomText(element),
bottomRightText = SignUtil.getSignBottomRightText(element),
elementCode = element.code
)
)

View File

@ -26,6 +26,7 @@ class SignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = null)
bd.signMainIcon.background = holder.viewBinding.root.context.getDrawable(item.iconId)
bd.signMainIcon.text = item.iconText
bd.signBottomText.text = item.bottomText
bd.signBottomRightText.text = item.bottomRightText
bd.root.setOnClickListener {
itemListener?.invoke(position, item)
}

View File

@ -12,7 +12,7 @@ class SignUtil {
*/
fun getSignIconText(data: RenderEntity): String {
return when (data.code) {
//常规点限速
//常规点限速,条件点限速
4002, 4003 -> getSpeedLimitText(data)
// //道路种别
// 2008 -> getKindCodeIcon(data)
@ -26,8 +26,12 @@ class SignUtil {
fun getSignBottomText(data: RenderEntity): String {
return when (data.code) {
//可变点限速
4004 -> "可变点限速"
//常规点限速
4002 -> "常规点限速"
//常点限速
4003 -> "条件点限速"
//道路种别
2008 -> "道路种别"
//道路方向
@ -38,6 +42,64 @@ class SignUtil {
}
}
/**
* 右下角文字
*/
fun getSignBottomRightText(data: RenderEntity): String {
return when (data.code) {
//常点限速
4003 -> getConditionLimitText(data)
else -> ""
}
}
/**
* 条件点限速文字
*/
fun getConditionLimitText(data: RenderEntity): String {
var stringBuffer = StringBuffer()
try {
val dependent = data.properties["speedDependent"]
dependent?.let {
val dependentInt = it.toInt()
for (i in 31 downTo 0) {
val bit = (dependentInt shr i) and 1
if (bit == 1) {
when (i) {
0 -> stringBuffer.append("学校 ")
1 -> stringBuffer.append("")
2 -> stringBuffer.append("")
3 -> stringBuffer.append("结冰 ")
4 -> stringBuffer.append("其他天气 ")
5 -> stringBuffer.append("减速带 ")
6 -> stringBuffer.append("时间 ")
7 -> stringBuffer.append("车辆 ")
8 -> stringBuffer.append("建议 ")
9 -> stringBuffer.append("")
10 -> stringBuffer.append("其他 ")
}
}
}
}
} catch (e: Exception) {
}
return stringBuffer.toString()
}
private fun isBitSet(number: Int, n: Int): Boolean {
// 创建一个二进制数,只有第 n 个 bit 位是 1其他 bit 位是 0
val mask = 1 shl (n - 1)
// 将原始二进制数与上面创建的二进制数进行位运算
val result = number and mask
// 判断运算结果是否为 0
return result != 0
}
/**
* 获取限速值文字
*/

View File

@ -12,20 +12,33 @@
android:layout_height="40dp"
android:layout_marginLeft="19dp"
android:layout_marginTop="4dp"
android:background="@drawable/shape_icon_speed_limit"
android:background="@drawable/icon_speed_limit"
android:gravity="center"
android:text="80"
android:textColor="#2F2F2F"
android:textSize="14.67sp" />
android:textSize="14sp" />
<TextView
android:id="@+id/sign_bottom_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentBottom="true"
android:layout_marginLeft="15dp"
android:layout_marginBottom="5dp"
android:gravity="center"
android:text="道路名"
android:layout_alignParentBottom="true"
android:textColor="@color/white"
android:textSize="14.67sp" />
android:textSize="14sp" />
<TextView
android:id="@+id/sign_bottom_right_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="其他信息"
android:layout_alignTop="@id/sign_bottom_text"
android:textColor="@color/white"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:textSize="14sp"/>
</RelativeLayout>

View File

@ -16,7 +16,7 @@
<item
android:id="@+id/personal_center_menu_import_data"
android:icon="@drawable/ic_baseline_import_export_24"
android:visible="false"
android:visible="true"
android:title="导入数据" />
<item
android:id="@+id/personal_center_menu_import_yuan_data"

View File

@ -65,7 +65,7 @@ open class TaskBean @JvmOverloads constructor(
var color: Int = 0xFF00AA
) : RealmObject() {
fun getDownLoadUrl(): String {
return "${Constant.SERVER_ADDRESS}devcp/download?fileStr=$id"
return "${Constant.SERVER_ADDRESS}devcp/downFile?fileStr=$id"
}
}