Example #1
0
    def get_context_data(self, **kwargs):
        context = super(AllTicket, self).get_context_data(**kwargs)
        request_data = self.request.GET
        #filter ticket in the future if necessary
        sn = request_data.get('sn', '')
        title = request_data.get('title', '')
        username = request_data.get('username', '')
        create_start = request_data.get('create_start', '')
        create_end = request_data.get('create_end', '')
        workflow_ids = request_data.get('workflow_ids', '')
        reverse = int(request_data.get('reverse', 1))
        per_page = int(request_data.get('per_page', 10))
        page = int(request_data.get('page', 1))
        # 待办,关联的,创建
        category = request_data.get('category')

        ins = WorkFlowAPiRequest(appname='ops',
                                 username=self.request.user.username)
        status, state_result = ins.getdata(parameters=dict(
            username=self.request.user.username, category='all'),
                                           method='get',
                                           url='/api/v1.0/tickets')
        if status:
            if len(state_result) > 0 and isinstance(
                    state_result, dict) and 'data' in state_result.keys(
                    ) and 'value' in state_result['data'].keys():
                context['ticket_result_restful_list'] = state_result['data'][
                    'value']
        context['msg'] = state_result['msg']
        return context
Example #2
0
 def get(self, request, *args, **kwargs):
     request_data = request.GET
     ticket_id = kwargs.get('ticket_id')
     username = request_data.get('username',
                                 request.user.username)  # 可用于权限控制
     ins = WorkFlowAPiRequest(username=self.request.user.username)
     status, state_result = ins.getdata(
         parameters={},
         method='get',
         url='/api/v1.0/tickets/{0}/flowsteps'.format(
             self.kwargs.get('ticket_id')))
     return JsonResponse(data=state_result)
Example #3
0
    def form_valid(self, form):
        # save ticket
        if 'transition_id' in form.data.keys():
            transition_id = form.data['transition_id']
            form_data = form.cleaned_data
            form_data['transition_id'] = int(transition_id)
            # suggestion
            ticket_id = int(self.kwargs.get('ticket_id'))
            file_keys = list(form.files.keys())
            suggestion = form.data['suggestion']
            form_data['suggestion'] = suggestion
            title = form.data["title"]

            for file_key in file_keys:
                # 存放
                file = form.files[file_key].file
                file_name = form.files[file_key].name
                curr_time = datetime.datetime.now()
                # form_data[file_key] = os.path.abspath(os.curdir) + '/media/' + title + '/' + str(int(time.time())) + file_name
                form_data[file_key] = os.path.abspath(os.curdir) + '/media/' + title +"/"  + str(curr_time.date()) + '_' + str(curr_time.hour)+ \
                                      '-' + str(curr_time.minute) + '-' + str(curr_time.second) + '-' + str(curr_time.microsecond) + '_' + file_name
                Util.saveFile(file, form_data[file_key])

            for key, value in form_data.items():
                # 原始代码:if isinstance(value, datetime.datetime):
                # 修改后解决了日期、日期时间的问题
                if isinstance(value, datetime.date):
                    form_data[key] = form.data[key]

            ins = WorkFlowAPiRequest(username=self.request.user.username)
            status, state_result = ins.getdata(
                data=form_data,
                method='patch',
                url='/api/v1.0/tickets/{0}'.format(ticket_id))

            if 'b_guanliyuanshenpi_char_xiangmubianhao' in form_data.keys(
            ) and form_data['b_guanliyuanshenpi_char_xiangmubianhao'] != None:
                try:
                    tempFlowIdRelation = TempFlowIdRelation.objects.get(
                        ticket_id=ticket_id)
                    tempFlowIdRelation.ticket_id = state_result["ticket_id"]
                    tempFlowIdRelation.project_id = form_data[
                        'b_guanliyuanshenpi_char_xiangmubianhao']
                    tempFlowIdRelation.save()
                except:
                    tempFlowIdRelation = TempFlowIdRelation()
                    tempFlowIdRelation.ticket_id = ticket_id
                    tempFlowIdRelation.project_id = form_data[
                        'b_guanliyuanshenpi_char_xiangmubianhao']
                    tempFlowIdRelation.save()

        return super().form_valid(form)
Example #4
0
 def get_context_data(self, **kwargs):
     context = super(Index, self).get_context_data(**kwargs)
     #context['workflows'] = Workflow.objects.all()
     ins = WorkFlowAPiRequest(appname='ops',
                              username=self.request.user.username)
     status, data = ins.getdata(dict(username=self.request.user.username,
                                     per_page=20,
                                     name=''),
                                method='get',
                                url='/api/v1.0/workflows')
     if status:
         context['workflows'] = data['data']['value']
     return context
Example #5
0
    def get_context_data(self, **kwargs):
        context = super(NewPro, self).get_context_data(**kwargs)
        user_name = self.request.user.username
        #context['workflows'] = Workflow.objects.all()
        ins = WorkFlowAPiRequest(username=user_name)
        status, data = ins.getdata(dict(per_page=20, name=''),
                                   method='get',
                                   url='/api/v1.0/workflows')
        #print(data['value'])
        if status:
            context['workflows'] = data['data']['value']

        Util.judgePremission(user_name, context)

        return context
Example #6
0
    def get_context_data(self, **kwargs):
        context = super(AllTicket, self).get_context_data(**kwargs)
        request_data = self.request.GET
        #filter ticket in the future if necessary
        sn = request_data.get('sn', '')
        title = request_data.get('title', '')
        username = request_data.get('username', '')
        create_start = request_data.get('create_start', '')
        create_end = request_data.get('create_end', '')
        workflow_ids = request_data.get('workflow_ids', '')
        reverse = int(request_data.get('reverse', 1))
        per_page = int(request_data.get('per_page', 10))
        page = int(request_data.get('page', 1))
        # 待办,关联的,创建
        category = request_data.get('category')

        ins = WorkFlowAPiRequest(username=self.request.user.username)
        status, state_result = ins.getdata(parameters=dict(category='all',
                                                           per_page=10000000,
                                                           page=page),
                                           method='get',
                                           url='/api/v1.0/tickets')
        if status:
            if len(state_result) > 0 and isinstance(
                    state_result, dict) and 'data' in state_result.keys(
                    ) and 'value' in state_result['data'].keys():
                resultList = state_result['data']['value']
                for item in resultList:
                    if item['state']['state_name'] == '施工进度':
                        item['showFlowChatFlag'] = True
                    else:
                        item['showFlowChatFlag'] = False
                    try:
                        flowretion = TempFlowIdRelation.objects.get(
                            ticket_id=item['id'])
                        item['project_id'] = flowretion.project_id
                    except:
                        item['project_id'] = "等待指定"

                context['ticket_result_restful_list'] = resultList
        context['msg'] = state_result['msg']

        try:
            Util.judgePremission(self.request.user.username, context)
        except:
            pass
        return context
Example #7
0
 def get(self, request, *args, **kwargs):
     request_data = request.GET
     ticket_id = kwargs.get('ticket_id')
     username = request_data.get('username',
                                 request.user.username)  # 可用于权限控制
     suggestion = request_data.get('suggestion')
     transitionid = request_data.get('transitionid')
     #
     form_data = dict()
     form_data['suggestion'] = suggestion
     form_data['transition_id'] = int(transitionid)
     ins = WorkFlowAPiRequest(username=self.request.user.username)
     status, state_result = ins.getdata(
         data=form_data,
         method='patch',
         url='/api/v1.0/tickets/{0}'.format(ticket_id))
     return JsonResponse(data=state_result)
Example #8
0
    def get_context_data(self, **kwargs):
        context = super(MyToDoTicket, self).get_context_data(**kwargs)
        request_data = self.request.GET
        sn = request_data.get('sn', '')
        title = request_data.get('title', '')
        username = request_data.get('username', '')
        create_start = request_data.get('create_start', '')
        create_end = request_data.get('create_end', '')
        workflow_ids = request_data.get('workflow_ids', '')
        reverse = int(request_data.get('reverse', 1))
        per_page = int(request_data.get('per_page', 10))
        page = int(request_data.get('page', 1))
        # 待办,关联的,创建
        category = request_data.get('category')
        #因为需要对应不同username,所以接口返回的数据也不同
        ins = WorkFlowAPiRequest(username=self.request.user.username)
        status, state_result = ins.getdata(parameters=dict(category='duty',
                                                           per_page=10000000,
                                                           page=page),
                                           method='get',
                                           url='/api/v1.0/tickets')
        #print(state_result)
        resultList = state_result['data']['value']
        for item in resultList:
            try:
                flowretion = TempFlowIdRelation.objects.get(
                    ticket_id=item['id'])
                item['project_id'] = flowretion.project_id
            except:
                item['project_id'] = "等待指定"

        if status:
            if len(state_result) > 0 and isinstance(
                    state_result,
                    dict) and 'data' in state_result.keys() and isinstance(
                        state_result['data'],
                        dict) and 'value' in state_result['data'].keys():
                context['ticket_result_restful_list'] = state_result['data'][
                    'value']
        context['msg'] = state_result['msg']
        #print(context)
        try:
            Util.judgePremission(self.request.user.username, context)
        except:
            pass
        return context
Example #9
0
    def get_form_class(self):
        form_fields = dict()
        workflow_id = self.kwargs.get('workflow_id')

        # get ticket initial data
        ins = WorkFlowAPiRequest(username=self.request.user.username)
        status, state_result = ins.getdata(
            {},
            method='get',
            url='/api/v1.0/workflows/{0}/init_state'.format(workflow_id))
        state_result = state_result['data']
        self.kwargs.update({'state_result': state_result})

        #print(state_result.keys())
        if isinstance(state_result,
                      dict) and 'field_list' in state_result.keys():

            class DynamicForm(forms.Form):
                def __init__(self, *args, **kwargs):
                    self.helper = FormHelper()
                    self.helper.form_class = 'form-horizontal'
                    self.helper.label_class = 'col-md-2'
                    self.helper.field_class = 'col-md-8'
                    # DictionaryField bug
                    self.helper.layout = Layout(*[
                        Div(field['field_key'], css_class='form-group')
                        for field in state_result['field_list']
                    ])
                    super(DynamicForm, self).__init__(*args, **kwargs)

            for field in state_result['field_list']:
                if field['field_key'] == 'title':
                    field['field_name'] = "项目名称"
                    field['description'] = None
                Util.createWebDirex(field, forms, form_fields, User)
                # handle read only field
                if field['field_attribute'] == 1:
                    form_fields[field['field_key']].widget.attrs[
                        'disabled'] = 'disabled'
        else:
            raise Http404()
            # print(form_fields)

        return type('DynamicItemsForm', (DynamicForm, ), form_fields)
Example #10
0
    def get(self, request, *args, **kwargs):
        """
        获取工作流列表
        :param request:
        :param args:
        :param kwargs:
        :return:
        """
        request_data = request.GET
        name = request_data.get('name', '')
        per_page = int(request_data.get('per_page', 10))
        page = int(request_data.get('page', 1))
        username = request_data.get('username', '')  # 后续会根据username做必要的权限控制

        ins = WorkFlowAPiRequest(appname='ops',
                                 username=self.request.user.username)
        status, state_result = ins.getdata(
            parameters=dict(username=self.request.user.username),
            method='get',
            url='/api/v1.0/tickets/{0}'.format(self.kwargs.get('ticket_id')))
        return JsonResponse(data=state_result)
Example #11
0
    def form_valid(self, form):
        # save ticket
        if 'transition_id' in form.data.keys():
            transition_id = form.data['transition_id']
            form_data = form.cleaned_data
            form_data['transition_id'] = int(transition_id)
            form_data['username'] = self.request.user.username
            form_data['workflow_id'] = int(self.kwargs.get('workflow_id'))
            for key, value in form_data.items():
                if isinstance(value, datetime.datetime):
                    form_data[key] = form.data[key]

            #for test only
            ins = WorkFlowAPiRequest(appname='ops',
                                     username=self.request.user.username)
            status, state_result = ins.getdata(data=form_data,
                                               method='post',
                                               url='/api/v1.0/tickets')
            # if new_ticket_result:
            # code, data = 0, {'ticket_id': new_ticket_result}
            # else:
            # code, data = -1, {}
        return super().form_valid(form)
Example #12
0
    def form_valid(self, form):
        # save ticket
        if 'transition_id' in form.data.keys():

            transition_id = form.data['transition_id']
            form_data = form.cleaned_data
            form_data['transition_id'] = int(transition_id)
            # form_data['username'] = self.request.user.username
            form_data['workflow_id'] = int(self.kwargs.get('workflow_id'))
            file_keys = list(form.files.keys())
            title = form.data["title"]
            for file_key in file_keys:
                #存放
                file = form.files[file_key].file
                file_name = form.files[file_key].name
                curr_time = datetime.datetime.now()
                form_data[file_key] = os.path.abspath(os.curdir)+ '/media/' + title +"/"  + str(curr_time.date()) + '_' + str(curr_time.hour)+ \
                                      '-' + str(curr_time.minute) + '-' + str(curr_time.second) + '-' + str(curr_time.microsecond) + '_' + file_name
                Util.saveFile(file, form_data[file_key])

            for key, value in form_data.items():
                #原始代码:if isinstance(value, datetime.datetime):
                # 修改后解决了日期、日期时间的问题
                if isinstance(value, datetime.date):
                    form_data[key] = form.data[key]

            # for test only
            ins = WorkFlowAPiRequest(username=self.request.user.username)
            status, state_result = ins.getdata(data=form_data,
                                               method='post',
                                               url='/api/v1.0/tickets')
            # if new_ticket_result:
            # code, data = 0, {'ticket_id': new_ticket_result}
            # else:
            # code, data = -1, {}
        return super().form_valid(form)
Example #13
0
    def get_form_class(self):
        form_fields = dict()
        ticket_id = self.kwargs.get('ticket_id')

        ins = WorkFlowAPiRequest(username=self.request.user.username)

        # 获取组建
        status, state_result = ins.getdata(
            parameters={},
            method='get',
            url='/api/v1.0/tickets/{0}'.format(ticket_id))

        state_result = state_result['data']['value']

        out_list = list()
        file_out_list = list()

        if isinstance(state_result,
                      dict) and 'field_list' in state_result.keys():

            class DynamicForm(forms.Form):
                def __init__(self, *args, **kwargs):
                    self.helper = FormHelper()
                    self.helper.form_class = 'form-horizontal'
                    self.helper.form_action = " "
                    self.helper.label_class = 'col-md-label'
                    self.helper.field_class = 'col-md-field'
                    # DictionaryField bug
                    self.helper.layout = Layout(*[
                        Div(field['field_key'], css_class='form-table-group')
                        for field in state_result['field_list']
                    ])
                    super(DynamicForm, self).__init__(*args, **kwargs)

            for field in state_result['field_list']:
                if field['field_key'] == 'title':
                    field['field_name'] = "项目名称"
                    field['description'] = None
                if field[
                        'field_key'] == 'b_guanliyuanshenpi_char_xiangmuliushuihao':
                    field['field_value'] = self.request.session[
                        "workflow_name"] + state_result["sn"]
                attributeFlag = field["field_attribute"]
                # 将控件的值提读出来
                field["default_value"] = field["field_value"]
                # 1只读,2必填,3选填
                # 创建时候,只有是必须填写或者选填的才进行渲染
                if attributeFlag == 1:
                    if field['field_type_id'] == 80:
                        #控件是文件类型,画面中生成<a>标签就可以
                        item = dict()
                        path = field['field_value']
                        if path == None:
                            continue
                        else:
                            mypath = "."
                            index = 0
                            contineFlag = 0
                            for file_path_part in path.split("/"):
                                if (contineFlag == 1
                                        or file_path_part == "media"):
                                    mypath += "/" + file_path_part
                                    contineFlag = 1
                                else:
                                    index += 1
                                    continue
                            file_orgin = path.split("/")[len(path.split("/")) -
                                                         1]
                            file_name = file_orgin.split("_")[2]
                            item['field_name'] = field["field_name"]
                            item[
                                'download_path'] = "/workflow/" + ticket_id + "/download_file?path=" + mypath
                            item['link_name'] = file_name
                            file_out_list.append(item)
                            continue
                    out_list.append(field)
                    Util.createWebDirex(field, forms, form_fields, User)
                # handle read only field
                if field['field_attribute'] == 1:
                    form_fields[field['field_key']].widget.attrs[
                        'disabled'] = 'disabled'
        else:
            raise Http404()

        state_result['field_list'] = out_list
        self.kwargs.update({'state_result': state_result})
        #file_out_list
        self.kwargs.update({'file_out_list': file_out_list})
        self.kwargs.update({'title': state_result["title"]})

        return type('DynamicItemsForm', (DynamicForm, ), form_fields)
Example #14
0
    def get_form_class(self):
        form_fields = dict()
        ticket_id = self.kwargs.get('ticket_id')

        ins = WorkFlowAPiRequest(username=self.request.user.username)

        #调用接口获取控件
        status, state_result = ins.getdata(
            parameters={},
            method='get',
            url='/api/v1.0/tickets/{0}'.format(ticket_id))
        #获取提交按钮
        status2, state_result2 = ins.getdata(
            parameters={},
            method='get',
            url='/api/v1.0/tickets/{0}/transitions'.format(
                self.kwargs.get('ticket_id')))

        state_result = state_result['data']['value']
        state_result2 = state_result2['data']['value']

        out_list = list()

        if isinstance(state_result,
                      dict) and 'field_list' in state_result.keys():

            class DynamicForm(forms.Form):
                def __init__(self, *args, **kwargs):
                    self.helper = FormHelper()
                    self.helper.form_class = 'form-horizontal'
                    self.helper.form_action = " "
                    self.helper.label_class = 'col-md-label'
                    self.helper.field_class = 'col-md-field'
                    # DictionaryField bug
                    self.helper.layout = Layout(*[
                        Div(field['field_key'], css_class='form-table-group')
                        for field in state_result['field_list']
                    ])
                    super(DynamicForm, self).__init__(*args, **kwargs)

            find_is_null = False
            j_shigongjindu_float_zonghengzumaosuo = ""
            j_shigongjindu_float_zongqiefengzhuankong = ""
            j_shigongjindu_float_zongbaopoliefeng = ""
            j_shigongjindu_float_muqianhengzumaosuo = ""
            j_shigongjindu_float_muqianqiefengzhuankong = ""
            j_shigongjindu_float_muqianbaopoliefeng = ""
            try:
                temWork = TempWork.objects.get(ticket_id=ticket_id)

                recode = eval(temWork.process_recod)

                j_shigongjindu_float_zonghengzumaosuo = recode[
                    "j_shigongjindu_float_zonghengzumaosuo"]
                j_shigongjindu_float_zongqiefengzhuankong = recode[
                    "j_shigongjindu_float_zongqiefengzhuankong"]
                j_shigongjindu_float_zongbaopoliefeng = recode[
                    "j_shigongjindu_float_zongbaopoliefeng"]

                j_shigongjindu_float_muqianhengzumaosuo = recode[
                    "j_shigongjindu_float_muqianhengzumaosuo"]
                j_shigongjindu_float_muqianqiefengzhuankong = recode[
                    "j_shigongjindu_float_muqianqiefengzhuankong"]
                j_shigongjindu_float_muqianbaopoliefeng = recode[
                    "j_shigongjindu_float_muqianbaopoliefeng"]

                find_is_null = True
            except TempWork.DoesNotExist:
                pass

            for field in state_result['field_list']:

                attributeFlag = field["field_attribute"]
                # 1只读,2必填,3选填
                #创建时候,只有是必须填写或者选填的才进行渲染  'field_key' (140598713991728) 'b_guanliyuanshenpi_char_xiangmuliushuihao'
                if attributeFlag != 1:
                    if field[
                            'field_key'] == 'b_guanliyuanshenpi_char_xiangmuliushuihao':
                        field['field_attribute'] = 3

                    if field[
                            'field_key'] == 'j_shigongjindu_float_zonghengzumaosuo':
                        field[
                            'default_value'] = j_shigongjindu_float_zonghengzumaosuo

                    if field[
                            'field_key'] == 'j_shigongjindu_float_zongqiefengzhuankong':
                        field[
                            'default_value'] = j_shigongjindu_float_zongqiefengzhuankong

                    if field[
                            'field_key'] == 'j_shigongjindu_float_zongbaopoliefeng':
                        field[
                            'default_value'] = j_shigongjindu_float_zongbaopoliefeng

                    if field[
                            'field_key'] == 'j_shigongjindu_float_muqianhengzumaosuo':
                        field[
                            'default_value'] = j_shigongjindu_float_muqianhengzumaosuo

                    if field[
                            'field_key'] == 'j_shigongjindu_float_muqianqiefengzhuankong':
                        field[
                            'default_value'] = j_shigongjindu_float_muqianqiefengzhuankong

                    if field[
                            'field_key'] == 'j_shigongjindu_float_muqianbaopoliefeng':
                        field[
                            'default_value'] = j_shigongjindu_float_muqianbaopoliefeng

                    if field[
                            'field_key'] == 'b_guanliyuanshenpi_char_xiangmubianhao':
                        try:
                            flowretion = TempFlowIdRelation.objects.get(
                                ticket_id=self.kwargs.get('ticket_id'))
                            field['default_value'] = flowretion.project_id
                        except:
                            pass

                    out_list.append(field)

                    Util.createWebDirex(field, forms, form_fields, User)
                # handle read only field
                # if field['field_attribute'] == 1:
                #     form_fields[field['field_key']
                #     ].widget.attrs['disabled'] = 'disabled'
        else:
            raise Http404()

        state_result['field_list'] = out_list
        self.kwargs.update({'state_result': state_result})
        self.kwargs.update({'title': state_result["title"]})
        self.kwargs.update({'state_result2': state_result2})
        if (len(state_result['field_list']) != 0):
            self.kwargs.update({'showSuggestion': 'true'})
        return type('DynamicItemsForm', (DynamicForm, ), form_fields)
Example #15
0
    def get(self, request):
        params = json.loads(dict(request.query_params)['dataArray'][0])
        per_page = int(params['pagesize'])
        page = int(params['page'])
        category = params['category']
        searchKey = params['searchKey']
        order = params['order']
        ins = WorkFlowAPiRequest(username=self.request.user.username)
        status, state_result = ins.getdata(parameters=dict(category=category,
                                                           per_page=per_page,
                                                           page=page,
                                                           title=searchKey),
                                           method='get',
                                           url='/api/v1.0/tickets')
        mytotal = 0
        status2, state_result2 = ins.getdata(parameters=dict(category=category,
                                                             per_page=10000000,
                                                             page=1,
                                                             title=searchKey),
                                             method='get',
                                             url='/api/v1.0/tickets')
        mytotal = len(state_result2['data']['value'])
        outlist = list()
        outlen = 0
        if status:
            if len(state_result) > 0 and isinstance(
                    state_result, dict) and 'data' in state_result.keys(
                    ) and 'value' in state_result['data'].keys():
                resultList = state_result['data']['value']
                for item in resultList:
                    flowid = item['workflow_info']['workflow_name'] + item['sn']
                    projectid = "等待指定"
                    try:
                        flowretion = TempFlowIdRelation.objects.get(
                            ticket_id=item['id'])
                        projectid = flowretion.project_id
                    except:
                        pass
                    title = item['title']
                    state_name = item['state']['state_name']
                    creator = item['creator']
                    gmt_created = item['gmt_created']
                    gmt_modified = item['gmt_modified']
                    id = item["id"]
                    workflow_name = item["workflow_info"]["workflow_name"]
                    a_href = "<a href='/workflow/ticket/{0}/?workflow_name={1}'>详情</a>".format(
                        id, workflow_name)
                    if item['state']['state_name'] == '施工进度':
                        a_href = a_href + (
                            "&nbsp;|&nbsp; <a href='/workflow/{}/tickeflowdetail'>进度</a> "
                            .format(id))
                    action = a_href

                    outdic = {
                        'flowid': flowid,
                        'projectid': projectid,
                        'title': title,
                        'state_name': state_name,
                        'creator': creator,
                        'gmt_created': gmt_created,
                        'gmt_modified': gmt_modified,
                        'action': action,
                    }
                    outlist.append(outdic)
        if order != "":
            sort_arr = str(order).split(",")
            if len(sort_arr) > 1:
                colum_str = str(sort_arr[0])

                if str(sort_arr[1]).upper() == "ASC":
                    outlist.sort(key=lambda x: (x.get(colum_str)),
                                 reverse=False)
                    outlen = len(outlist)
                else:
                    outlist.sort(key=lambda x: (x.get(colum_str)),
                                 reverse=True)
                    outlen = len(outlist)
        else:
            outlen = len(outlist)
        return Response({
            'code': 0,
            'msg': 'ok',
            'totalCount': outlen,
            'totalCounts': mytotal,
            'data': outlist,
        })
Example #16
0
 def get(self, request):
     ins = WorkFlowAPiRequest(username="******")
     status, state_result = ins.getdata(
         method='get', url='/api/v1.0/tickets/num_statistics')
     # print(state_result)
     return Response({'code': 0, 'msg': 'ok', 'data': state_result['data']})