欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Jumpserver賬單模塊開發(fā)-創(chuàng)新互聯(lián)

一、由于jumpserver的CMDB系統(tǒng)無法滿足要求,所以另外自行開發(fā)模塊統(tǒng)計云賬單的頁面。功能如下:
?
1、實現(xiàn)賬單自動下載
2、分析過濾并且錄入到數(shù)據(jù)庫中
3、展示頁面
?

憑借整站使用成都h5網(wǎng)站建設(shè)的創(chuàng)新體驗、定制設(shè)計、設(shè)計團隊積累與透明式的服務(wù)過程,符合行業(yè)特點,專屬顧問根據(jù)企業(yè)產(chǎn)品,消費群體屬性,準確定位;設(shè)計師以目標客戶為中心,以突出品牌官網(wǎng)特性為宗旨,定制專屬網(wǎng)站建設(shè)設(shè)計方案。

jumpserver使用的是django框架,控制器代碼如下:

#coding:utf-8
from django.db.models import Q
from jumpserver.api import *
from jumpserver.models import Setting
from django.http import HttpResponse,StreamingHttpResponse
from django.shortcuts import render,render_to_response
from jcloud.aws_iam_scan import *
from jcloud.aws_service_san import *
from jcloud.forms import Aws_monitor_userForm
from jcloud.models import *
import json
import django.utils.timezone as timezone
import time
from datetime import date, timedelta
import boto3
import zipfile
import zlib
import os
import csv
import codecs
import re
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import smtplib
from email.mime.text import MIMEText
from email.header import Header
from django.template import loader
from pprint import pprint

def bill_download(): #賬單下載

    def bill_detail_indb(file,profile_name,location,account_tag,vol_item,vol_price):#定義下載和入庫
        dictres = {}
        session = boto3.Session(profile_name=profile_name)
        s3 = session.client("s3")#初始化aws s3鏈接
        ttime = (datetime.datetime.now() + datetime.timedelta(days=-4)).strftime('%m')
        file = file + ttime + '.csv'
        zfile = file + '.zip'
        s3.download_file(location, zfile,zfile) #下載數(shù)據(jù)文件
        print 'over download'
        zipfile.ZipFile(zfile).extractall() #解壓文件
       with codecs.open(file,'r','utf-8') as f:便利csv數(shù)據(jù)文件
            reader = csv.reader(f)
            head_row = next(reader)
                        #過濾無效數(shù)據(jù)并將結(jié)果添加到dlist列表
            for row in reader:
                if re.match(r'This line contains',row[vol_item]) or re.match(r'Total',row[vol_item]) or re.search(ur"[\u4e00-\u9fa5]+",unicode(row[vol_item], "utf-8")) or not row[vol_item] or not row[vol_price]:
                    continue
                else:
                    tp = float(row[vol_price])
                if row[vol_item] in dictres.keys():
                    dictres[row[vol_item]] = dictres[row[vol_item]] + tp
                else:
                    dictres[row[vol_item]] = tp

        dlist = [] #初始化需要寫入DB的數(shù)據(jù)列表
        for n in dictres:
            dlist.append(Aws_detail_price(account_tag=account_tag,service_id=str(n),aws_price=("%.2f" % (dictres[n]))))
        res = Aws_detail_price.objects.bulk_create(dlist)

        files = [['644201129899-aws-billing-detailed-line-items-with-resources-and-tags-2017-','adminstrator-tokyo','ptmind-en-bill',1,19,18],
            ['246056064096-aws-billing-detailed-line-items-with-resources-and-tags-ACTS-2017-','ptmind-beijing','ptmind-cn-bill',2,21,20]
    ]

        for item in files:#循環(huán)賬單列表
        bill_detail_indb(item[0],item[1],item[2],item[3],item[4],item[5])

def aws_bill(request):
    aws_bill = Aws_bill.objects.all() #查詢賬單明細
    aws_account = Aws_account.objects.all() #統(tǒng)計賬戶數(shù)量
    res = []
    for i in aws_account:
        tprice = 0;
        ares2 = []
        ares = []
        for price in aws_bill:
            if int(i.aws_account_id) is int(price.aws_account_id):
                pres = []
                #篩選有價格的
                if float(price.aws_price) > 0:
                    pres.append(price.aws_service)
                    pres.append(price.aws_price)
                    ares.append(pres)
                    tprice = tprice + float(price.aws_price)
        ares2.append(i.aws_account)
        ares2.append(tprice)
        ares2.append(ares)
        res.append(ares2)
    return my_render('jcloud/aws_bill.html', locals(), request)

展示頁面靜態(tài)文件內(nèi)容如下:

{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
<style type="text/css">
#定義內(nèi)容展示寬度以及位置
#content{
    margin: 20px auto;
    height: 3600px;
   width: 1200px;
}

.tables{
    margin: 20px auto;
}
#定義每個跳的距離和浮動橫列顯示
.t1{
    margin: 0 0 0 100px;
    float: left;
    max-width: 500px;
    display: block;
    background: white;
}

.title_top{
    font-size: 26px;
    text-align: center;
    color: black;
    height: 50px;
    line-height: 50px;
}
.price_bottom{
    margin: 0 auto;
    text-align: right;
    font-size: 20px;
    color: black;
    height: 70px;
    line-height: 70px;
}

.t1 td{
    margin: 20px auto;
   width: 950px;
    font-size: 18px;
    line-height: 30px;
    text-indent: 20px;
}
.t1 td:last-child{
   width: 50px;
    text-align: right;
}
.t1 hr{
    margin: 5px auto;
    border-bottom: 2px solid black !important;
}
</style>

<div id = "content" >
        {% for a in res %}
            <div class="tables">
                {% if a.0 == 'China:ptmind' %}#區(qū)分人民幣與美元
                    <table id = {{ a.0 }} class = "t1">
                        <head>
                            <tr>
                                <th colspan="2"><p class="title_top">{{ a.0 }}</p><hr /></th>                            
                            </tr>
                        </head>               
                            {% for b in a.2 %}#遍歷結(jié)果并且展示內(nèi)容
                            <tr>
                               <td>{{ b.0 }}</td>
                               <td>{{ b.1 }}</td>
                            </tr>
                            {% endfor %}
                            <tr>                            
                                <th colspan="2"><hr /><p class="price_bottom">Total Price:¥{{ a.1 }}</p></th>                            
                            </tr>                    
                    </table>
                {% else %}
                    <table id = {{ a.0 }} class = "t1">
                        <head>
                            <tr>
                                <th colspan="2"><p class="title_top">{{ a.0 }}</p><hr /></th>                            
                            </tr>
                        </head>               
                            {% for b in a.2 %}
                            <tr>
                               <td>{{ b.0 }}</td>
                               <td>{{ b.1 }}</td>
                            </tr>
                            {% endfor %}
                            <tr>                            
                                <th colspan="2"><hr /><p class="price_bottom">Total Price:${{ a.1 }}</p></th>                            
                            </tr>                    
                    </table>

                {% endif %}
            </div>
        {% endfor %}
</div>

{% endblock %}

具體頁面展示如下:
Jumpserver 賬單模塊開發(fā)

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

網(wǎng)頁題目:Jumpserver賬單模塊開發(fā)-創(chuàng)新互聯(lián)
分享地址:http://chinadenli.net/article2/epgoc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、企業(yè)網(wǎng)站制作網(wǎng)站收錄、自適應(yīng)網(wǎng)站、微信小程序、關(guān)鍵詞優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)
女人精品内射国产99| 国产午夜精品美女露脸视频| 熟女一区二区三区国产| 欧美日韩综合综合久久久| 日韩成人高清免费在线| 精品国产品国语在线不卡| 在线亚洲成人中文字幕高清| 91欧美亚洲精品在线观看| 国产av精品一区二区| 99久久免费中文字幕| 91午夜少妇极品福利| 老司机精品视频在线免费看| 亚洲av又爽又色又色| 国产一区二区三区四区中文| 日韩精品人妻少妇一区二区| 熟女少妇一区二区三区蜜桃| 青青草草免费在线视频| 免费午夜福利不卡片在线 视频| 国产欧美高清精品一区| 久久国产亚洲精品成人| 国产目拍亚洲精品区一区| 日韩专区欧美中文字幕| 亚洲精品中文字幕一二三| 黄片免费播放一区二区| 久久少妇诱惑免费视频| 扒开腿狂躁女人爽出白浆av| 免费观看潮喷到高潮大叫| 激情国产白嫩美女在线观看| 国产精品久久精品国产| 中文字幕中文字幕一区二区| 天海翼高清二区三区在线| 国产精品午夜性色视频| 欧美亚洲91在线视频| 午夜精品黄片在线播放| 国产欧美日韩综合精品二区| 日韩高清毛片免费观看| 国产欧美亚洲精品自拍| 韩国激情野战视频在线播放| 久久re6热在线视频| 欧美人妻盗摄日韩偷拍| 一区二区三区四区亚洲另类|