优化立项接口
This commit is contained in:
@@ -17,7 +17,7 @@ class ProjectRegistration(models.Model):
|
||||
times = models.CharField(max_length=100) # 立项日期时间
|
||||
responsiblefor = models.CharField(max_length=100) # 负责人
|
||||
charge = models.CharField(max_length=100) # 收费情况
|
||||
contract = models.CharField(max_length=100) # 合同
|
||||
contract = models.TextField() # 合同
|
||||
state = models.CharField(max_length=100) # 状态
|
||||
|
||||
|
||||
|
||||
@@ -3,17 +3,18 @@ from rest_framework.response import Response
|
||||
from rest_framework import status
|
||||
import json
|
||||
import ast
|
||||
from User.models import User,Approval
|
||||
from .models import PreFiling,ProjectRegistration,Bid,Case,Invoice,Caselog,SealApplication,Warehousing,RegisterPlatform,Announcement,LawyerFlie,Schedule,permission,role
|
||||
from User.models import User, Approval
|
||||
from .models import PreFiling, ProjectRegistration, Bid, Case, Invoice, Caselog, SealApplication, Warehousing, \
|
||||
RegisterPlatform, Announcement, LawyerFlie, Schedule, permission, role
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
from utility.utility import flies
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
from django.db.models import Count, Q
|
||||
|
||||
|
||||
class registration(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
预立案登记
|
||||
:param request:
|
||||
@@ -28,7 +29,7 @@ class registration(APIView):
|
||||
description = request.data.get('description')
|
||||
Undertaker = request.data.get('Undertaker')
|
||||
user = User.objects.get(token=token).username
|
||||
if not all([times,description,Undertaker]):
|
||||
if not all([times, description, Undertaker]):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
PreFiling.objects.create(
|
||||
@@ -41,8 +42,9 @@ class registration(APIView):
|
||||
)
|
||||
return Response({'message': '登记成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class registrationList(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
预立案登记列表接口
|
||||
:param request:
|
||||
@@ -52,7 +54,6 @@ class registrationList(APIView):
|
||||
"""
|
||||
project_registration_ids = ProjectRegistration.objects.values_list('user_id', flat=True)
|
||||
|
||||
|
||||
bid_ids = Bid.objects.values_list('user_id', flat=True)
|
||||
associated_ids = project_registration_ids.union(bid_ids)
|
||||
prefiling_without_association = PreFiling.objects.exclude(id__in=associated_ids)
|
||||
@@ -63,11 +64,11 @@ class registrationList(APIView):
|
||||
"client_username": prefiling.client_username,
|
||||
"party_username": prefiling.party_username,
|
||||
})
|
||||
return Response({'message': '展示成功','data':data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
return Response({'message': '展示成功', 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class registrationDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
预立案登记展示
|
||||
:param request:
|
||||
@@ -110,10 +111,11 @@ class registrationDetail(APIView):
|
||||
"Undertaker": info.Undertaker,
|
||||
})
|
||||
|
||||
return Response({'message': '展示成功',"total":total,'data':data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
return Response({'message': '展示成功', "total": total, 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class Project(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
立项登记
|
||||
:param request:
|
||||
@@ -134,6 +136,15 @@ class Project(APIView):
|
||||
|
||||
if contract:
|
||||
contract = flies(contract)
|
||||
else:
|
||||
contract = []
|
||||
|
||||
# 将文件URL列表转换为字符串存储(如果有多个URL,用逗号分隔)
|
||||
if contract:
|
||||
# 如果只有一个URL,直接存储;如果有多个,用逗号分隔
|
||||
contract_str = contract[0] if len(contract) == 1 else ','.join(contract)
|
||||
else:
|
||||
contract_str = ""
|
||||
|
||||
pro = ProjectRegistration.objects.create(
|
||||
type=type,
|
||||
@@ -141,7 +152,7 @@ class Project(APIView):
|
||||
times=times,
|
||||
responsiblefor=responsiblefor,
|
||||
charge=charge,
|
||||
contract=json.dumps(contract),
|
||||
contract=contract_str,
|
||||
state="审核中",
|
||||
user_id=id,
|
||||
|
||||
@@ -151,7 +162,7 @@ class Project(APIView):
|
||||
formatted_date = today.strftime("%Y-%m-%d")
|
||||
Approval.objects.create(
|
||||
title=responsiblefor + "立项登记",
|
||||
content=responsiblefor + "在" + times + "办理立项登记,项目类型:" + type + ",合同编号:" + ContractNo + "描述:"+",负责人:"+responsiblefor+",收费情况:"+charge,
|
||||
content=responsiblefor + "在" + times + "办理立项登记,项目类型:" + type + ",合同编号:" + ContractNo + "描述:" + ",负责人:" + responsiblefor + ",收费情况:" + charge,
|
||||
times=formatted_date,
|
||||
personincharge=personincharge,
|
||||
state='审核中',
|
||||
@@ -162,7 +173,7 @@ class Project(APIView):
|
||||
|
||||
|
||||
class Projectquerytype(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
立项登记类型查询
|
||||
:param request:
|
||||
@@ -183,15 +194,16 @@ class Projectquerytype(APIView):
|
||||
start_of_year_str = start_of_year.strftime("%Y-%m-%d")
|
||||
end_of_year_str = end_of_year.strftime("%Y-%m-%d")
|
||||
type = request.data.get('type')
|
||||
count = ProjectRegistration.objects.filter(type=type,times__gte=start_of_year_str,times__lte=end_of_year_str).count()
|
||||
count = ProjectRegistration.objects.filter(type=type, times__gte=start_of_year_str,
|
||||
times__lte=end_of_year_str).count()
|
||||
data = {
|
||||
"count": count
|
||||
}
|
||||
return Response({'message': '查询成功',"data":data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
return Response({'message': '查询成功', "data": data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class ProjectDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
立项登记展示
|
||||
:param request:
|
||||
@@ -219,7 +231,6 @@ class ProjectDetail(APIView):
|
||||
pre_id = pre.values_list('id', flat=True)
|
||||
Q_obj &= Q(user_id__in=pre_id)
|
||||
|
||||
|
||||
pre = ProjectRegistration.objects.filter(Q_obj)
|
||||
total = len(pre)
|
||||
|
||||
@@ -251,8 +262,9 @@ class ProjectDetail(APIView):
|
||||
|
||||
return Response({'message': '展示成功', "total": total, 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class EditProject(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
编辑立案登记
|
||||
:param request:
|
||||
@@ -273,7 +285,12 @@ class EditProject(APIView):
|
||||
import datetime
|
||||
if contract:
|
||||
contract = flies(contract)
|
||||
pro.contract = json.dumps(contract)
|
||||
# 将文件URL列表转换为字符串存储(如果有多个URL,用逗号分隔)
|
||||
if contract:
|
||||
contract_str = contract[0] if len(contract) == 1 else ','.join(contract)
|
||||
else:
|
||||
contract_str = ""
|
||||
pro.contract = contract_str
|
||||
pro.save(update_fields=['contract'])
|
||||
pro.times = times
|
||||
pro.type = type
|
||||
@@ -281,14 +298,14 @@ class EditProject(APIView):
|
||||
pro.responsiblefor = responsiblefor
|
||||
pro.charge = charge
|
||||
|
||||
pro.state ="审核中"
|
||||
pro.save(update_fields=['ContractNo', 'times', 'type', 'responsiblefor', 'charge', 'state',"type2"])
|
||||
pro.state = "审核中"
|
||||
pro.save(update_fields=['ContractNo', 'times', 'type', 'responsiblefor', 'charge', 'state', "type2"])
|
||||
|
||||
today = datetime.datetime.now()
|
||||
formatted_date = today.strftime("%Y-%m-%d")
|
||||
Approval.objects.create(
|
||||
title=responsiblefor + "立项登记重新编辑",
|
||||
content=responsiblefor + "在" + times + "办理立项登记,项目类型:" + type + ",合同编号:" + ContractNo + "描述:"+ ",负责人:" + responsiblefor + ",收费情况:" + charge,
|
||||
content=responsiblefor + "在" + times + "办理立项登记,项目类型:" + type + ",合同编号:" + ContractNo + "描述:" + ",负责人:" + responsiblefor + ",收费情况:" + charge,
|
||||
times=formatted_date,
|
||||
personincharge=personincharge,
|
||||
state='审核中',
|
||||
@@ -298,8 +315,9 @@ class EditProject(APIView):
|
||||
|
||||
return Response({'message': '编辑成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class BidRegistration(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
投标登记
|
||||
:param request:
|
||||
@@ -313,7 +331,7 @@ class BidRegistration(APIView):
|
||||
BiddingAnnouncement = request.FILES.getlist('BiddingAnnouncement')
|
||||
personincharge = request.data.get('personincharge')
|
||||
id = request.data.get('user_id')
|
||||
if not all([BiddingUnit, ProjectName, times, personincharge,id]):
|
||||
if not all([BiddingUnit, ProjectName, times, personincharge, id]):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
import datetime
|
||||
bib = Bid.objects.create(
|
||||
@@ -330,7 +348,7 @@ class BidRegistration(APIView):
|
||||
formatted_date = today.strftime("%Y-%m-%d")
|
||||
Approval.objects.create(
|
||||
title=ProjectName + "投标登记",
|
||||
content="项目名称:"+ProjectName+",申请日期:"+times,
|
||||
content="项目名称:" + ProjectName + ",申请日期:" + times,
|
||||
times=formatted_date,
|
||||
personincharge=personincharge,
|
||||
state='审核中',
|
||||
@@ -339,8 +357,9 @@ class BidRegistration(APIView):
|
||||
)
|
||||
return Response({'message': '登记成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class BidDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
page = request.data.get('page')
|
||||
per_page = request.data.get('per_page')
|
||||
times = request.data.get('times')
|
||||
@@ -362,7 +381,6 @@ class BidDetail(APIView):
|
||||
pre_id = pre.values_list('id', flat=True)
|
||||
Q_obj &= Q(user_id__in=pre_id)
|
||||
|
||||
|
||||
pre = Bid.objects.filter(Q_obj)
|
||||
total = len(pre)
|
||||
|
||||
@@ -392,9 +410,8 @@ class BidDetail(APIView):
|
||||
return Response({'message': '展示成功', "total": total, 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
|
||||
class caseManagement(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
案件管理版块
|
||||
:param request:
|
||||
@@ -427,7 +444,7 @@ class caseManagement(APIView):
|
||||
|
||||
Approval.objects.create(
|
||||
title="案件管理信息提交",
|
||||
content=times+"提交了一份案件信息,请审核",
|
||||
content=times + "提交了一份案件信息,请审核",
|
||||
times=times,
|
||||
personincharge=personincharge,
|
||||
state='审核中',
|
||||
@@ -464,15 +481,16 @@ class caseManagement(APIView):
|
||||
type="案件管理",
|
||||
user_id=case.id
|
||||
)
|
||||
case.save(update_fields=['ChangeRequest',"state"])
|
||||
case.save(update_fields=['ChangeRequest', "state"])
|
||||
if paymentcollection:
|
||||
case.paymentcollection = paymentcollection
|
||||
case.save(update_fields=['paymentcollection'])
|
||||
|
||||
return Response({'message': '编辑成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class caseManagementDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
案件管理版块展示
|
||||
:param request:
|
||||
@@ -492,8 +510,8 @@ class caseManagementDetail(APIView):
|
||||
Q_obj &= Q(times__gte=times) & Q(times__lte=end_time)
|
||||
|
||||
if type:
|
||||
por_id = ProjectRegistration.objects.filter(type=type).values_list('user_id', flat=True)
|
||||
Q_obj &= Q(user_id__in=por_id)
|
||||
por_id = ProjectRegistration.objects.filter(type=type).values_list('user_id', flat=True)
|
||||
Q_obj &= Q(user_id__in=por_id)
|
||||
|
||||
# if client_username:
|
||||
# pre = PreFiling.objects.filter(client_username__icontains=client_username)
|
||||
@@ -504,7 +522,6 @@ class caseManagementDetail(APIView):
|
||||
# pre_id = pre.values_list('id', flat=True)
|
||||
# Q_obj &= Q(user_id__in=pre_id)
|
||||
|
||||
|
||||
pre = Case.objects.filter(Q_obj)
|
||||
total = len(pre)
|
||||
|
||||
@@ -522,12 +539,12 @@ class caseManagementDetail(APIView):
|
||||
pro = ProjectRegistration.objects.get(user_id=info.user_id)
|
||||
data.append({
|
||||
"id": info.id,
|
||||
"ContractNo": pro.ContractNo, # 合同编号
|
||||
"type_pro": pro.type, # 项目类型
|
||||
"client_username": pre.client_username, # 委托人信息
|
||||
"party_username": pre.party_username, # 相对方信息
|
||||
"description": pre.description, # 项目简述
|
||||
"responsiblefor": pro.responsiblefor, # 负责人
|
||||
"ContractNo": pro.ContractNo, # 合同编号
|
||||
"type_pro": pro.type, # 项目类型
|
||||
"client_username": pre.client_username, # 委托人信息
|
||||
"party_username": pre.party_username, # 相对方信息
|
||||
"description": pre.description, # 项目简述
|
||||
"responsiblefor": pro.responsiblefor, # 负责人
|
||||
"charge": pro.charge,
|
||||
'times': info.times,
|
||||
"AgencyContract": info.AgencyContract,
|
||||
@@ -541,8 +558,9 @@ class caseManagementDetail(APIView):
|
||||
|
||||
return Response({'message': '展示成功', "total": total, 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class Uploadinvoice(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""案件管理发票"""
|
||||
id = request.data.get('user_id')
|
||||
amount = request.data.get('amount')
|
||||
@@ -557,8 +575,9 @@ class Uploadinvoice(APIView):
|
||||
)
|
||||
return Response({'message': '上传成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class InvoiceDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
发票展示
|
||||
:param request:
|
||||
@@ -580,8 +599,9 @@ class InvoiceDetail(APIView):
|
||||
})
|
||||
return Response({'message': '展示成功', 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class Log(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
案件日志
|
||||
"""
|
||||
@@ -590,7 +610,7 @@ class Log(APIView):
|
||||
content = request.data.get('content')
|
||||
file = request.FILES.getlist('file')
|
||||
|
||||
if not all([id,content]):
|
||||
if not all([id, content]):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
user = User.objects.get(token=token)
|
||||
now = datetime.now()
|
||||
@@ -599,13 +619,14 @@ class Log(APIView):
|
||||
user_id=id,
|
||||
content=content,
|
||||
file=json.dumps(flies(file)),
|
||||
times = date_str,
|
||||
username = user.username,
|
||||
times=date_str,
|
||||
username=user.username,
|
||||
)
|
||||
return Response({'message': '添加成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class LogDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
案件日志展示
|
||||
:param request:
|
||||
@@ -641,8 +662,9 @@ class LogDetail(APIView):
|
||||
|
||||
return Response({'message': '展示成功', "total": total, 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class accumulate(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
累加
|
||||
:param request:
|
||||
@@ -657,14 +679,14 @@ class accumulate(APIView):
|
||||
number = 0
|
||||
else:
|
||||
number = float(case.paymentcollection)
|
||||
case.paymentcollection = float(number+float(paymentcollection))
|
||||
case.paymentcollection = float(number + float(paymentcollection))
|
||||
case.save(update_fields=['paymentcollection'])
|
||||
|
||||
return Response({'message': '成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
return Response({'message': '成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class preFilingLinkedCases(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
预立案关联立案列表接口
|
||||
:param request:
|
||||
@@ -683,8 +705,9 @@ class preFilingLinkedCases(APIView):
|
||||
})
|
||||
return Response({'message': '展示成功', 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class Application(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
申请用印
|
||||
:param request:
|
||||
@@ -701,7 +724,7 @@ class Application(APIView):
|
||||
file = request.FILES.getlist('file')
|
||||
personincharge = request.data.get('personincharge')
|
||||
|
||||
if not all([Printingpurpose,Reason,seal_number,seal_type,file,personincharge]):
|
||||
if not all([Printingpurpose, Reason, seal_number, seal_type, file, personincharge]):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
now = datetime.now()
|
||||
date_str = now.strftime('%Y-%m-%d')
|
||||
@@ -729,8 +752,9 @@ class Application(APIView):
|
||||
)
|
||||
return Response({'message': '添加成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class ApplicationDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
申请用印展示
|
||||
:param request:
|
||||
@@ -780,8 +804,9 @@ class ApplicationDetail(APIView):
|
||||
|
||||
return Response({'message': '展示成功', "total": total, 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class WarehousingRegistration(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
入库登记
|
||||
:param request:
|
||||
@@ -809,8 +834,9 @@ class WarehousingRegistration(APIView):
|
||||
)
|
||||
return Response({'message': '添加成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class WarehousingDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
入库登记展示
|
||||
:param request:
|
||||
@@ -857,8 +883,9 @@ class WarehousingDetail(APIView):
|
||||
|
||||
return Response({'message': '展示成功', "total": total, 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class PlatformRegistration(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
注册平台登记
|
||||
:param request:
|
||||
@@ -881,8 +908,9 @@ class PlatformRegistration(APIView):
|
||||
)
|
||||
return Response({'message': '添加成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class PlatformDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
注册平台登记展示
|
||||
:param request:
|
||||
@@ -915,8 +943,9 @@ class PlatformDetail(APIView):
|
||||
|
||||
return Response({'message': '展示成功', "total": total, 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class EditPlatformDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
注册平台登记编辑
|
||||
:param request:
|
||||
@@ -930,7 +959,7 @@ class EditPlatformDetail(APIView):
|
||||
password = request.data.get('password')
|
||||
username = request.data.get('username')
|
||||
|
||||
if not all([platform, number, password, username,ID]):
|
||||
if not all([platform, number, password, username, ID]):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
reg = RegisterPlatform.objects.get(id=ID)
|
||||
reg.platform = platform
|
||||
@@ -940,8 +969,9 @@ class EditPlatformDetail(APIView):
|
||||
reg.save(update_fields=['platform', 'number', 'password', 'username'])
|
||||
return Response({'message': '修改成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class DeletePlatformDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
删除注册平台登记
|
||||
:param request:
|
||||
@@ -953,8 +983,9 @@ class DeletePlatformDetail(APIView):
|
||||
RegisterPlatform.objects.get(id=ID).delete()
|
||||
return Response({'message': '删除成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class bulletin(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
公告
|
||||
:param request:
|
||||
@@ -962,7 +993,7 @@ class bulletin(APIView):
|
||||
:param kwargs:
|
||||
:return:
|
||||
"""
|
||||
title = request.data.get('title')
|
||||
title = request.data.get('title')
|
||||
content = request.data.get('content')
|
||||
file = request.FILES.getlist('file')
|
||||
state = request.data.get('state')
|
||||
@@ -987,8 +1018,9 @@ class bulletin(APIView):
|
||||
)
|
||||
return Response({'message': '添加成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class BulletinDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
公告展示
|
||||
:param request:
|
||||
@@ -1023,6 +1055,7 @@ class BulletinDetail(APIView):
|
||||
|
||||
return Response({'message': '展示成功', "total": total, 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class EditBulletin(APIView):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
@@ -1070,15 +1103,16 @@ class EditBulletin(APIView):
|
||||
ann.save(update_fields=['username', 'times'])
|
||||
return Response({'message': '添加成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class deleteBulletin(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
ID = request.data.get('id')
|
||||
Announcement.objects.get(id=ID).delete()
|
||||
return Response({'message': '删除成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class Lawyersdocuments(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
title = request.data.get('title')
|
||||
file = request.FILES.getlist('file')
|
||||
remark = request.data.get('remark')
|
||||
@@ -1095,8 +1129,9 @@ class Lawyersdocuments(APIView):
|
||||
)
|
||||
return Response({'message': '文件上传成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class LawyersdocumentsDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
law = LawyerFlie.objects.all().order_by('-times')
|
||||
total = law.count()
|
||||
data = []
|
||||
@@ -1113,13 +1148,14 @@ class LawyersdocumentsDetail(APIView):
|
||||
|
||||
|
||||
class LwaDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
id = request.data.get('id')
|
||||
LawyerFlie.objects.get(id=id).delete()
|
||||
return Response({'message': '删除成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class CreateSchedule(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
日常创建
|
||||
:param request:
|
||||
@@ -1143,15 +1179,16 @@ class CreateSchedule(APIView):
|
||||
)
|
||||
return Response({'message': '添加成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class DeleteSchedule(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
id = request.data.get('id')
|
||||
Schedule.objects.get(id=id).delete()
|
||||
return Response({'message': '删除成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class ScheduleDetail(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
日程展示
|
||||
:param request:
|
||||
@@ -1184,26 +1221,29 @@ class ScheduleDetail(APIView):
|
||||
})
|
||||
return Response({'message': '展示成功', "total": total, 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class handleSchedule(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
id = request.data.get('id')
|
||||
state = request.data.get('state')
|
||||
if not all([id, state]):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
sc = Schedule.objects.get(id=id)
|
||||
sc.state=state
|
||||
sc.state = state
|
||||
sc.save(update_fields=['state'])
|
||||
return Response({'message': '修改成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class AddRermission(APIView):
|
||||
"""
|
||||
添加权限
|
||||
"""
|
||||
def post(self,request,*args,**kwargs):
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
permission_name = request.data.get('permission_name')
|
||||
permission_logo = request.data.get('permission_logo')
|
||||
parent = request.data.get('parent')
|
||||
if not all([permission_name,permission_logo,parent]):
|
||||
if not all([permission_name, permission_logo, parent]):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
permission.objects.create(
|
||||
permission_name=permission_name,
|
||||
@@ -1212,8 +1252,9 @@ class AddRermission(APIView):
|
||||
)
|
||||
return Response({'message': '添加成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class DisplayRermission(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
permissions = permission.objects.all()
|
||||
|
||||
# 先将数据转换为字典格式
|
||||
@@ -1250,14 +1291,17 @@ class DisplayRermission(APIView):
|
||||
"data": tree,
|
||||
'code': 0
|
||||
}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class DeleteRermission(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
ID = request.data.get('id')
|
||||
permission.objects.get(id=ID).delete()
|
||||
return Response({'message': '删除成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class EditRermission(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
id = request.data.get('id')
|
||||
permission_name = request.data.get('permission_name')
|
||||
permission_logo = request.data.get('permission_logo')
|
||||
@@ -1274,25 +1318,27 @@ class EditRermission(APIView):
|
||||
per.save(update_fields=['parent'])
|
||||
return Response({'message': '修改成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class addRole(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
RoleName = request.data.get('RoleName')
|
||||
remark = request.data.get('remark')
|
||||
if not all([RoleName]):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
role.objects.create(RoleName=RoleName,remark=remark)
|
||||
role.objects.create(RoleName=RoleName, remark=remark)
|
||||
return Response({'message': '添加成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class DeleteRole(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
id = request.data.get('id')
|
||||
role.objects.get(id=id).delete()
|
||||
return Response({'message': '删除成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class EditRole(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
id = request.data.get('id')
|
||||
RoleName = request.data.get('RoleName')
|
||||
remark = request.data.get('remark')
|
||||
@@ -1308,8 +1354,9 @@ class EditRole(APIView):
|
||||
ro.save(update_fields=['remark'])
|
||||
return Response({'message': '编辑成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class displayRole(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
RoleName = request.data.get('RoleName')
|
||||
obj = Q()
|
||||
if RoleName:
|
||||
@@ -1322,13 +1369,14 @@ class displayRole(APIView):
|
||||
"RoleName": ro.RoleName,
|
||||
"remark": ro.remark,
|
||||
})
|
||||
return Response({'message': '展示成功','data' :data,'code': 0}, status=status.HTTP_200_OK)
|
||||
return Response({'message': '展示成功', 'data': data, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class modifypermissions(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
id = request.data.get('id')
|
||||
permissionId = request.data.get('permissionId')
|
||||
if not all([id,permissionId]):
|
||||
if not all([id, permissionId]):
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
permissionId = ast.literal_eval(permissionId)
|
||||
ro = role.objects.get(id=id)
|
||||
@@ -1337,8 +1385,9 @@ class modifypermissions(APIView):
|
||||
|
||||
return Response({'message': '权限修改成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class getRolePermissions(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
查询角色权限
|
||||
:param request:
|
||||
@@ -1349,12 +1398,12 @@ class getRolePermissions(APIView):
|
||||
role_id = request.data.get('roleId')
|
||||
if not role_id:
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
try:
|
||||
ro = role.objects.get(id=role_id)
|
||||
except role.DoesNotExist:
|
||||
return Response({'status': 'error', 'message': '角色不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
|
||||
# 解析权限ID列表
|
||||
try:
|
||||
if ro.permissionId:
|
||||
@@ -1367,11 +1416,12 @@ class getRolePermissions(APIView):
|
||||
except (ValueError, SyntaxError):
|
||||
# 如果解析失败,返回空列表
|
||||
permission_ids = []
|
||||
|
||||
|
||||
return Response({'message': '查询成功', 'data': permission_ids, 'code': 0}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class DeleteRegistration(APIView):
|
||||
def post(self,request,*args,**kwargs):
|
||||
def post(self, request, *args, **kwargs):
|
||||
"""
|
||||
删除预立案登记
|
||||
:param request:
|
||||
@@ -1382,11 +1432,11 @@ class DeleteRegistration(APIView):
|
||||
id = request.data.get('id')
|
||||
if not id:
|
||||
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
|
||||
try:
|
||||
pre = PreFiling.objects.get(id=id)
|
||||
pre.delete()
|
||||
return Response({'message': '删除成功', 'code': 0}, status=status.HTTP_200_OK)
|
||||
except PreFiling.DoesNotExist:
|
||||
return Response({'status': 'error', 'message': '预立案登记不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
return Response({'status': 'error', 'message': '预立案登记不存在', 'code': 1},
|
||||
status=status.HTTP_404_NOT_FOUND)
|
||||
|
||||
Reference in New Issue
Block a user