|
|
@@ -15,6 +15,7 @@ import androidx.activity.result.contract.ActivityResultContracts
|
|
|
import androidx.core.app.ActivityCompat
|
|
|
import androidx.core.content.ContextCompat
|
|
|
import androidx.core.net.toUri
|
|
|
+import com.google.gson.Gson
|
|
|
import com.pan_american.android.OASystem
|
|
|
import com.pan_american.android.OASystem.Companion.REQUEST_READ_EXTERNAL_STORAGE
|
|
|
import com.pan_american.android.R
|
|
|
@@ -163,18 +164,34 @@ class VisaProcessDetailActivity : BaseActivity<ActivityVisaProcessDetailBinding>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- (step7.typedValue as? Step7Type)?.let { it ->
|
|
|
+ val step7Value = step7.typedValue
|
|
|
+ val step7Type = when {
|
|
|
+ step7Value is Step7Type -> step7Value
|
|
|
+ else -> {
|
|
|
+ try {
|
|
|
+ // 将 LinkedTreeMap 转换为 Step7Type
|
|
|
+ val jsonString = Gson().toJson(step7Value)
|
|
|
+ Gson().fromJson(jsonString, Step7Type::class.java)
|
|
|
+ } catch (e: Exception) {
|
|
|
+ Log.e("DEBUG", "转换 Step7Type 失败: ${e.message}")
|
|
|
+ Step7Type(false, "")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- step7isSelected = it.isSelected
|
|
|
- step7Date = it.projectedDate
|
|
|
+ step7isSelected = step7Type.isSelected
|
|
|
+ step7Date = step7Type.projectedDate
|
|
|
|
|
|
- if (it.isSelected) {
|
|
|
- binding.step7Yes.isChecked = true
|
|
|
- binding.step7Download.visibility = View.VISIBLE
|
|
|
- } else {
|
|
|
- binding.step7No.isChecked = true
|
|
|
- binding.step7Download.visibility = View.GONE
|
|
|
+ if (step7Type.isSelected) {
|
|
|
+ binding.step7Yes.isChecked = true
|
|
|
+ binding.step7Download.visibility = View.VISIBLE
|
|
|
+ if (step7Type.projectedDate.isNotBlank()) {
|
|
|
+ binding.step7Date.text = step7Type.projectedDate.trim()
|
|
|
}
|
|
|
+
|
|
|
+ } else {
|
|
|
+ binding.step7No.isChecked = true
|
|
|
+ binding.step7Download.visibility = View.GONE
|
|
|
}
|
|
|
|
|
|
binding.step5FinishSwitch.isChecked = step5.isCompleted
|
|
|
@@ -300,21 +317,24 @@ class VisaProcessDetailActivity : BaseActivity<ActivityVisaProcessDetailBinding>
|
|
|
}
|
|
|
|
|
|
binding.step6RadioGroup.setOnCheckedChangeListener { radioGroup, i ->
|
|
|
- when (i) {
|
|
|
- binding.step6Yes.id -> {
|
|
|
- updateVisaProcessStep(
|
|
|
- stepContents = arrayOf(true.toString()),
|
|
|
- stepId = processDetail.step6.id
|
|
|
- )
|
|
|
- binding.step6AnnexView.visibility = View.VISIBLE
|
|
|
- }
|
|
|
|
|
|
- binding.step6No.id -> {
|
|
|
- updateVisaProcessStep(
|
|
|
- stepContents = arrayOf(false.toString()),
|
|
|
- stepId = processDetail.step6.id
|
|
|
- )
|
|
|
- binding.step6AnnexView.visibility = View.GONE
|
|
|
+ if (radioGroup.id == binding.step6RadioGroup.id) {
|
|
|
+ when (i) {
|
|
|
+ binding.step6Yes.id -> {
|
|
|
+ updateVisaProcessStep(
|
|
|
+ stepContents = arrayOf(true.toString()),
|
|
|
+ stepId = processDetail.step6.id
|
|
|
+ )
|
|
|
+ binding.step6AnnexView.visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+
|
|
|
+ binding.step6No.id -> {
|
|
|
+ updateVisaProcessStep(
|
|
|
+ stepContents = arrayOf(false.toString()),
|
|
|
+ stepId = processDetail.step6.id
|
|
|
+ )
|
|
|
+ binding.step6AnnexView.visibility = View.GONE
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -346,21 +366,30 @@ class VisaProcessDetailActivity : BaseActivity<ActivityVisaProcessDetailBinding>
|
|
|
}
|
|
|
|
|
|
binding.step7RadioGroup.setOnCheckedChangeListener { radioGroup, i ->
|
|
|
- when (i) {
|
|
|
- binding.step6Yes.id -> {
|
|
|
- updateVisaProcessStep(
|
|
|
- stepContents = arrayOf(true.toString(), step7Date),
|
|
|
- stepId = processDetail.step6.id
|
|
|
- )
|
|
|
- binding.step7Download.visibility = View.VISIBLE
|
|
|
- }
|
|
|
|
|
|
- binding.step6No.id -> {
|
|
|
- updateVisaProcessStep(
|
|
|
- stepContents = arrayOf(false.toString(), step7Date),
|
|
|
- stepId = processDetail.step6.id
|
|
|
- )
|
|
|
- binding.step7Download.visibility = View.GONE
|
|
|
+ if (radioGroup.id == binding.step7RadioGroup.id) {
|
|
|
+ when (i) {
|
|
|
+ binding.step7Yes.id -> {
|
|
|
+
|
|
|
+ step7isSelected = true
|
|
|
+
|
|
|
+ updateVisaProcessStep(
|
|
|
+ stepContents = arrayOf(true.toString(), step7Date),
|
|
|
+ stepId = processDetail.step7.id
|
|
|
+ )
|
|
|
+ binding.step7Download.visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+
|
|
|
+ binding.step7No.id -> {
|
|
|
+
|
|
|
+ step7isSelected = false
|
|
|
+
|
|
|
+ updateVisaProcessStep(
|
|
|
+ stepContents = arrayOf(false.toString(), step7Date),
|
|
|
+ stepId = processDetail.step7.id
|
|
|
+ )
|
|
|
+ binding.step7Download.visibility = View.GONE
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -396,6 +425,16 @@ class VisaProcessDetailActivity : BaseActivity<ActivityVisaProcessDetailBinding>
|
|
|
}
|
|
|
|
|
|
private fun updateVisaProcessStep(stepContents: Array<String>, stepId: Int) {
|
|
|
+
|
|
|
+ Log.e(
|
|
|
+ "upload", Gson().toJson(
|
|
|
+ VisaProcessUpdateStepRequest(
|
|
|
+ stepContents = stepContents,
|
|
|
+ stepId = stepId
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+
|
|
|
OASystem.apiService.updateVisaProcessStep(
|
|
|
VisaProcessUpdateStepRequest(
|
|
|
stepContents = stepContents,
|