income

package
v0.0.0-...-83adff0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Div

func Div(x, y float64) float64

Div div

func DivWithRound

func DivWithRound(x, y float64, places int) float64

DivWithRound div with round

func Mul

func Mul(x, y float64) float64

Mul mul

func MulWithRound

func MulWithRound(x, y float64, places int) float64

MulWithRound mul with round

func Round

func Round(val float64, places int) float64

Round round

func Tax

func Tax(income float64) (tax float64)

Tax tax

Types

type AvChargeSvr

type AvChargeSvr struct {
	// contains filtered or unexported fields
}

AvChargeSvr av charge service

func NewAvChargeSvr

func NewAvChargeSvr(dao *incomeD.Dao) (svr *AvChargeSvr)

NewAvChargeSvr new av charge service

func (*AvChargeSvr) AvChargeDBStore

func (s *AvChargeSvr) AvChargeDBStore(c context.Context, weeklyChargeMap, monthlyChargeMap map[int64]*model.AvCharge) (err error)

AvChargeDBStore av charge db store

func (*AvChargeSvr) AvChargeStatisDBStore

func (s *AvChargeSvr) AvChargeStatisDBStore(c context.Context, chargeStatisMap map[int64]*model.AvChargeStatis) error

AvChargeStatisDBStore store charge statis

func (*AvChargeSvr) AvCharges

func (s *AvChargeSvr) AvCharges(c context.Context, date time.Time, ch chan []*model.AvCharge, bubbleRatio map[int64]float64) (err error)

AvCharges get av charges

func (*AvChargeSvr) CalAvCharge

func (s *AvChargeSvr) CalAvCharge(date time.Time, weeklyChargeMap, monthlyChargeMap map[int64]*model.AvCharge, chargeStatisMap map[int64]*model.AvChargeStatis, dailyChannel chan []*model.AvCharge)

CalAvCharge cal av charge

func (*AvChargeSvr) CalAvChargeStatis

func (s *AvChargeSvr) CalAvChargeStatis(dailyCharge *model.AvCharge, chargeStatisMap map[int64]*model.AvChargeStatis)

CalAvChargeStatis cal av charge statis

func (*AvChargeSvr) GetAvCharge

func (s *AvChargeSvr) GetAvCharge(c context.Context, date time.Time, fn dao.IAvCharge) (avCharges []*model.AvCharge, err error)

GetAvCharge get av charge

func (*AvChargeSvr) GetAvChargeStatis

func (s *AvChargeSvr) GetAvChargeStatis(c context.Context) (avChargeStatis []*model.AvChargeStatis, err error)

GetAvChargeStatis get av charge statis

func (*AvChargeSvr) GetAvChargeStatisMap

func (s *AvChargeSvr) GetAvChargeStatisMap(c context.Context) (chargeStatisMap map[int64]*model.AvChargeStatis, err error)

GetAvChargeStatisMap get av charge statis map

func (*AvChargeSvr) HandleAvCharge

func (s *AvChargeSvr) HandleAvCharge(c context.Context, date time.Time,
	dailyChannel chan []*model.AvCharge) (weeklyChargeMap, monthlyChargeMap map[int64]*model.AvCharge, chargeStatisMap map[int64]*model.AvChargeStatis, err error)

HandleAvCharge handle av daily charge

type AvFilter

type AvFilter func(*model.AvCharge) bool

AvFilter av charge filter

type AvIncomeStatSvr

type AvIncomeStatSvr struct {
	// contains filtered or unexported fields
}

AvIncomeStatSvr av income stat service

func NewAvIncomeStatSvr

func NewAvIncomeStatSvr(dao *incomeD.Dao, batchSize int) (svr *AvIncomeStatSvr)

NewAvIncomeStatSvr new av income service

func (*AvIncomeStatSvr) AvIncomeStat

func (p *AvIncomeStatSvr) AvIncomeStat(c context.Context, limit int64) (m map[int64]*model.AvIncomeStat, err error)

AvIncomeStat get av income stat

func (*AvIncomeStatSvr) BatchInsertAvIncomeStat

func (p *AvIncomeStatSvr) BatchInsertAvIncomeStat(c context.Context, as map[int64]*model.AvIncomeStat) (err error)

BatchInsertAvIncomeStat batch insert av income statistics

type AvIncomeSvr

type AvIncomeSvr struct {
	// contains filtered or unexported fields
}

AvIncomeSvr Av income service

func NewAvIncomeSvr

func NewAvIncomeSvr(dao *incomeD.Dao, batchSize int) (svr *AvIncomeSvr)

NewAvIncomeSvr new av income service

func (*AvIncomeSvr) BatchInsertAvIncome

func (p *AvIncomeSvr) BatchInsertAvIncome(c context.Context, am map[int64][]*model.AvIncome) (err error)

BatchInsertAvIncome batch insert av income

type BgmFilter

type BgmFilter func(*model.AvCharge, *model.BGM) bool

BgmFilter av charge filter

type BgmIncomeStatSvr

type BgmIncomeStatSvr struct {
	// contains filtered or unexported fields
}

BgmIncomeStatSvr bgm income stat service

func NewBgmIncomeStatSvr

func NewBgmIncomeStatSvr(dao *incomeD.Dao, batchSize int) (svr *BgmIncomeStatSvr)

NewBgmIncomeStatSvr new bgm income stat svr

func (*BgmIncomeStatSvr) BatchInsertBgmIncomeStat

func (p *BgmIncomeStatSvr) BatchInsertBgmIncomeStat(c context.Context, bs map[int64]*model.BgmIncomeStat) (err error)

BatchInsertBgmIncomeStat batch insert bgm income stat

func (*BgmIncomeStatSvr) BgmIncomeStat

func (p *BgmIncomeStatSvr) BgmIncomeStat(c context.Context, limit int64) (m map[int64]*model.BgmIncomeStat, err error)

BgmIncomeStat get bgm income stat

type BgmIncomeSvr

type BgmIncomeSvr struct {
	// contains filtered or unexported fields
}

BgmIncomeSvr bgm income service

func NewBgmIncomeSvr

func NewBgmIncomeSvr(dao *incomeD.Dao, batchSize int) (svr *BgmIncomeSvr)

NewBgmIncomeSvr new bgm income service

func (*BgmIncomeSvr) BatchInsertBgmIncome

func (p *BgmIncomeSvr) BatchInsertBgmIncome(ctx context.Context, bm map[int64]map[int64]map[int64]*model.BgmIncome) (err error)

BatchInsertBgmIncome batch insert bgm income

type ChargeRatioSvr

type ChargeRatioSvr struct {
	// contains filtered or unexported fields
}

ChargeRatioSvr charge ratio service

func NewChargeRatioSvr

func NewChargeRatioSvr(dao *incomeD.Dao) *ChargeRatioSvr

NewChargeRatioSvr new charge ratio service

func (*ChargeRatioSvr) ArchiveChargeRatio

func (p *ChargeRatioSvr) ArchiveChargeRatio(c context.Context, limit int64) (rs map[int]map[int64]*model.ArchiveChargeRatio, err error)

ArchiveChargeRatio get av charge ratio

func (*ChargeRatioSvr) UpChargeRatio

func (p *ChargeRatioSvr) UpChargeRatio(c context.Context, limit int64) (rs map[int]map[int64]*model.UpChargeRatio, err error)

UpChargeRatio get up charge ratio

type ChargeRegulator

type ChargeRegulator func(*model.AvCharge)

ChargeRegulator regulates av charge

type ColumnFilter

type ColumnFilter func(*model.ColumnCharge) bool

ColumnFilter column charge filter

type ColumnIncomeStatSvr

type ColumnIncomeStatSvr struct {
	// contains filtered or unexported fields
}

ColumnIncomeStatSvr column income statistics service

func NewColumnIncomeStatSvr

func NewColumnIncomeStatSvr(dao *incomeD.Dao, batchSize int) (svr *ColumnIncomeStatSvr)

NewColumnIncomeStatSvr new column income stat service

func (*ColumnIncomeStatSvr) BatchInsertColumnIncomeStat

func (p *ColumnIncomeStatSvr) BatchInsertColumnIncomeStat(ctx context.Context, cs map[int64]*model.ColumnIncomeStat) (err error)

BatchInsertColumnIncomeStat batch insert column income stat

func (*ColumnIncomeStatSvr) ColumnIncomeStat

func (p *ColumnIncomeStatSvr) ColumnIncomeStat(c context.Context, limit int64) (m map[int64]*model.ColumnIncomeStat, err error)

ColumnIncomeStat column income statistisc

type ColumnIncomeSvr

type ColumnIncomeSvr struct {
	// contains filtered or unexported fields
}

ColumnIncomeSvr column income service

func NewColumnIncomeSvr

func NewColumnIncomeSvr(dao *incomeD.Dao, batchSize int) (svr *ColumnIncomeSvr)

NewColumnIncomeSvr new income service

func (*ColumnIncomeSvr) BatchInsertColumnIncome

func (p *ColumnIncomeSvr) BatchInsertColumnIncome(ctx context.Context, cm map[int64][]*model.ColumnIncome) (err error)

BatchInsertColumnIncome batch insert column income

type DateStatis

type DateStatis struct {
	// contains filtered or unexported fields
}

DateStatis income date statistics

func NewDateStatis

func NewDateStatis(dao *incomeD.Dao) *DateStatis

NewDateStatis new income date statistics service

type Income

type Income struct {
	// contains filtered or unexported fields
}

Income income service

func NewIncome

func NewIncome(batchSize int, dao *incomeD.Dao) *Income

NewIncome new income service

func (*Income) CalAvIncome

func (p *Income) CalAvIncome(ch chan []*model.AvCharge, urs map[int64]*model.UpChargeRatio, ars map[int64]*model.ArchiveChargeRatio, filters []AvFilter, signed map[int64]bool) (am map[int64][]*model.AvIncome, total map[int64]*model.UpBusinessIncome)

CalAvIncome cal av income

func (*Income) CalBgmIncome

func (p *Income) CalBgmIncome(ch chan []*model.AvCharge, bgms map[int64][]*model.BGM, urs map[int64]*model.UpChargeRatio, ars map[int64]*model.ArchiveChargeRatio, avf []AvFilter, exclude BgmFilter, black map[int64]bool, signed map[int64]bool) (bm map[int64]map[int64]map[int64]*model.BgmIncome, total map[int64]*model.UpBusinessIncome)

CalBgmIncome cal bgm income

func (*Income) CalColumnIncome

func (p *Income) CalColumnIncome(ch chan []*model.ColumnCharge, urs map[int64]*model.UpChargeRatio, ars map[int64]*model.ArchiveChargeRatio, filters []ColumnFilter, signed map[int64]bool) (cm map[int64][]*model.ColumnIncome, total map[int64]*model.UpBusinessIncome)

CalColumnIncome cal column income

func (*Income) CalUpIncome

func (p *Income) CalUpIncome(ch chan map[int64]*model.UpBusinessIncome, date time.Time) (m map[int64]*model.UpIncome)

CalUpIncome calculate upIncome

func (*Income) IncomeStat

func (p *Income) IncomeStat(
	um map[int64]*model.UpIncome,
	am map[int64][]*model.AvIncome,
	bm map[int64]map[int64]map[int64]*model.BgmIncome,
	cm map[int64][]*model.ColumnIncome,
	ustat map[int64]*model.UpIncomeStat,
	astat map[int64]*model.AvIncomeStat,
	bstat map[int64]*model.BgmIncomeStat,
	cstat map[int64]*model.ColumnIncomeStat)

IncomeStat income statistics

func (*Income) PurgeUpAccount

func (p *Income) PurgeUpAccount(date time.Time, accs map[int64]*model.UpAccount, um map[int64]*model.UpIncome)

PurgeUpAccount purge up account

func (*Income) UpdateBusinessIncomeByDate

func (p *Income) UpdateBusinessIncomeByDate(c context.Context, date string) (err error)

UpdateBusinessIncomeByDate update business income by date

type SectionEntries

type SectionEntries struct {
	// contains filtered or unexported fields
}

SectionEntries section entries

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service struct

func New

func New(c *conf.Config, executor ctrl.Executor) (s *Service)

New fn

func (*Service) BGMs

func (s *Service) BGMs(c context.Context, limit int64) (bm map[int64][]*model.BGM, err error)

BGMs map[avid][]*model.BGM,

func (*Service) Blacklist

func (s *Service) Blacklist(c context.Context, limit int64) (m map[int]map[int64]bool, err error)

Blacklist map[ctype]map[int64]bool

func (*Service) GetBubbleMeta

func (s *Service) GetBubbleMeta(c context.Context) (data map[int64][]int, err error)

GetBubbleMeta .

func (*Service) GetBusinessOrders

func (s *Service) GetBusinessOrders(c context.Context, limit int64) (result map[int64]bool, err error)

GetBusinessOrders get business orders

func (*Service) Ping

func (s *Service) Ping(c context.Context) (err error)

Ping check dao health.

func (*Service) RunAndSendMail

func (s *Service) RunAndSendMail(c context.Context, date time.Time) (err error)

RunAndSendMail run and send email

func (*Service) RunStatis

func (s *Service) RunStatis(c context.Context, date time.Time) (err error)

RunStatis run income statistics

func (*Service) Signed

func (s *Service) Signed(c context.Context, business string, limit int64) (m map[int64]*model.Signed, err error)

Signed signed up by business

func (*Service) SyncBgmInfo

func (s *Service) SyncBgmInfo(c context.Context) (err error)

SyncBgmInfo sync bgm info from data platform

func (*Service) UpdateBusinessIncome

func (s *Service) UpdateBusinessIncome(c context.Context, date string) (err error)

UpdateBusinessIncome ..

type TaxRate

type TaxRate struct {
	// contains filtered or unexported fields
}

TaxRate tax rate

type UpAccountSvr

type UpAccountSvr struct {
	// contains filtered or unexported fields
}

UpAccountSvr up account service

func NewUpAccountSvr

func NewUpAccountSvr(dao *incomeD.Dao, batchSize int) (svr *UpAccountSvr)

NewUpAccountSvr new up account service

func (*UpAccountSvr) BatchInsertUpAccount

func (s *UpAccountSvr) BatchInsertUpAccount(c context.Context, us map[int64]*model.UpAccount) (err error)

BatchInsertUpAccount batch insert up account

func (*UpAccountSvr) UpAccount

func (s *UpAccountSvr) UpAccount(c context.Context, limit int64) (m map[int64]*model.UpAccount, err error)

UpAccount get up account

func (*UpAccountSvr) UpdateUpAccount

func (s *UpAccountSvr) UpdateUpAccount(c context.Context, us map[int64]*model.UpAccount) (err error)

UpdateUpAccount update up account

type UpIncomeStatSvr

type UpIncomeStatSvr struct {
	// contains filtered or unexported fields
}

UpIncomeStatSvr up_income_stat svr

func NewUpIncomeStatSvr

func NewUpIncomeStatSvr(dao *incomeD.Dao, batchSize int) (svr *UpIncomeStatSvr)

NewUpIncomeStatSvr new server

func (*UpIncomeStatSvr) BatchInsertUpIncomeStat

func (p *UpIncomeStatSvr) BatchInsertUpIncomeStat(c context.Context, us map[int64]*model.UpIncomeStat) (err error)

BatchInsertUpIncomeStat insert up_income_statis batch

func (*UpIncomeStatSvr) UpIncomeStat

func (p *UpIncomeStatSvr) UpIncomeStat(c context.Context, limit int64) (m map[int64]*model.UpIncomeStat, err error)

UpIncomeStat return stats, key: mid, value: total_income

type UpIncomeSvr

type UpIncomeSvr struct {
	// contains filtered or unexported fields
}

UpIncomeSvr up income service

func NewUpIncomeSvr

func NewUpIncomeSvr(dao *incomeD.Dao, batchSize int) (svr *UpIncomeSvr)

NewUpIncomeSvr new income service

func (*UpIncomeSvr) BatchInsertUpIncome

func (p *UpIncomeSvr) BatchInsertUpIncome(c context.Context, us map[int64]*model.UpIncome) (err error)

BatchInsertUpIncome insert up_income batch

func (*UpIncomeSvr) GetUpIncomeTable

func (s *UpIncomeSvr) GetUpIncomeTable(c context.Context, date time.Time, table string) (upIncomes []*model.UpIncome, err error)

GetUpIncomeTable get up income table

func (*UpIncomeSvr) GetUpIncomeWeeklyAndMonthly

func (s *UpIncomeSvr) GetUpIncomeWeeklyAndMonthly(c context.Context, date time.Time) (weeklyMap map[int64]*model.UpIncome, monthlyMap map[int64]*model.UpIncome, err error)

GetUpIncomeWeeklyAndMonthly get up_income_weekly and up_income_monthly

func (*UpIncomeSvr) UpIncomeDBStore

func (s *UpIncomeSvr) UpIncomeDBStore(c context.Context, weeklyMap, monthlyMap map[int64]*model.UpIncome) (err error)

UpIncomeDBStore insert up_income

func (*UpIncomeSvr) UpIncomeDBStoreBatch

func (s *UpIncomeSvr) UpIncomeDBStoreBatch(c context.Context, table string, upIncomeMap map[int64]*model.UpIncome) error

UpIncomeDBStoreBatch up income db batch store

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL