Quellcode durchsuchen

2025-10-24 修改

修改:
1. 签证模块 - 签证流程 BUG 修改
zhaiy vor 3 Tagen
Ursprung
Commit
8348a9c20a

+ 1 - 1
.idea/deploymentTargetSelector.xml

@@ -4,7 +4,7 @@
     <selectionStates>
       <SelectionState runConfigName="app">
         <option name="selectionMode" value="DROPDOWN" />
-        <DropdownSelection timestamp="2025-10-23T01:57:26.865826500Z">
+        <DropdownSelection timestamp="2025-10-24T01:37:41.419188900Z">
           <Target type="DEFAULT_BOOT">
             <handle>
               <DeviceId pluginId="PhysicalDevice" identifier="serial=3bb3c424" />

+ 76 - 37
app/src/main/java/com/pan_american/android/ui/group_visa/visa_process/VisaProcessDetailActivity.kt

@@ -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,

+ 6 - 5
app/src/main/res/layout/activity_visa_process_detail.xml

@@ -489,9 +489,9 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_margin="@dimen/dp_10"
-            android:visibility="gone"
             android:background="@drawable/shape_corner_background_color"
-            android:orientation="vertical">
+            android:orientation="vertical"
+            android:visibility="gone">
 
             <LinearLayout
                 android:layout_width="match_parent"
@@ -500,11 +500,10 @@
                 android:orientation="horizontal">
 
                 <TextView
-                    android:layout_width="0dp"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_gravity="center"
                     android:layout_margin="@dimen/dp_5"
-                    android:layout_weight="1"
                     android:padding="@dimen/dp_5"
                     android:text="@string/date_select"
                     android:textSize="@dimen/text_size_16_sp"
@@ -512,10 +511,12 @@
 
                 <TextView
                     android:id="@+id/step_7_date"
-                    android:layout_width="wrap_content"
+                    android:layout_width="0dp"
                     android:layout_height="wrap_content"
                     android:layout_gravity="center"
                     android:layout_margin="@dimen/dp_5"
+                    android:layout_weight="1"
+                    android:gravity="end"
                     android:padding="@dimen/dp_5"
                     android:text="@string/please_select"
                     android:textSize="@dimen/text_size_14_sp" />