Browse Source

2024-08-27 修改

修改:
1. 公务出访 - 详情 完善权限判断(编辑) 完善复核确认相关逻辑
zhaiy 7 months ago
parent
commit
01d73921dd

+ 1 - 0
app/src/main/java/com/pan_american/android/data/model/group_invite_official/official_visits/entity/OfficialVisitDetail.kt

@@ -7,6 +7,7 @@ open class OfficialVisitDetail {
     var diId = 0
     var type = 0
     var client = ""
+    var confirmTheInvitation = 0
     var date = ""
     var time = ""
     var address = ""

+ 3 - 0
app/src/main/java/com/pan_american/android/data/model/group_invite_official/official_visits/network/UpdateOfficialVisitCheckCommitRequest.kt

@@ -0,0 +1,3 @@
+package com.pan_american.android.data.model.group_invite_official.official_visits.network
+
+class UpdateOfficialVisitCheckCommitRequest(val id: Int, val type: Int)

+ 7 - 0
app/src/main/java/com/pan_american/android/data/network/APIService.kt

@@ -122,6 +122,7 @@ import com.pan_american.android.data.model.group_invite_official.official_visits
 import com.pan_american.android.data.model.group_invite_official.official_visits.network.OfficialVisitListResponse
 import com.pan_american.android.data.model.group_invite_official.official_visits.network.ProvinceAndCityDownloadFileRequest
 import com.pan_american.android.data.model.group_invite_official.official_visits.network.ProvinceAndCityDownloadFileResponse
+import com.pan_american.android.data.model.group_invite_official.official_visits.network.UpdateOfficialVisitCheckCommitRequest
 import com.pan_american.android.data.model.group_invite_official.official_visits.network.UpdateOfficialVisitRequest
 import com.pan_american.android.data.model.group_invite_official.official_visits.network.UpdateOfficialVisitResponse
 import com.pan_american.android.data.model.group_management.group_info.network.GetSellCodeResponse
@@ -1011,4 +1012,10 @@ interface APIService {
      */
     @POST("api/Resource/QueryOfficialActivitiesById")
     fun getOfficialVisitDetailById(@Body getOfficialVisitDetailRequest: GetOfficialVisitDetailRequest): Call<GetOfficialVisitDetailResponse>
+
+    /**
+     * 公务出访,复核确认/取消确认
+     */
+    @POST("api/Resource/OfficialActivitiesInviteOperation")
+    fun updateOfficialVisitCheckCommit(@Body updateOfficialVisitCheckCommitRequest: UpdateOfficialVisitCheckCommitRequest):Call<BaseResponse>
 }

+ 91 - 1
app/src/main/java/com/pan_american/android/ui/group_invite_official/official_visits/AddOfficialVisitsActivity.kt

@@ -43,6 +43,7 @@ import com.pan_american.android.data.model.group_invite_official.official_visits
 import com.pan_american.android.data.model.group_invite_official.official_visits.network.DeleteOfficialVisitPic
 import com.pan_american.android.data.model.group_invite_official.official_visits.network.GetOfficialVisitDetailRequest
 import com.pan_american.android.data.model.group_invite_official.official_visits.network.GetOfficialVisitDetailResponse
+import com.pan_american.android.data.model.group_invite_official.official_visits.network.UpdateOfficialVisitCheckCommitRequest
 import com.pan_american.android.data.model.group_invite_official.official_visits.network.UpdateOfficialVisitRequest
 import com.pan_american.android.data.model.group_invite_official.official_visits.network.UpdateOfficialVisitResponse
 import com.pan_american.android.data.network.APIService
@@ -86,6 +87,8 @@ class AddOfficialVisitsActivity : BaseActivity<ActivityAddOfficialVisitsBinding>
 
     private var officialTypeId = 0
 
+    private var checkCommitType = 0
+
     private val updateOfficialVisitRequest = UpdateOfficialVisitRequest()
 
     //监听相册事件回调
@@ -152,9 +155,51 @@ class AddOfficialVisitsActivity : BaseActivity<ActivityAddOfficialVisitsBinding>
     override fun initViews() {
         if (fromList) {
             getOfficialVisitsDetail()
+
+            if (!OASystem.authorization(OASystem.OFFICIAL_VISITS, OASystem.EDIT)) {
+                binding.apply {
+                    country.isEnabled = false
+                    area.isEnabled = false
+                    officialDepartment.isEnabled(false)
+                    officialDate.isEnabled = false
+                    officialTime.isEnabled = false
+                    invitor.isEnabled = false
+                    officialContactJob.isEnabled(false)
+                    officialContact.isEnabled = false
+                    phone.isEnabled = false
+                    officialType.isEnabled = false
+                    dressDemand.isEnabled = false
+                    industry.isEnabled = false
+                    needTranslatorYes.isEnabled = false
+                    needTranslatorNo.isEnabled = false
+                    translator.isEnabled = false
+                    translateLanguage.isEnabled = false
+                    isPayYes.isEnabled = false
+                    isPayNo.isEnabled = false
+                    isApprovalYes.isEnabled = false
+                    isApprovalNo.isEnabled = false
+                    officialLocation.isEnabled(false)
+                    officialBackground.isEnabled(false)
+                    officialRequestExample.isEnabled(false)
+                    provisionalAgenda.isEnabled(false)
+                    participationMember.isEnabled(false)
+                    addEmailScreenshot.visibility = View.GONE
+                    commit.setText(resources.getString(R.string.back))
+                }
+            }
+        }
+
+        when(checkCommitType) {
+            0 -> {
+                binding.checkCommit.setText(resources.getString(R.string.check_commit))
+            }
+
+            1 -> {
+                binding.checkCommit.setText(resources.getString(R.string.check_cancel))
+            }
         }
 
-        binding.checkCommit.setText(resources.getString(R.string.check_commit))
+
         binding.commit.setText(resources.getString(R.string.save))
 
         if (OASystem.authorization(OASystem.OFFICIAL_VISITS, OASystem.PROCESS)) {
@@ -264,6 +309,12 @@ class AddOfficialVisitsActivity : BaseActivity<ActivityAddOfficialVisitsBinding>
         }
 
         binding.commit.setOnClickListener {
+
+            if (!OASystem.authorization(OASystem.OFFICIAL_VISITS, OASystem.EDIT)) {
+                back()
+                return@setOnClickListener
+            }
+
             binding.country.text.apply {
                 if (isNotBlank()) {
                     updateOfficialVisitRequest.country = this.toString()
@@ -470,6 +521,10 @@ class AddOfficialVisitsActivity : BaseActivity<ActivityAddOfficialVisitsBinding>
 
             updateOfficialVisitData()
         }
+
+        binding.checkCommit.setOnClickListener {
+            updateOfficialVisitCheckStatus()
+        }
     }
 
     override fun onRequestPermissionsResult(
@@ -545,6 +600,7 @@ class AddOfficialVisitsActivity : BaseActivity<ActivityAddOfficialVisitsBinding>
                             binding.country.setText(country)
                             binding.area.setText(area)
                             binding.officialDepartment.setText(client)
+                            checkCommitType = confirmTheInvitation
                             binding.officialDate.text = date
                             binding.officialTime.text = time
 
@@ -954,6 +1010,40 @@ class AddOfficialVisitsActivity : BaseActivity<ActivityAddOfficialVisitsBinding>
         })
     }
 
+    private fun updateOfficialVisitCheckStatus() {
+        apiService.updateOfficialVisitCheckCommit(UpdateOfficialVisitCheckCommitRequest(officialVisitId, checkCommitType)).enqueue(object : Callback<BaseResponse> {
+            override fun onResponse(call: Call<BaseResponse>, response: Response<BaseResponse>) {
+
+                val updateResponse = response.body()
+
+                if (updateResponse != null) {
+                    if (updateResponse.code == 200) {
+                        showMessage(resources.getString(R.string.confirm_success))
+
+                        when(checkCommitType) {
+                            0 -> {
+                                checkCommitType = 1
+                                binding.checkCommit.setText(resources.getString(R.string.check_cancel))
+                            }
+
+                            1 -> {
+                                checkCommitType = 0
+                                binding.checkCommit.setText(resources.getString(R.string.check_commit))
+                            }
+                        }
+
+                    } else {
+                        showMessage(updateResponse.msg)
+                    }
+                }
+            }
+
+            override fun onFailure(p0: Call<BaseResponse>, p1: Throwable) {
+                showErrorInfo(R.string.interface_request_error)
+            }
+        })
+    }
+
     private fun uploadPic() {
 
         if (fromList) {

+ 0 - 1
app/src/main/java/com/pan_american/android/ui/group_management/group_info/GroupCustomerListFragment.kt

@@ -178,7 +178,6 @@ class GroupCustomerListFragment : BaseFragment<FragmentGroupCustomerListBinding>
                     }
                 }
 
-
                 itemView.findViewById<TextView>(R.id.customer_unit).apply {
                     text = data.companyFullName.ifBlank {
                         resources.getString(R.string.no_info)

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -1055,6 +1055,8 @@
     <string name="email_screenshot">邮件截图</string>
 
     <string name="check_commit">复核确认</string>
+    <string name="check_cancel">取消确认</string>
+    <string name="confirm_success">确认成功</string>
 
     <string name="gallery_permission_hint">请在设置中打开文件访问权限</string>