This commit is contained in:
caoqianming 2020-04-17 10:08:19 +08:00
parent 4b769d36ae
commit 1292dbdb6d
1 changed files with 4 additions and 11 deletions

View File

@ -184,9 +184,7 @@ class ConsumerViewSet(ModelViewSet):
return Response({"error":"账户列错误!"})
if sheet['c2'].value != '单位':
return Response({"error":"单位列错误!"})
if sheet['d2'].value != '付费学科':
return Response({"error":"付费学科列错误!"})
if sheet['e2'].value != '工作类别':
if sheet['d2'].value != '工作类别':
return Response({"error":"工作类别列错误!"})
companydict = {}
consumerdict = {}
@ -218,21 +216,16 @@ class ConsumerViewSet(ModelViewSet):
obj.name = name
obj.company = companyobj
obj.is_delete = False
obj.save()
if workscope:
workscope = workscope.replace(' ', '')
try:
workscopeobj = WorkScope.objects.get(name=workscope)
obj.workscope = workscopeobj
PaySubject.objects.create(subject=workscopeobj.subject, consumer = obj)
except:
pass
obj.save()
if subjects:
subjects_list = subjects.replace(' ','').split(',')
for i in subjects_list:
queryset = Questioncat.objects.filter(name=i,is_subject=True,is_delete=False)
if queryset.exists():
PaySubject.objects.create(subject=queryset.first(), consumer=obj)
obj.save()
m = m + 1
return Response(status=status.HTTP_200_OK)