コード例 #1
0
def set_msg_read(request, datakey):
    u = threadlocals.get_current_user()
    try:
        um = UsrMsg()
        um.user = u
        um.msg = InstantMsg.objects.filter(pk=datakey)[0]
        um.readtype = "1"
        um.save()
        return getJSResponse('{ Info:"OK" }')
    except:
        import traceback
        traceback.print_exc()
        return getJSResponse('{ Info:"exception!" }')
コード例 #2
0
def get_instant_msg(request):
    u = threadlocals.get_current_user()
    if u and u.is_anonymous():
        return getJSResponse(u"[]")
    d = {}
    qs = None
    [SYSMSG, ATTMSG, IACCESSMSG, PERSONNELMSG] = [1, 2, 3, 4]
    exclude_msgtype = []
    if "mysite.att" not in settings.INSTALLED_APPS:
        exclude_msgtype.append(ATTMSG)
    if "mysite.iaccess" not in settings.INSTALLED_APPS:
        exclude_msgtype.append(IACCESSMSG)

    msgtypes = MsgType.objects.exclude(pk__in=exclude_msgtype)
    dt = datetime.datetime.now()
    dt = datetime.datetime(year=dt.year, month=dt.month, day=dt.day)

    # 持续时间过滤条件
    querys = []
    for elem in msgtypes:
        begin_date = dt - datetime.timedelta(days=elem.msg_keep_time)
        querys.append((Q(change_time__gte=begin_date) & Q(msgtype=elem)))
    combine_query = querys[0]
    for i in querys[1:]:
        combine_query |= i

    # 不是超级管理员过滤条件
    if not u.is_superuser:
        ms = GroupMsg.objects.filter(group__user=u).values_list("msgtype")
        d["msgtype__in"] = ms

    # 是否已读过滤条件
    has_read = UsrMsg.objects.filter(user=u).values_list("msg")

    qs = InstantMsg.objects.filter(**d).exclude(id__in=has_read)
    qs = qs.filter(combine_query).order_by("-pk")

    json_data = {
        "fields": ["id", "msgtype", "content", "change_time"],
        "data": []
    }
    for ee in qs:
        json_data["data"].append([
            ee.id,
            u"%s" % ee.msgtype, ee.content,
            ee.change_time.strftime("%Y-%m-%d")
        ])

    return getJSResponse(json.dumps(json_data))
コード例 #3
0
ファイル: views.py プロジェクト: RockyLiys/erp
def select_city(request, app_label, model_name):
    from dbapp.datautils import QueryData
    from dbapp.modelutils import GetModel
    from dbapp.utils import getJSResponse
    import json
    from django.http import HttpResponseRedirect, HttpResponse
    from mysite.personnel.models.model_city import City
    from mysite.personnel.models.model_emp import format_pin

    ModelCls = GetModel(app_label, model_name)

    ret = []
    keys = [
        "state",
    ]
    filter_dict = {}
    qs = []
    for e in keys:
        value = request.REQUEST.get(e, None)
        if value:
            filter_dict[e] = value

    if filter_dict:
        qs = ModelCls.all_objects.filter(**filter_dict)
        for elem in qs:
            ret.append([elem.id, elem.city_code, elem.city_name])
    return getJSResponse(json.dumps(ret))
コード例 #4
0
ファイル: views.py プロジェクト: RockyLiys/erp
def funGetModelData(request, app_lable, model_name):
    from mysite.personnel.models.model_emp import format_pin
    from mysite.utils import get_option
    model = GetModel(app_lable, model_name)
    fields = request.REQUEST.get("fields", "")
    userid = request.REQUEST.get("userid", "")
    orgdept = request.REQUEST.get("orgdept", "")
    para = dict(request.REQUEST)
    where = {}
    for p in para:

        if p.find("__") > 0:
            t = p.split("__")

            if p.find("__range") > 0:
                where[str(p)] = eval(para[p])
            elif p.find("__in") > 0:
                where[str(p)] = para[p].split(",")
            else:
                where[str(p)] = para[p].decode("utf-8")

    #print where
    #print model
    if fields:
        fields = fields.split(",")
    if model:
        if userid:
            data = model.objects.filter(id__in=userid)
        else:
            data = model.objects.all()
        if where:
            data = model.objects.filter(Q(**where))
        if fields:
            data = data.values_list(*fields)
        #print data
        xdata = []
        i = 0
        while i < len(data):
            tmpdata = data[i]
            j = 0
            ndata = []
            while j < len(tmpdata):
                #print type(tmpdata[j])
                if type(tmpdata[j]) == datetime.time:
                    #print "1"
                    ndata.append(tmpdata[j].strftime("%H:%M:%S"))
                elif type(tmpdata[j]) == datetime.date:
                    ndata.append(tmpdata[j].strftime("%Y-%m-%d"))
                else:
                    ndata.append(tmpdata[j])
                j += 1
            xdata.append(ndata)
            i += 1
        #print xdata
        if orgdept:
            xdata = processdept(xdata)
        return getJSResponse(smart_str(dumps(xdata)))
    else:
        return NoFound404Response(request)
コード例 #5
0
ファイル: views.py プロジェクト: RockyLiys/erp
def getDevInfo(request):
    device_type = request.REQUEST.get("device_type", "")
    if not device_type:
        device_type = DEVICE_TIME_RECORDER
    devs = Device.objects.filter(device_type__exact=device_type)
    devs_list = [[dev.sn, dev.alias, dev.ipaddress] for dev in devs]
    ret = {}
    ret["data"] = devs_list
    return getJSResponse(smart_str(dumps(ret)))
コード例 #6
0
def GridView(request, grid_model, **arg):
    m_grid = grid_model.grid
    grid_model.SetPageSize(arg['psize'])
    grid_model.MakeData(request, **arg)
    grid_model.grid.ParseArg(**arg)
    if not grid_model._paged:
        grid_model.Paging(arg['offset'])
    ret = m_grid.ResultDic()
    return getJSResponse(smart_str(dumps(ret)))
コード例 #7
0
ファイル: base_code.py プロジェクト: RockyLiys/erp
def get_category(request):
    # qs = BaseCode.objects.filter(parent__isnull=True).values_list("id", "content")
    qs = BaseCode.objects.distinct().values_list("content")
    data = []
    for o in qs:
        l = list(o)
        l.append(_(u"%(name)s") % {'name': _(o[0])})
        data.append(l)
    return getJSResponse(smart_str(dumps(data)))
コード例 #8
0
ファイル: views.py プロジェクト: RockyLiys/erp
def get_card_info(request):
    from mysite.personnel.models.model_issuecard import IssueCard, CARD_VALID, PRIVAGE_CARD, POS_CARD, CARD_STOP, CARD_OVERDUE
    from mysite.personnel.models.model_emp import get_dept
    from mysite.personnel.models.model_emp import getuserinfo
    from django.utils import simplejson
    card_no = request.REQUEST.get("cardno", "")
    try:
        if get_option("POS_IC"):
            type = request.REQUEST.get("type", "")
            if type == "issuing":  #发卡 检测卡片已登记人员
                card_obj = IssueCard.objects.get(cardno=card_no,
                                                 cardstatus=CARD_VALID)
            else:
                card_obj = IssueCard.objects.get(sys_card_no=card_no)
        else:
            card_obj = IssueCard.objects.get(cardno=card_no)
        dept_name = get_dept(card_obj.UserID_id).name
        user_pin = getuserinfo(card_obj.UserID_id, "PIN")
        user_name = getuserinfo(card_obj.UserID_id, "EName")
        if get_option("POS_IC"):
            return getJSResponse(
                smart_str(
                    simplejson.dumps({
                        'ret': 1,
                        'user_pin': user_pin,
                        'user_name': user_name,
                        'dept_name': dept_name,
                        'blance': str(card_obj.blance),
                        'cardstatus': card_obj.cardstatus,
                        'sys_card_no': card_obj.sys_card_no
                    })))
        else:
            return getJSResponse(
                smart_str(
                    simplejson.dumps({
                        'ret': 1,
                        'user_pin': user_pin,
                        'user_name': user_name,
                        'dept_name': dept_name,
                        'blance': str(card_obj.blance),
                        'cardstatus': card_obj.cardstatus
                    })))
    except:
        return getJSResponse(smart_str(simplejson.dumps({'ret': -1})))
コード例 #9
0
ファイル: views.py プロジェクト: RockyLiys/erp
def getchange(request):
    from mysite.personnel.models import Employee
    id = request.GET.get("k")
    u = Employee.objects.get(pk=id)
    data = {}
    if u:
        data['dept'] = int(u.DeptID_id)
        data['position'] = u.position.pk
        data['hiretype'] = u.emptype and str(u.emptype) or 1
        data['attarea'] = [int(i.pk) for i in u.attarea.all()]
    return getJSResponse(smart_str(data))
コード例 #10
0
ファイル: views.py プロジェクト: RockyLiys/erp
def get_dept_tree_data(request):
    selected = request.REQUEST.getlist("K")
    selected = [int(item) for item in selected]
    level = request.REQUEST.get("LEVEL", "1")
    root = request.REQUEST.get("root", "1")
    try:
        root = int(root)
    except:
        root = None
        if level == '1': level = 2
    from models import depttree
    html = depttree.DeptTree(Department.objects.all()).html_jtree(
        selected, root_id=root, next_level=int(level))
    return getJSResponse(html)
コード例 #11
0
ファイル: views.py プロジェクト: RockyLiys/erp
def select_position(request, app_label, model_name):
    from dbapp.datautils import QueryData
    from dbapp.modelutils import GetModel
    from dbapp.utils import getJSResponse
    import json
    from django.http import HttpResponseRedirect, HttpResponse
    from mysite.personnel.models.model_position import Position
    from mysite.personnel.models.model_emp import format_pin

    ModelCls = GetModel(app_label, model_name)

    ret = []
    #    keys = ["DeptID",]
    filter_dict = {}
    qs = []
    #    print "request",request.REQUEST.get("newdept")
    #    for e in keys:
    #        value = request.REQUEST.get(e,None)
    #        print "------------------",value
    #        if value:
    #            filter_dict[e] = value
    #    if not filter_dict:
    #        newdept=request.REQUEST.get("newdept",None)
    #        filter_dict['DeptID'] = newdept
    dept_id = request.REQUEST.get("DeptID", None)
    new_dept = request.REQUEST.get("newdept", None)
    department = request.REQUEST.get("department", None)
    if dept_id:
        filter_dict["DeptID"] = dept_id
    if new_dept:
        filter_dict["DeptID"] = new_dept
    if department:
        filter_dict["DeptID"] = department
#    print "++++++++++++++++",filter_dict
    if filter_dict:
        qs = ModelCls.all_objects.filter(**filter_dict)
        for elem in qs:
            ret.append([elem.id, elem.code, elem.name])


#    print "=====================",ret
    return getJSResponse(json.dumps(ret))
コード例 #12
0
ファイル: clean_data.py プロジェクト: RockyLiys/erp
def get_html_data(request):
    u"默认删除七天以前的记录,不能删除七天以内的数据"

    request.dbapp_url = dbapp_url
    apps = get_all_app_and_models()
    dt_now = datetime.datetime.now()
    default_date = dt_now - datetime.timedelta(days=7)

    if request.method == "GET":
        return render_to_response('worktable_DeleteData.html',
                                  RequestContext(request, {
                                      'dbapp_url': dbapp_url,
                                      'MEDIA_URL': MEDIA_ROOT,
                                      "current_app": 'base',
                                      'apps': apps,
                                      'before_date': default_date.strftime("%Y-%m-%d"),
                                      "help_model_name": "DeleteData",
                                      "myapp": [a for a in apps if a[0] == "base"][0][1],
                                      'app_label': 'worktable',
                                      'model_name': 'Device',
                                      'menu_focus': 'DeleteData',
                                      'position': _(u'系统设置->临时数据清理'),
                                  })

                                  )
    else:
        post_date = request.POST.get("before_date", None)
        before_date = default_date
        info = []
        if post_date:
            try:
                before_date = datetime.datetime.strptime(post_date, "%Y-%m-%d")
            except:
                info.append(u"%s" % _(u"时间转化错误,清除失败,请确认日期输入正确!"))

        if (dt_now - before_date).days < 7:
            info.append(u"%s" % _(u"不能删除7天之内的数据"))

        if not info:  # 没有错误
            # print 'post:%s\n'%request.POST
            dict_map_data = [
                ["clear_log", delete_action_log],
                ["clear_upload_dir", delete_upload_dirs],
                ["fqueue_file", delete_fqueue_file],
                ["clear_devcmd_bak", delete_devcmd_bak],
                ["clear_operate_cmds", delete_operate_cmds],
                ["clear_tmp_dir", delete_temp_dirs],
                ["clear_session", delete_session_data],
            ]
            dict_map_verbose = {
                "clear_log": u"%s" % _(u"清理日志记录"),
                "clear_upload_dir": u"%s" % _(u"清理机器上传的过期文件夹"),
                "fqueue_file": u"%s" % _(u"清理文件缓存"),
                "clear_devcmd_bak": u"%s" % _(u"清理失败命令"),
                "clear_operate_cmds": u"%s" % _(u"清理通讯命令日志"),
                "clear_tmp_dir": u"%s" % _(u"清理临时文件夹"),
                "clear_session": u"%s" % _(u"清理用户会话记录"),
            }
            for k, process_key in dict_map_data:
                value = request.POST.get(k, None)
                if value:
                    # print 'delete %s\n'%k
                    days = (dt_now - before_date).days
                    ret = dict_map_verbose[k] + ":"
                    try:
                        if days > 0:
                            ret += u"%s" % process_key(days)
                    except Exception as e:
                        # import traceback;traceback.print_exc()
                        ret += u"%s" % e

                    info.append(ret)

        return getJSResponse(json.dumps(info))  # 返回处理结果
コード例 #13
0
ファイル: views.py プロジェクト: RockyLiys/erp
def get_children_nodes(request):
    from django.db import models
    from dbapp.datautils import filterdata_by_user
    from mysite.personnel.models.depttree import DeptTree
    from base.middleware import threadlocals
    import json
    from mysite.iclock.iutils import get_max_in
    limit = request.REQUEST.get("limit")
    multiple = request.REQUEST.get("multiple")  #是否多选
    async_checked = request.REQUEST.get("checked")  #当前异步节点是否选中
    edit_object_id = request.REQUEST.get(
        "edit_object_id"
    )  #当前编辑的对象,如人员ID,如果是树形控件本身对象,可能需要按照这个iD进行过滤limit_to_parent
    checked_ids = request.REQUEST.get("checked_ids")  #需要选中的记录
    async_id = request.REQUEST.get("id")  #异步加载的ID
    has_checked_nodes = request.REQUEST.get("has_checked_nodes")  #前端是否有选中的记录
    select_childrens = request.REQUEST.get("select_childrens", None)  #是否选择下级

    app_label, model_name = request.REQUEST.get("async_model").split("__")
    TreeModel = GetModel(app_label, model_name)  #当前模型对象

    obj_tree = None
    async_obj = None
    try:
        if edit_object_id != "" and limit == "true":
            try:
                obj_tree = TreeModel.objects.get(
                    pk=edit_object_id)  #当前树形控件选中的记录
            except:
                pass
        async_obj = TreeModel.objects.get(pk=async_id)
    except:
        pass
    m_id = "id"
    m_p = "parent_id"
    m_n = "name"
    s_id = "dept_id"
    r_m = "deptadmin"
    sup_name = "supdeptid"
    if TreeModel.__name__ == "Department":
        m_id = "id"
        m_p = "parent_id"
        m_n = "name"
        s_id = "dept_id"
        r_m = "deptadmin"
        sup_name = "supdeptid"
    elif TreeModel.__name__ == "Area":
        m_id = "id"
        m_p = "parent_id"
        m_n = "areaname"
        s_id = "area_id"
        r_m = "areaadmin"
        sup_name = "parent_id"

    #新增的时候不需要限制
    uobj = threadlocals.get_current_user()
    vdata = TreeModel.objects.all().order_by(m_n)
    if obj_tree and hasattr(obj_tree, "limit_parent_to"):
        vdata = obj_tree.limit_parent_to(vdata)
    else:
        vdata = filterdata_by_user(vdata, uobj)
    async_fields = [m_id, m_p, m_n]
    if not uobj.is_superuser:  #不是超级管理员
        select = "select  distinct %s from %s where user_id=%s and %s.%s=%s" % (
            s_id, r_m, request.user.pk, TreeModel._meta.db_table, sup_name,
            s_id)
        #print "select",select
        vdata = vdata.extra(select={m_p: select})
    vdata = list(vdata.values(*async_fields))
    checked = False
    checked_objs = None

    if multiple == "true" \
        and async_checked == "true" \
        and select_childrens == "true": #多选,并且该节点选中了,包含下级选中了
        checked = True
    elif multiple == "false" and has_checked_nodes == "true":  #单选,前端已经选中了节点,后端就不要传选中的记录了。
        checked = False
    else:  #选中本来应该有关联的数据
        if checked_ids:
            checked_ids = checked_ids.split(",")
            qs = TreeModel.objects.all()
            checked_objs = get_max_in(qs, checked_ids, "pk__in")
    children = []
    for e in vdata:
        tmp_data = {}
        if e[m_p] == async_obj.id:
            tmp_data = {
                "id": e[m_id],
                "pId": e[m_p],
                "name": e[m_n],
                "isParent": False,
                "checked": checked
            }
            if checked_objs:
                for ce in checked_objs:
                    if e[m_id] == ce.pk:
                        tmp_data["checked"] = True
            for ee in vdata:
                if ee[m_p] == e[m_id]:
                    tmp_data["isParent"] = True
                    break
        if tmp_data:
            children.append(tmp_data)

    return getJSResponse(json.dumps(children))
コード例 #14
0
def outputEmpStructureImage(request):
    type = request.GET.get("t", "1")
    try:
        if type == "1":
            qs = list(Employee_objects(request).filter(Hiredday__isnull=False))
            if len(qs) == 0:
                return getJSResponse(json.dumps([]))
            curr_dt = datetime.datetime.now()
            curr_date = datetime.date(curr_dt.year, curr_dt.month, curr_dt.day)
            ten_years = 0
            eight_years = 0
            five_years = 0
            three_years = 0
            two_years = 0
            one_years = 0
            for e in qs:
                hire_date = datetime.date(e.Hiredday.year, e.Hiredday.month,
                                          e.Hiredday.day)
                if (curr_date - hire_date).days >= 365 * 10:
                    ten_years += 1
                elif (curr_date - hire_date).days >= 365 * 8:
                    eight_years += 1
                elif (curr_date - hire_date).days >= 365 * 5:
                    five_years += 1
                elif (curr_date - hire_date).days >= 365 * 3:
                    three_years += 1
                elif (curr_date - hire_date).days >= 365 * 2:
                    two_years += 1
                elif (curr_date - hire_date).days < 365 * 2:
                    one_years += 1
            if not qs:
                one_years = 100
            data = [{
                "label": _(u'十年 ') + str(ten_years),
                "data": [[0, ten_years]]
            }, {
                "label": _(u'八年 ') + str(eight_years),
                "data": [[0, eight_years]]
            }, {
                "label": _(u'五年 ') + str(five_years),
                "data": [[0, five_years]]
            }, {
                "label": _(u'三年 ') + str(three_years),
                "data": [[0, three_years]]
            }, {
                "label": _(u'两年 ') + str(two_years),
                "data": [[0, two_years]]
            }, {
                "label": _(u'一年 ') + str(one_years),
                "data": [[0, one_years]]
            }]

        elif type == "2":
            qs = list(Employee_objects(request).filter(Gender__isnull=False))
            if len(qs) == 0:
                return getJSResponse(json.dumps([]))
            males = len(filter(lambda e: e.Gender == "M", qs))
            females = len(filter(lambda e: e.Gender == "F", qs))
            if not males and not females:
                return getJSResponse(json.dumps([]))
            data = [{
                "label": _(u'男 ') + str(males),
                "data": [[0, males]]
            }, {
                "label": _(u'女 ') + str(females),
                "data": [[0, females]]
            }]
        elif type == "3":
            emCounts = Employee_objects(request).count()
            qs = list(
                Employee_objects(request).filter(education__isnull=False))
            if emCounts == 0:
                return getJSResponse(json.dumps([]))
            t0 = len(filter(lambda e: e.education_id == 1, qs))
            t1 = len(filter(lambda e: e.education_id == 2, qs))
            t2 = len(filter(lambda e: e.education_id == 3, qs))
            t3 = len(filter(lambda e: e.education_id == 8, qs))
            t4 = len(filter(lambda e: e.education_id == 9, qs))
            t5 = len(filter(lambda e: e.education_id == 10, qs))
            t6 = emCounts - t0 - t1 - t2 - t3 - t4 - t5
            data = [{
                "label": u"%s" % _(u'小学 ') + str(t0),
                "data": [[0, t0]]
            }, {
                "label": u"%s" % _(u'初中 ') + str(t1),
                "data": [[0, t1]]
            }, {
                "label": u"%s" % _(u'普通高中 ') + str(t2),
                "data": [[0, t2]]
            }, {
                "label": u"%s" % _(u'本科 ') + str(t3),
                "data": [[0, t3]]
            }, {
                "label": u"%s" % _(u'硕士研究生 ') + str(t4),
                "data": [[0, t4]]
            }, {
                "label": u"%s" % _(u'博士研究生 ') + str(t5),
                "data": [[0, t5]]
            }, {
                "label": u"%s" % _(u'其他 ') + str(t6),
                "data": [[0, t6]]
            }]
        data.sort(lambda x1, x2: x1["data"][0][1] - x2["data"][0][1])
        return getJSResponse(json.dumps(data))
    except:
        import traceback
        traceback.print_exc()
    finally:
        pass
    return getJSResponse(json.dumps([]))
コード例 #15
0
def outputattrate(request):
    json_data = []
    try:

        emCounts = Employee_objects(request).count()
        if emCounts == 0:
            return getJSResponse(json.dumps([]))
        curr_dt = datetime.datetime.now()
        d1 = datetime.datetime(curr_dt.year, curr_dt.month, curr_dt.day, 0, 0,
                               1)
        d2 = datetime.datetime(curr_dt.year, curr_dt.month, curr_dt.day, 23,
                               59, 59)
        d3 = datetime.datetime(curr_dt.year, curr_dt.month, curr_dt.day)
        sql_emps_count = """
           select count(1) from userinfo u where u.isatt = 1 and  u.status = 0
       """
        sql_trans_emps = """
           select count(1) from
           (select distinct u.userid from checkinout c
            inner join userinfo u on u.badgenumber = c.pin
            where u.isatt = 1 and u.status = 0
                and c.checktime between '%s' and '%s') as t
       """ % (d1, d2)
        sql_spe_cont = """
             select count(1) from 
                (select distinct u.userid from  user_speday us
                  inner  join userinfo u on us.UserID = u.userid
                where u.isatt = 1 and u.status=0
                and us.EndSpecDay >= '%s'
                and us.StartSpecDay <= '%s') as t
       """ % (d1, d2)

        emps_att_count = p_query(sql_emps_count)[0][0]
        qs_atts_emp = p_query(sql_trans_emps)[0][0]
        specialDays_count = p_query(sql_spe_cont)[0][0]
        absents = emps_att_count - qs_atts_emp - specialDays_count
        #       qs_atts_emp=Transaction.objects.select_related().filter(TTime__range=(d1,d2),UserID__isatt=True).distinct().values("UserID__PIN").values_list("UserID")
        # atts = Transaction.objects.select_related().filter(TTime__range=(d1,d2),UserID__isatt=True).distinct().values("UserID__PIN").count()
        #       atts,cl=QueryData(request,Transaction,None,qs_atts_emp)
        #       atts=atts.count()
        #
        #       specialDays = EmpSpecDay.objects.select_related() \
        #                    .filter(Q(end__gte=d3,start__lte=d3)
        #                            |Q(start__year=d3.year,start__month=d3.month,start__day=d3.day)
        #                            |Q(end__year=d3.year,end__month=d3.month,end__day=d3.day)
        #                        ) \
        #                    .exclude(emp__in=qs_atts_emp)
        #       specialDays,cl=QueryData(request,EmpSpecDay,None,specialDays)
        #
        #       specialDays=specialDays.distinct().values("emp__PIN").count()
        #       emps,cl=QueryData(request,EmpSpecDay,None,Employee_objects(request).filter(isatt='1'))
        #       absents= emps.count() -atts - specialDays
        json_data.append({
            "label": u"%s" % _(u'签到 ') + str(qs_atts_emp),
            "data": [[20, qs_atts_emp]]
        })
        json_data.append({
            "label": u"%s" % _(u'其他 ') + str(absents),
            "data": [[20, absents]]
        })
        json_data.append({
            "label": u"%s" % _(u'请假 ') + str(specialDays_count),
            "data": [[20, specialDays_count]]
        })

        json_data.sort(lambda x1, x2: x1["data"][0][1] - x2["data"][0][1])
        return getJSResponse(json.dumps(json_data))
    except:
        import traceback
        traceback.print_exc()
    finally:
        pass
    return getJSResponse(json.dumps([]))