|
@@ -3,6 +3,7 @@ package com.iscs.bozzys.api
|
|
|
import android.util.Log
|
|
import android.util.Log
|
|
|
import androidx.compose.runtime.snapshots.SnapshotStateMap
|
|
import androidx.compose.runtime.snapshots.SnapshotStateMap
|
|
|
import androidx.compose.ui.geometry.Offset
|
|
import androidx.compose.ui.geometry.Offset
|
|
|
|
|
+import com.google.gson.Gson
|
|
|
import com.iscs.bozzys.ui.pages.edit.step.compose.Anchor
|
|
import com.iscs.bozzys.ui.pages.edit.step.compose.Anchor
|
|
|
import com.iscs.bozzys.ui.pages.edit.step.compose.Connection
|
|
import com.iscs.bozzys.ui.pages.edit.step.compose.Connection
|
|
|
import com.iscs.bozzys.ui.pages.edit.step.compose.NodeUI
|
|
import com.iscs.bozzys.ui.pages.edit.step.compose.NodeUI
|
|
@@ -46,6 +47,14 @@ class LoginRsp(
|
|
|
*/
|
|
*/
|
|
|
class PageRsp<T>(val total: Int, val list: List<T>)
|
|
class PageRsp<T>(val total: Int, val list: List<T>)
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 获取用户角色
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param user 用户信息
|
|
|
|
|
+ * @param roles 角色信息
|
|
|
|
|
+ */
|
|
|
|
|
+class PermissionRsp(val user: User, val roles: List<String>)
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 任务统计
|
|
* 任务统计
|
|
|
*/
|
|
*/
|
|
@@ -63,25 +72,25 @@ data class IsolationPoint(val id: Int, val pointName: String, val pointNfc: Stri
|
|
|
*/
|
|
*/
|
|
|
@Serializable
|
|
@Serializable
|
|
|
data class User(
|
|
data class User(
|
|
|
- val id: Int,
|
|
|
|
|
- val userId: Int?,
|
|
|
|
|
- val username: String,
|
|
|
|
|
- val nickname: String,
|
|
|
|
|
- val cardNfc: String?,
|
|
|
|
|
- val remark: String,
|
|
|
|
|
- val deptId: Int,
|
|
|
|
|
- val deptName: String?,
|
|
|
|
|
- val postIds: List<Int>,
|
|
|
|
|
- val email: String?,
|
|
|
|
|
- val mobile: String?,
|
|
|
|
|
- val sex: Int,
|
|
|
|
|
- val avatar: String,
|
|
|
|
|
- val status: Int,
|
|
|
|
|
- val loginIp: String,
|
|
|
|
|
- val loginDate: Long,
|
|
|
|
|
- val createTime: Long,
|
|
|
|
|
- val workstationIds: List<Int>?,
|
|
|
|
|
- val type: String?,
|
|
|
|
|
|
|
+ val id: Int = 0,
|
|
|
|
|
+ val userId: Int? = null,
|
|
|
|
|
+ val username: String = "",
|
|
|
|
|
+ val nickname: String = "",
|
|
|
|
|
+ val cardNfc: String? = null,
|
|
|
|
|
+ val remark: String = "",
|
|
|
|
|
+ val deptId: Int = 0,
|
|
|
|
|
+ val deptName: String? = null,
|
|
|
|
|
+ val postIds: List<Int> = listOf(),
|
|
|
|
|
+ val email: String? = null,
|
|
|
|
|
+ val mobile: String? = null,
|
|
|
|
|
+ val sex: Int = 0,
|
|
|
|
|
+ val avatar: String = "",
|
|
|
|
|
+ val status: Int = 0,
|
|
|
|
|
+ val loginIp: String = "",
|
|
|
|
|
+ val loginDate: Long = 0L,
|
|
|
|
|
+ val createTime: Long = 0L,
|
|
|
|
|
+ val workstationIds: List<Int>? = null,
|
|
|
|
|
+ val type: String? = "",
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -140,7 +149,7 @@ data class Node(
|
|
|
*/
|
|
*/
|
|
|
fun checkCanSubmit(forms: List<FormField>): String {
|
|
fun checkCanSubmit(forms: List<FormField>): String {
|
|
|
forms.forEach {
|
|
forms.forEach {
|
|
|
- Log.d("xiaoming","检查表单:$it")
|
|
|
|
|
|
|
+ Log.d("NodeOption", "checkCanSubmit -> $it")
|
|
|
if (it.required) {
|
|
if (it.required) {
|
|
|
if ((it.value.getOrNull(0) ?: "").isEmpty()) {
|
|
if ((it.value.getOrNull(0) ?: "").isEmpty()) {
|
|
|
return (it.placeholder.getOrNull(0) ?: "").ifEmpty { "请填写${it.label}" }
|
|
return (it.placeholder.getOrNull(0) ?: "").ifEmpty { "请填写${it.label}" }
|
|
@@ -202,9 +211,17 @@ data class Node(
|
|
|
fun updateNodeInfo(forms: List<FormField>): Node {
|
|
fun updateNodeInfo(forms: List<FormField>): Node {
|
|
|
val nodeName = forms.find { it.name == "nodeName" }?.value?.getOrNull(0) ?: ""
|
|
val nodeName = forms.find { it.name == "nodeName" }?.value?.getOrNull(0) ?: ""
|
|
|
if (type != "createJob") {
|
|
if (type != "createJob") {
|
|
|
|
|
+ // 解析负责人
|
|
|
val workerUserId = forms.find { it.name == "workerUserId" }?.value?.getOrNull(0) ?: "0"
|
|
val workerUserId = forms.find { it.name == "workerUserId" }?.value?.getOrNull(0) ?: "0"
|
|
|
|
|
+ // 解析关联表单
|
|
|
val formId = forms.find { it.name == "formId" }?.value?.getOrNull(0) ?: "0"
|
|
val formId = forms.find { it.name == "formId" }?.value?.getOrNull(0) ?: "0"
|
|
|
|
|
+ // 解析表单数据
|
|
|
val formData = forms.find { it.name == "formData" }?.value?.getOrNull(0) ?: ""
|
|
val formData = forms.find { it.name == "formData" }?.value?.getOrNull(0) ?: ""
|
|
|
|
|
+ // 解析隔离方式
|
|
|
|
|
+ val isolationType = forms.find { it.name == "isolationType" }?.value?.getOrNull(0)
|
|
|
|
|
+ // 解析节点
|
|
|
|
|
+ val isolationPoints = forms.find { it.name == "isolationPoints" }?.value ?: emptyList()
|
|
|
|
|
+
|
|
|
return Node(
|
|
return Node(
|
|
|
id = id,
|
|
id = id,
|
|
|
workId = workId,
|
|
workId = workId,
|
|
@@ -216,7 +233,13 @@ data class Node(
|
|
|
position = position,
|
|
position = position,
|
|
|
workerUserId = workerUserId.toInt(),
|
|
workerUserId = workerUserId.toInt(),
|
|
|
formId = formId.toInt(),
|
|
formId = formId.toInt(),
|
|
|
- formData = formData
|
|
|
|
|
|
|
+ formData = formData,
|
|
|
|
|
+ isolationType = isolationType,
|
|
|
|
|
+ isolationPoints = isolationPoints.joinToString(
|
|
|
|
|
+ prefix = "[",
|
|
|
|
|
+ postfix = "]",
|
|
|
|
|
+ separator = ","
|
|
|
|
|
+ )
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
return Node(
|
|
return Node(
|
|
@@ -251,7 +274,13 @@ data class Node(
|
|
|
isolationList: List<IsolationPoint>,
|
|
isolationList: List<IsolationPoint>,
|
|
|
isLocker: Boolean = false,
|
|
isLocker: Boolean = false,
|
|
|
): List<FormField> {
|
|
): List<FormField> {
|
|
|
|
|
+ Log.d("NodeOption", "buildFormList -> $this")
|
|
|
val list = ArrayList<FormField>()
|
|
val list = ArrayList<FormField>()
|
|
|
|
|
+ val gson = Gson()
|
|
|
|
|
+ // 暂不解析,等后端确认后再解析
|
|
|
|
|
+ // val dataMap: MutableMap<String, Any?> = gson.fromJson(data.ifEmpty { "{}" }, object : TypeToken<MutableMap<String, Any?>>() {}.type)
|
|
|
|
|
+ // 携带数据
|
|
|
|
|
+ // Log.d("NodeOption", "dataMap -> ${gson.toJson(dataMap)}")
|
|
|
// 添加节点名称
|
|
// 添加节点名称
|
|
|
list += FormField(
|
|
list += FormField(
|
|
|
id.toString(),
|
|
id.toString(),
|
|
@@ -282,7 +311,7 @@ data class Node(
|
|
|
name = "formId",
|
|
name = "formId",
|
|
|
true,
|
|
true,
|
|
|
placeholder = listOf("请选择业务表单"),
|
|
placeholder = listOf("请选择业务表单"),
|
|
|
- options = workFormList.map { FormOption(it.name, it.id.toString()) },
|
|
|
|
|
|
|
+ options = workFormList.map { FormOption(it.name?:"", it.id.toString()) },
|
|
|
value = if (formId > 0) listOf(formId.toString()) else listOf()
|
|
value = if (formId > 0) listOf(formId.toString()) else listOf()
|
|
|
)
|
|
)
|
|
|
// 隔离配置
|
|
// 隔离配置
|
|
@@ -293,6 +322,12 @@ data class Node(
|
|
|
val formField = list.find { it.name == "formId" }?.copy(required = false)
|
|
val formField = list.find { it.name == "formId" }?.copy(required = false)
|
|
|
list.removeIf { it.name == "formId" }
|
|
list.removeIf { it.name == "formId" }
|
|
|
formField?.let { list.add(it) }
|
|
formField?.let { list.add(it) }
|
|
|
|
|
+ // 抽取隔离方式value值
|
|
|
|
|
+ val valueOfIsolationType = if (isolationType.isNullOrEmpty()) {
|
|
|
|
|
+ listOf()
|
|
|
|
|
+// val type = dataMap["isolationMethod"]
|
|
|
|
|
+// if (type == null) listOf() else listOf("$type")
|
|
|
|
|
+ } else listOf(isolationType)
|
|
|
// 隔离方式
|
|
// 隔离方式
|
|
|
list += FormField(
|
|
list += FormField(
|
|
|
id.toString(),
|
|
id.toString(),
|
|
@@ -302,9 +337,25 @@ data class Node(
|
|
|
true,
|
|
true,
|
|
|
placeholder = listOf("请选择隔离方式"),
|
|
placeholder = listOf("请选择隔离方式"),
|
|
|
options = isolationMethodList.map { FormOption(it.label, it.value) },
|
|
options = isolationMethodList.map { FormOption(it.label, it.value) },
|
|
|
- value = if (isolationType.isNullOrEmpty()) listOf() else listOf(isolationType)
|
|
|
|
|
|
|
+ value = valueOfIsolationType
|
|
|
)
|
|
)
|
|
|
|
|
+ // 抽取隔离点位value值
|
|
|
val points = if (isolationPoints.isNullOrEmpty()) "" else isolationPoints.replace("[", "").replace("]", "")
|
|
val points = if (isolationPoints.isNullOrEmpty()) "" else isolationPoints.replace("[", "").replace("]", "")
|
|
|
|
|
+ val valueOfIsolationPoints = if (points.isNotEmpty()) {
|
|
|
|
|
+ points.split(",")
|
|
|
|
|
+ } else {
|
|
|
|
|
+ listOf()
|
|
|
|
|
+// when (val value = dataMap["isolationPoints"]) {
|
|
|
|
|
+// // 如果是数组
|
|
|
|
|
+// is List<*> -> value.map { "$it".toFloat().toInt().toString() }
|
|
|
|
|
+// // 如果是String
|
|
|
|
|
+// is String -> {
|
|
|
|
|
+// value.replace("[", "").replace("]", "").split(",")
|
|
|
|
|
+// }
|
|
|
|
|
+// // 其他不处理
|
|
|
|
|
+// else -> listOf()
|
|
|
|
|
+// }
|
|
|
|
|
+ }
|
|
|
// 隔离点选择,可多选
|
|
// 隔离点选择,可多选
|
|
|
list += FormField(
|
|
list += FormField(
|
|
|
id.toString(),
|
|
id.toString(),
|
|
@@ -315,7 +366,7 @@ data class Node(
|
|
|
listOf("请选择隔离点"),
|
|
listOf("请选择隔离点"),
|
|
|
multiSelect = true,
|
|
multiSelect = true,
|
|
|
options = isolationList.map { FormOption(it.pointName, it.id.toString()) },
|
|
options = isolationList.map { FormOption(it.pointName, it.id.toString()) },
|
|
|
- value = if (points.isNotEmpty()) points.split(",") else listOf()
|
|
|
|
|
|
|
+ value = valueOfIsolationPoints
|
|
|
)
|
|
)
|
|
|
if (isLocker) {
|
|
if (isLocker) {
|
|
|
val locker = nodeUserList?.find { it.type == "jtlocker" }
|
|
val locker = nodeUserList?.find { it.type == "jtlocker" }
|
|
@@ -396,12 +447,12 @@ data class Node(
|
|
|
@Serializable
|
|
@Serializable
|
|
|
data class TaskFormInfo(
|
|
data class TaskFormInfo(
|
|
|
val id: Int = 0,
|
|
val id: Int = 0,
|
|
|
- val name: String = "",
|
|
|
|
|
- val conf: String = "",
|
|
|
|
|
- val fields: List<String> = emptyList(),
|
|
|
|
|
- val status: Int = -1,
|
|
|
|
|
- val remark: String = "",
|
|
|
|
|
- val createTime: Long = 0L
|
|
|
|
|
|
|
+ val name: String? = null,
|
|
|
|
|
+ val conf: String? = null,
|
|
|
|
|
+ val fields: List<String>? = null,
|
|
|
|
|
+ val status: Int? = null,
|
|
|
|
|
+ val remark: String? = null,
|
|
|
|
|
+ val createTime: Long? = null
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -489,7 +540,8 @@ data class Task(
|
|
|
val completionTime: Long?,
|
|
val completionTime: Long?,
|
|
|
val cancellationTime: Long?,
|
|
val cancellationTime: Long?,
|
|
|
val cancellationReason: String?,
|
|
val cancellationReason: String?,
|
|
|
- val workerUserName: String?,
|
|
|
|
|
|
|
+ val initiatorName: String?, // 发起人
|
|
|
|
|
+ val workerUserName: String?, // 当前执行人
|
|
|
val workTime: Long?,
|
|
val workTime: Long?,
|
|
|
val currentNodeId: String?,
|
|
val currentNodeId: String?,
|
|
|
val currentNodeName: String?,
|
|
val currentNodeName: String?,
|