report.py 1.52 KB
Newer Older
pengxiong's avatar
pengxiong committed
1 2 3 4 5 6 7 8 9 10 11 12
# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name  : report.py
# @Time       : 2020/11/18 下午3:19
# @Author     : X. Peng
# @Email      : acepengxiong@163.com
# @Software   : PyCharm
# -----------------------------------------------------------------------------
import datetime
import time

from flask_restful import Resource, reqparse
pengxiong's avatar
pengxiong committed
13
from flask import request, render_template, g
pengxiong's avatar
pengxiong committed
14 15 16
from flask import make_response

from app.api.engine import config
pengxiong's avatar
pengxiong committed
17
from app.service.report_service import make_report
pengxiong's avatar
pengxiong committed
18
from app.utils.auth import login_require
pengxiong's avatar
pengxiong committed
19
from app.utils.html_to_pdf import html_to_pdf
pengxiong's avatar
pengxiong committed
20
from app.api.engine import pdf_folder, redis, env, TAMP_SQL, tamp_diagnose_app_engine
pengxiong's avatar
pengxiong committed
21 22 23 24 25 26 27 28 29 30
from app.utils.jinjia2html_v2 import DataIntegrate


class ReportHandlers(Resource):
    """."""

    def __init__(self):
        """."""
        self.parser = reqparse.RequestParser()

pengxiong's avatar
pengxiong committed
31
    @login_require
pengxiong's avatar
pengxiong committed
32 33 34 35
    def get(self):
        """."""
        self.parser.add_argument('customer_id', type=str, required=True, help='customer_id不能为空')
        args = self.parser.parse_args()
pengxiong's avatar
pengxiong committed
36
        args['ifa_id'] = g.ifa_id
pengxiong's avatar
pengxiong committed
37
        # 默认模版制作持仓报告
pengxiong's avatar
pengxiong committed
38 39
        data = make_report(args)

pengxiong's avatar
pengxiong committed
40 41
        resp = {
            "code": 0,
pengxiong's avatar
pengxiong committed
42
            "data": data,
pengxiong's avatar
pengxiong committed
43 44 45
            "lang": "zh_CN",
            "msg": "成功"
        }
wang zhengwei's avatar
wang zhengwei committed
46
        
pengxiong's avatar
pengxiong committed
47 48 49 50 51 52 53 54 55 56 57 58 59
        return resp

    def post(self):
        """."""
        pass

    def put(self, id):
        """."""
        pass

    def delete(self, id):
        """."""
        pass