123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- from django.conf import settings
- from django.db import models
- from django.utils.translation import ugettext_lazy as _
- from django_models_ext import BaseModelMixin
- from jsonfield import JSONField
- from utils.rdm_utils import randnum
- class RegisterStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
- class Meta:
- verbose_name = _(u'注册用户统计')
- verbose_name_plural = _(u'注册用户统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'ymd': self.ymd,
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
- class SaleStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
- class Meta:
- verbose_name = _(u'[经销商维度]销量统计')
- verbose_name_plural = _(u'[经销商维度]销量统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'ymd': self.ymd,
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
- class ModelSaleStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- model_id = models.CharField(_(u'model_id'), max_length=32, help_text=u'型号唯一标识', db_index=True)
- model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称')
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
- saleclerks = JSONField(_(u'saleclerks'), default=[], help_text=u'销售员列表')
- class Meta:
- verbose_name = _(u'[经销商维度]型号销量统计')
- verbose_name_plural = _(u'[经销商维度]型号销量统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'model_id': self.model_id,
- 'model_name': self.model_name,
- 'ymd': self.ymd,
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
-
- @property
- def roi(self):
- return {
- 'model_id': self.model_id,
- 'model_name': self.model_name,
- 'roi': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
- class DistributorSaleStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- distributor_id = models.CharField(_(u'distributor_id'), max_length=32, help_text=u'经销商唯一标识', db_index=True)
- distributor_name = models.CharField(_(u'distributor_name'), max_length=255, blank=True, null=True, help_text=u'经销商名称')
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
- class Meta:
- verbose_name = _(u'[经销商维度]经销商销量统计')
- verbose_name_plural = _(u'[经销商维度]经销商销量统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'distributor_id': self.distributor_id,
- 'distributor_name': self.distributor_name,
- 'ymd': self.ymd,
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
- class ProvinceSaleStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- province_code = models.CharField(_(u'province_code'), max_length=6, help_text=u'省份编码', db_index=True)
- province_name = models.CharField(_(u'province_name'), max_length=8, blank=True, null=True, help_text=u'省份名称')
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
- position = models.IntegerField(_(u'position'), default=1, help_text=u'排序')
- class Meta:
- verbose_name = _(u'[经销商维度]省份销量统计')
- verbose_name_plural = _(u'[经销商维度]省份销量统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'province_code': self.province_code,
- 'province_name': self.province_name,
-
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
- class SaleclerkSaleStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- distributor_id = models.CharField(_(u'distributor_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True)
- distributor_name = models.CharField(_(u'distributor_name'), max_length=32, blank=True, null=True, help_text=u'经销商名称')
- distributor_short_name = models.CharField(_(u'distributor_short_name'), max_length=8, blank=True, null=True, help_text=u'经销商简称')
- clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True)
- clerk_name = models.CharField(_(u'clerk_name'), max_length=32, blank=True, null=True, help_text=u'店员名称')
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
- class Meta:
- verbose_name = _(u'[经销商维度]销售员销量统计')
- verbose_name_plural = _(u'[经销商维度]销售员销量统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'distributor_name': self.distributor_short_name or self.distributor_name or '',
- 'salesman_id': self.clerk_id,
- 'salesman_name': self.clerk_name,
-
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
- class ConsumeUserStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- users = JSONField(_(u'users'), default=[], help_text=u'用户列表')
- num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
- class Meta:
- verbose_name = _(u'[消费者维度]用户统计')
- verbose_name_plural = _(u'[消费者维度]用户统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'ymd': self.ymd,
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
- class ConsumeSaleStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
- class Meta:
- verbose_name = _(u'[消费者维度]销量统计')
- verbose_name_plural = _(u'[消费者维度]销量统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'ymd': self.ymd,
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
- class ConsumeModelSaleStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- model_id = models.CharField(_(u'model_id'), max_length=32, help_text=u'型号唯一标识', db_index=True)
- model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称', db_index=True)
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
- users = JSONField(_(u'users'), default=[], help_text=u'用户列表')
- class Meta:
- verbose_name = _(u'[消费者维度]型号销量统计')
- verbose_name_plural = _(u'[消费者维度]型号销量统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'model_id': self.model_id,
- 'model_name': self.model_name,
-
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
- class ConsumeDistributorSaleStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- distributor_id = models.CharField(_(u'distributor_id'), max_length=32, help_text=u'经销商唯一标识', db_index=True)
- distributor_name = models.CharField(_(u'distributor_name'), max_length=255, blank=True, null=True, help_text=u'经销商名称')
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
- class Meta:
- verbose_name = _(u'[消费者维度]经销商销量统计')
- verbose_name_plural = _(u'[消费者维度]经销商销量统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'distributor_id': self.distributor_id,
- 'distributor_name': self.distributor_name,
- 'ymd': self.ymd,
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- }
- class ConsumeProvinceSaleStatisticInfo(BaseModelMixin):
- brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
- province_code = models.CharField(_(u'province_code'), max_length=6, help_text=u'省份编码', db_index=True)
- province_name = models.CharField(_(u'province_name'), max_length=8, blank=True, null=True, help_text=u'省份名称')
- ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)
- users = JSONField(_(u'users'), default=[], help_text=u'用户列表')
- num = models.IntegerField(_(u'num'), default=0, help_text=u'人数')
- num2 = models.IntegerField(_(u'num2'), default=0, help_text=u'支数')
- position = models.IntegerField(_(u'position'), default=1, help_text=u'排序')
- class Meta:
- verbose_name = _(u'[消费者维度]省份销量统计')
- verbose_name_plural = _(u'[消费者维度]省份销量统计')
- def __unicode__(self):
- return '%d' % self.pk
- @property
- def data(self):
- return {
- 'province_code': self.province_code,
- 'province_name': self.province_name,
- 'ymd': self.ymd,
- 'num': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num,
- 'num2': randnum() if settings.DEBUG_STATISTIC_DATA_FLAG else self.num2,
- }
|