优化案件模块

This commit is contained in:
27942
2026-01-14 15:53:41 +08:00
parent 53bdb8221d
commit b4b5a2adf0
3 changed files with 59 additions and 44 deletions

View File

@@ -19,7 +19,7 @@ class ProjectRegistration(models.Model):
client_info = models.TextField(null=True, blank=True) # 委托人身份信息(临时允许为空,用于数据迁移)
party_info = models.TextField(null=True, blank=True) # 相对方身份信息(临时允许为空,用于数据迁移)
description = models.TextField(null=True, blank=True) # 项目简述(临时允许为空,用于数据迁移)
responsiblefor = models.TextField() # 负责人信息JSON格式字典{"负责人":"","主办律师":"","助理律师":"","收益分配":""},负责人必填,其余选填)
responsiblefor = models.TextField() # 负责人信息JSON格式字典{"responsible_person":"","main_lawyer":"","assistant_lawyer":"","case_manager_lawyer":"","profit_distribution":""}responsible_person必填,其余选填)
charge = models.CharField(max_length=100) # 收费情况
contract = models.TextField() # 上传合同
state = models.CharField(max_length=100) # 状态

View File

@@ -223,7 +223,7 @@ class Project(APIView):
responsiblefor_dict = responsiblefor
# 验证负责人字段必填
if not responsiblefor_dict.get('负责人'):
if not responsiblefor_dict.get('responsible_person'):
return Response({'status': 'error', 'message': '负责人字段不能为空', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
# 将字典转换为JSON字符串存储
@@ -269,7 +269,7 @@ class Project(APIView):
# 获取负责人的团队信息(从字典中获取负责人字段)
team_name = None
try:
responsible_person = responsiblefor_dict.get('负责人')
responsible_person = responsiblefor_dict.get('responsible_person')
if responsible_person:
responsible_user = User.objects.get(username=responsible_person, is_deleted=False)
team_name = responsible_user.team
@@ -280,18 +280,20 @@ class Project(APIView):
from User.utils import create_approval_with_team_logic
# 构建负责人信息描述
responsible_desc = responsiblefor_dict.get('负责人', '')
if responsiblefor_dict.get('主办律师'):
responsible_desc += f",主办律师:{responsiblefor_dict.get('主办律师')}"
if responsiblefor_dict.get('助理律师'):
responsible_desc += f",助理律师:{responsiblefor_dict.get('助理律师')}"
responsible_desc = responsiblefor_dict.get('responsible_person', '')
if responsiblefor_dict.get('main_lawyer'):
responsible_desc += f",主办律师:{responsiblefor_dict.get('main_lawyer')}"
if responsiblefor_dict.get('assistant_lawyer'):
responsible_desc += f",助理律师:{responsiblefor_dict.get('assistant_lawyer')}"
if responsiblefor_dict.get('case_manager_lawyer'):
responsible_desc += f",案管律师:{responsiblefor_dict.get('case_manager_lawyer')}"
content = f"{responsiblefor_dict.get('负责人')}{times}办理立项登记,项目类型:{type},合同编号:{ContractNo}{responsible_desc},收费情况:{charge}"
content = f"{responsiblefor_dict.get('responsible_person')}{times}办理立项登记,项目类型:{type},合同编号:{ContractNo}{responsible_desc},收费情况:{charge}"
approval, approvers_order_json, needs_approval = create_approval_with_team_logic(
team_name=team_name,
approvers=approvers,
title=responsiblefor_dict.get('负责人', '') + "立项登记",
title=responsiblefor_dict.get('responsible_person', '') + "立项登记",
content=content,
approval_type="立项登记",
user_id=pro.id,
@@ -324,7 +326,7 @@ class Project(APIView):
target_id=pro.id,
target_name=pro.ContractNo,
new_data=new_data,
remark=f'新增立项登记:合同编号 {pro.ContractNo},负责人 {responsiblefor_dict.get("负责人", "")}'
remark=f'新增立项登记:合同编号 {pro.ContractNo},负责人 {responsiblefor_dict.get("responsible_person", "")}'
)
return Response({'message': '登记成功', 'code': 0}, status=status.HTTP_200_OK)
@@ -506,7 +508,7 @@ class EditProject(APIView):
responsiblefor_dict = responsiblefor
# 验证负责人字段必填
if not responsiblefor_dict.get('负责人'):
if not responsiblefor_dict.get('responsible_person'):
return Response({'status': 'error', 'message': '负责人字段不能为空', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
# 将字典转换为JSON字符串存储
@@ -568,15 +570,17 @@ class EditProject(APIView):
# 获取负责人名称用于审批记录
if responsiblefor:
current_responsiblefor = responsiblefor_dict.get('负责人', '')
current_responsiblefor = responsiblefor_dict.get('responsible_person', '')
# 构建负责人信息描述
responsible_desc = current_responsiblefor
if responsiblefor_dict.get('主办律师'):
responsible_desc += f",主办律师:{responsiblefor_dict.get('主办律师')}"
if responsiblefor_dict.get('助理律师'):
responsible_desc += f",助理律师:{responsiblefor_dict.get('助理律师')}"
if responsiblefor_dict.get('main_lawyer'):
responsible_desc += f",主办律师:{responsiblefor_dict.get('main_lawyer')}"
if responsiblefor_dict.get('assistant_lawyer'):
responsible_desc += f",助理律师:{responsiblefor_dict.get('assistant_lawyer')}"
if responsiblefor_dict.get('case_manager_lawyer'):
responsible_desc += f",案管律师:{responsiblefor_dict.get('case_manager_lawyer')}"
else:
current_responsiblefor = original_responsiblefor.get('负责人', '') if isinstance(original_responsiblefor, dict) else ''
current_responsiblefor = original_responsiblefor.get('responsible_person', '') if isinstance(original_responsiblefor, dict) else ''
responsible_desc = current_responsiblefor
Approval.objects.create(

View File

@@ -446,7 +446,7 @@ token: {用户token}
| client_info | String | 是 | 委托人身份信息 |
| party_info | String | 是 | 相对方身份信息 |
| description | String | 是 | 项目简述 |
| responsiblefor | Object/Dict | 是 | 负责人信息(字典格式,负责人必填,其余选填) |
| responsiblefor | Object/Dict | 是 | 负责人信息(字典格式,responsible_person必填,其余选填) |
| charge | String | 是 | 收费情况 |
| contract | File[] | 否 | 上传合同文件(可多个) |
| approvers | Array | 否 | 审核人列表团队类型时需要推荐用户ID数组如[1,2,3],兼容:用户名数组) |
@@ -455,10 +455,11 @@ token: {用户token}
**responsiblefor 字典格式说明:**
```json
{
"负责人": "王律师", // 必填
"主办律师": "李律师", // 选填
"助理律师": "张律师", // 选填
"收益分配": "50%,30%,20%" // 选填
"responsible_person": "王律师", // 必填(负责人)
"main_lawyer": "李律师", // 选填(主办律师)
"assistant_lawyer": "张律师", // 选填(助理律师)
"case_manager_lawyer": "赵律师", // 选填(案管律师)
"profit_distribution": "50%,30%,20%" // 选填(收益分配)
}
```
@@ -472,10 +473,11 @@ token: {用户token}
"party_info": "李四身份证号110101199002021234",
"description": "合同纠纷案件",
"responsiblefor": {
"负责人": "王律师",
"主办律师": "李律师",
"助理律师": "张律师",
"收益分配": "50%,30%,20%"
"responsible_person": "王律师",
"main_lawyer": "李律师",
"assistant_lawyer": "张律师",
"case_manager_lawyer": "赵律师",
"profit_distribution": "50%,30%,20%"
},
"charge": "按标的额5%收费",
"approvers": [1, 2, 3]
@@ -491,7 +493,7 @@ token: {用户token}
"client_info": "张三身份证号110101199001011234",
"party_info": "李四身份证号110101199002021234",
"description": "合同纠纷案件",
"responsiblefor": "{\"负责人\":\"王律师\",\"主办律师\":\"李律师\",\"助理律师\":\"律师\",\"收益分配\":\"50%,30%,20%\"}",
"responsiblefor": "{\"responsible_person\":\"王律师\",\"main_lawyer\":\"李律师\",\"assistant_lawyer\":\"张律师\",\"case_manager_lawyer\":\"律师\",\"profit_distribution\":\"50%,30%,20%\"}",
"charge": "按标的额5%收费",
"approvers": [1, 2, 3]
}
@@ -599,10 +601,11 @@ token: {用户token}
"party_info": "李四身份证号110101199002021234",
"description": "合同纠纷案件",
"responsiblefor": {
"负责人": "王律师",
"主办律师": "李律师",
"助理律师": "张律师",
"收益分配": "50%,30%,20%"
"responsible_person": "王律师",
"main_lawyer": "李律师",
"assistant_lawyer": "张律师",
"case_manager_lawyer": "赵律师",
"profit_distribution": "50%,30%,20%"
},
"charge": "按标的额5%收费",
"contract": "http://example.com/contract.pdf",
@@ -636,7 +639,7 @@ token: {用户token}
| client_info | String | 否 | 委托人身份信息 |
| party_info | String | 否 | 相对方身份信息 |
| description | String | 否 | 项目简述 |
| responsiblefor | Object/Dict | 否 | 负责人信息(字典格式,负责人必填,其余选填) |
| responsiblefor | Object/Dict | 否 | 负责人信息(字典格式,responsible_person必填,其余选填) |
| charge | String | 否 | 收费情况 |
| contract | File[] | 否 | 上传合同文件 |
@@ -647,10 +650,11 @@ token: {用户token}
"times": "2024-01-02",
"charge": "按标的额6%收费",
"responsiblefor": {
"负责人": "王律师",
"主办律师": "李律师",
"助理律师": "张律师",
"收益分配": "50%,30%,20%"
"responsible_person": "王律师",
"main_lawyer": "李律师",
"assistant_lawyer": "张律师",
"case_manager_lawyer": "赵律师",
"profit_distribution": "50%,30%,20%"
}
}
```
@@ -881,10 +885,11 @@ token: {用户token}
"party_name": "李四身份证号110101199002021234",
"description": "合同纠纷案件",
"responsiblefor": {
"负责人": "王律师",
"主办律师": "李律师",
"助理律师": "张律师",
"收益分配": "50%,30%,20%"
"responsible_person": "王律师",
"main_lawyer": "李律师",
"assistant_lawyer": "张律师",
"case_manager_lawyer": "赵律师",
"profit_distribution": "50%,30%,20%"
},
"charge": "按标的额5%收费",
"times": "2024-01-15",
@@ -1309,9 +1314,15 @@ token: {用户token}
8. **投标登记创建时会触发审核流程**,团队类型需要提供审核人
9. **负责人信息格式**
- 接受字典格式Object或JSON字符串格式
- 负责人字段必填,主办律师、助理律师、收益分配为选填
- 字典格式示例:`{"负责人":"王律师","主办律师":"李律师","助理律师":"律师","收益分配":"50%,30%,20%"}`
- responsible_person负责人字段必填,main_lawyer主办律师、assistant_lawyer助理律师、case_manager_lawyer案管律师、profit_distribution收益分配为选填
- 字典格式示例:`{"responsible_person":"王律师","main_lawyer":"李律师","assistant_lawyer":"张律师","case_manager_lawyer":"律师","profit_distribution":"50%,30%,20%"}`
- 返回时统一为字典格式
- 字段说明:
- `responsible_person`: 负责人(必填)
- `main_lawyer`: 主办律师(选填)
- `assistant_lawyer`: 助理律师(选填)
- `case_manager_lawyer`: 案管律师(选填)
- `profit_distribution`: 收益分配(选填)
---
@@ -1325,4 +1336,4 @@ token: {用户token}
- 发票和案件日志关联案件,不再关联预立案
- 预立案登记:增、删、改、查(分页查询、简化列表查询)
- 投标登记:增、删、改、查(分页查询)
- **优化立项登记负责人字段**:改为字典格式,包含负责人必填)、主办律师选填)、助理律师(选填)、收益分配选填)
- **优化立项登记负责人字段**:改为字典格式,包含responsible_person负责人必填)、main_lawyer主办律师选填)、assistant_lawyer助理律师选填、case_manager_lawyer案管律师选填、profit_distribution收益分配选填)