优化案件模块

This commit is contained in:
27942
2026-01-21 15:24:16 +08:00
parent ba97073ca0
commit 40476b9a8e

View File

@@ -1734,6 +1734,15 @@ class caseManagementDetail(APIView):
if not closing_application_list:
closing_application_list = ""
# 将 AgencyContract 和 Closingapplication 字段的空数组转换为空字符串
agency_contract_str = info.AgencyContract or ""
if agency_contract_str.strip() in ["[]", ""]:
agency_contract_str = ""
closing_application_str = info.Closingapplication or ""
if closing_application_str.strip() in ["[]", ""]:
closing_application_str = ""
# 从财务数据动态获取开票金额和收入确认金额
invoice_status_value = "0"
paymentcollection_value = "0"
@@ -1768,10 +1777,10 @@ class caseManagementDetail(APIView):
"responsiblefor": responsiblefor_dict, # 负责人信息(字典格式)
"charge": charge, # 收费情况
'times': info.times, # 立案时间
"AgencyContract": info.AgencyContract or "", # 代理合同JSON字符串没有文件时返回空字符串
"AgencyContract": agency_contract_str, # 代理合同JSON字符串没有文件时返回空字符串
"AgencyContractUrls": agency_contract_list if agency_contract_list else "", # 代理合同URL列表没有文件时返回空字符串
"Contractreturn": info.Contractreturn, # 合同返还
"Closingapplication": info.Closingapplication or "", # 结案申请JSON字符串没有文件时返回空字符串
"Closingapplication": closing_application_str, # 结案申请JSON字符串没有文件时返回空字符串
"ClosingapplicationUrls": closing_application_list if closing_application_list else "", # 结案申请URL列表没有文件时返回空字符串
"ChangeRequest": info.ChangeRequest, # 变更申请(兼容旧字段)
"ChangeItem": info.ChangeItem,
@@ -4838,6 +4847,21 @@ class CaseListByTag(APIView):
except (json.JSONDecodeError, TypeError):
closing_application_list = []
# 如果没有文件,返回空字符串而不是空数组
if not agency_contract_list:
agency_contract_list = ""
if not closing_application_list:
closing_application_list = ""
# 将 AgencyContract 和 Closingapplication 字段的空数组转换为空字符串
agency_contract_str = info.AgencyContract or ""
if agency_contract_str.strip() in ["[]", ""]:
agency_contract_str = ""
closing_application_str = info.Closingapplication or ""
if closing_application_str.strip() in ["[]", ""]:
closing_application_str = ""
# 处理已开票/已收款字段
invoice_status_value = normalize_amount_value(info.invoice_status)
paymentcollection_value = normalize_amount_value(info.paymentcollection)
@@ -4862,11 +4886,11 @@ class CaseListByTag(APIView):
"responsiblefor": responsiblefor_dict,
"charge": charge,
'times': info.times,
"AgencyContract": info.AgencyContract or "[]",
"AgencyContractUrls": agency_contract_list,
"AgencyContract": agency_contract_str, # 代理合同JSON字符串没有文件时返回空字符串
"AgencyContractUrls": agency_contract_list if agency_contract_list else "", # 代理合同URL列表没有文件时返回空字符串
"Contractreturn": info.Contractreturn,
"Closingapplication": info.Closingapplication or "[]",
"ClosingapplicationUrls": closing_application_list,
"Closingapplication": closing_application_str, # 结案申请JSON字符串没有文件时返回空字符串
"ClosingapplicationUrls": closing_application_list if closing_application_list else "", # 结案申请URL列表没有文件时返回空字符串
"ChangeRequest": info.ChangeRequest,
"ChangeItem": info.ChangeItem,
"ChangeReason": info.ChangeReason,