# -*- 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 json
import time
import uuid

import oss2
from flask_restful import Resource, reqparse
from flask import request, render_template, g
from app.service.folio_comment_service import recalculation_fund_comment
from app.utils.auth import login_require
from app.utils.format_transfer import npEncoder


class UpdateReportHandlers(Resource):
    """."""

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

    @login_require
    def post(self):
        """保存报告."""
        self.parser.add_argument('folio', type=str, required=False, help='组合名称')
        self.parser.add_argument('customer_id', type=str, required=True, help='customer_id不能为空')
        self.parser.add_argument('suggest_data', type=str, required=True, help='组合建议数据')
        args = self.parser.parse_args()
        # print(args)
        args['ifa_id'] = g.ifa_id
        data = recalculation_fund_comment(args)
        if data is False:
            resq = {
                "statusCode": "8888",
                "message": "内部错误",
                "attributes": data
            }
            return resq
        resp = {
            "statusCode": "0000",
            "message": "成功",
            "attributes": data
        }
        return resp

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


