20f285b0 by 周伟奇

fix auto

1 parent 244bd532
...@@ -748,17 +748,25 @@ class SECompareView(GenericView): ...@@ -748,17 +748,25 @@ class SECompareView(GenericView):
748 business_type = content.get('applicationEntity') 748 business_type = content.get('applicationEntity')
749 application_id = content.get('applicationId') 749 application_id = content.get('applicationId')
750 is_auto = content.get('isAutoSettlement', False) 750 is_auto = content.get('isAutoSettlement', False)
751
752 auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement
753 auto_obj = auto_class.objects.filter(application_id=application_id).first()
751 if is_auto: 754 if is_auto:
752 # 加入优先级队列 755 # 加入优先级队列
753 PriorityApplication.objects.update_or_create( 756 PriorityApplication.objects.update_or_create(
754 application_id=application_id, defaults={'on_off': True}) 757 application_id=application_id, defaults={'on_off': True})
755 # 加入auto表 758 # 加入auto表
756 auto_class = HILAutoSettlement if business_type in consts.HIL_SET else AFCAutoSettlement 759 if auto_obj is None:
757 is_auto_in_db = auto_class.objects.filter(application_id=application_id, on_off=True).exists()
758 if not is_auto_in_db:
759 auto_class.objects.create( 760 auto_class.objects.create(
760 application_id=application_id, 761 application_id=application_id,
761 ) 762 )
763 elif auto_obj.on_off is False:
764 auto_obj.on_off = True
765 auto_obj.save()
766 else:
767 if auto_obj is not None and auto_obj.on_off is True:
768 auto_obj.on_off = False
769 auto_obj.save()
762 return response.ok() 770 return response.ok()
763 771
764 # uniq_seq = content.get('uniqSeq') 772 # uniq_seq = content.get('uniqSeq')
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!