Beispiel #1
0
def build_chart_bar(title: str, datas: dict):
    axis_x = [str2(key) for key in datas.keys()]
    axis_y = list(datas.values())
    chart = Bar()
    # 通用配置项都在add()中进行配置 具体见官网 http://pyecharts.org/#/
    chart.add(title, axis_x, axis_y, is_more_utils=True, xaxis_rotate=90)
    return chart
Beispiel #2
0
 def wctj_get_user(user_id):
     print('外出服务 %s,客户端(%s),获取用户名请求!参数:%s' %
           (cur_datetime(), request.remote_addr, user_id))
     sql = "SELECT YHMC FROM SS_OPERATE_USER WHERE YHDM='%s' AND XTSB='101'; " % user_id
     result = db.session.execute(sql).fetchone()
     if result:
         return ujson.dumps(str2(result[0]))
     else:
         abort(404)
Beispiel #3
0
 def wctj_get_dwmc():
     print('外出服务 %s,客户端(%s),获取单位信息请求!参数:无。' %
           (cur_datetime(), request.remote_addr))
     sql = "SELECT MC,DWBH FROM TJ_DWDMB WHERE sfwc='1' ; "
     results = db.session.execute(sql).fetchall()
     if results:
         return ujson.dumps(
             dict([(str2(result[0]), result[1]) for result in results]))
     else:
         abort(404)
Beispiel #4
0
 def wctj_validate_user(user_id, user_pd):
     sql1 = "SELECT YHMC FROM SS_OPERATE_USER WHERE YHDM='%s' AND YHKL='%s' AND XTSB='101'; " % (
         user_id, user_pd)
     sql2 = "SELECT KSBM FROM TJ_YGQSKS WHERE YGGH = '%s';" % user_id
     sql3 = "SELECT MC,DWBH,PYJM FROM TJ_DWDMB WHERE sfwc='1'; "
     result = db.session.execute(sql1).fetchone()
     if result:
         tmp = {}
         dwmc_bh = {}
         dwmc_py = {}
         results = db.session.execute(sql2).fetchall()
         tmp['ksbm'] = [i[0] for i in results]
         results = db.session.execute(sql3).fetchall()
         if results:
             for result in results:
                 dwmc_bh[result[1]] = str2(result[0])
                 dwmc_py[result[2].lower()] = str2(result[0])
         tmp['dwmc_bh'] = dwmc_bh
         tmp['dwmc_py'] = dwmc_py
         return ujson.dumps(tmp)
     else:
         abort(404)
Beispiel #5
0
def build_chart_pie(filename,title,datas):
    axis_x = [str2(key) for key in datas.keys()]
    axis_y = list(datas.values())
    pie = Pie(title,width=400,height=200,title_pos = 'center')
    pie.add(
            '',axis_x,axis_y,           #'':图例名(不使用图例)
            radius = [25,55],           #环形内外圆的半径
            is_label_show = True,       #是否显示标签
            label_text_color = None,    #标签颜色
            legend_orient = 'vertical', #图例垂直
            legend_pos = 'left',
            is_more_utils=False
            )
    pie.render(filename)
Beispiel #6
0
def build_chart_pie(title: str, datas: dict):
    axis_x = [str2(key) for key in datas.keys()]
    axis_y = list(datas.values())
    chart = Pie(title, title_pos='center')
    chart.add(
        '',
        axis_x,
        axis_y,  #'':图例名(不使用图例)
        radius=[25, 55],  #环形内外圆的半径
        is_label_show=True,  #是否显示标签
        label_text_color=None,  #标签颜色
        legend_orient='vertical',  #图例垂直
        legend_pos='left',
        is_more_utils=False)
    return chart
Beispiel #7
0
def get_user_info(tjbh, db):
    sql = "select XM,SFZH,SJHM FROM TJ_TJDAB WHERE DABH = (SELECT DABH FROM TJ_TJDJB where TJBH='%s') ;" % tjbh
    # print(sql)
    results = db.session.execute(sql).fetchall()
    if results:
        result = results[0]
        if all([result[1], result[2]]):
            return {
                'xm': str2(result[0]),
                'sfzh': result[1],
                'sjhm': result[2]
            }
        else:
            return {}
    else:
        return {}
Beispiel #8
0
 def update_version(platform, version):
     print(' %s:(%s)客户端(%s):版本更新请求!当前版本号:%s' %
           (cur_datetime(), platform, request.remote_addr, str(version)))
     if platform == 'win7':
         platform_name = '1'
     else:
         platform_name = '0'
     result = db.session.query(MT_TJ_UPDATE).filter(
         MT_TJ_UPDATE.version > version,
         MT_TJ_UPDATE.platform == platform_name).scalar()
     if result:
         return ujson.dumps({
             'version': result.version,
             'describe': str2(result.describe)
         })
     else:
         abort(404)
Beispiel #9
0
 def update_version2(platform, version):
     print(' %s:(%s)客户端(%s):版本更新请求!当前版本号:%s' %
           (cur_datetime(), platform, request.remote_addr, str(version)))
     # if platform == 'win7':
     #     platform_name = '1'
     # else:
     #     platform_name = '0'
     results = db.session.query(MT_TJ_UPDATE).filter(
         MT_TJ_UPDATE.version > version,
         MT_TJ_UPDATE.platform == None).order_by(
             MT_TJ_UPDATE.version.asc()).all()
     if results:
         result = results[0]
         return ujson.dumps({
             'version': result.version,
             'describe': str2(result.describe)
         })
     else:
         abort(404)