#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/7/8 2:41 PM
# @Author : ouy
# @File : approval_flow.py
import datetime
import logging
import requests
from flask import current_app
from app import db
from app.models import ApprovalInfo, SystemInfo
from app.tasks.meta import tasks
from app.utilities.some_func import time_convert
from app.constants import APPROVAL_START_URL, APPROVAL_CALLBACK_URL, APPROVAL_FLOW_USER_NAME, APPROVAL_FLOW_USER_ID
def apply_approval(system=None, apply_id=-1, applicant='', detail=''):
"""
发起审批流
审批系统:https://ws-di1.sit.cmrh.com/RH_GOA
用户: yuanyl001 密码: cmft2018
"""
# 处理变量
apply_type = dict(zip((0, 1, 2, 3), ("新增系统", "删除系统", "上线系统", "下线系统")))[apply_id]
apply_time = time_convert('str')
# 构建表单
th = ("系统名", "类别", "申请人", "申请时间", "详情")
th = '
\n' + '\n'.join([' {}'.format(t) for t in th]) + "\n" + ' \n'td = (system.system_name, apply_type, applicant, apply_time, detail)
td = '
\n' + '\n'.join([' {}'.format(t) for t in td]) + "\n" + ' \n'table = '
'# print(table)
# 发起审批流
data = {
"title": '源系统信息管理',
"content": table,<