lines-num-new"> 252
sssi, _ = SaleclerkSaleStatisticInfo.objects.select_for_update().get_or_create(
brand_id=brand.brand_id,
clerk_id=clerk.clerk_id,
- ymd=ym,
+ ymd=ymd[:6],
)
sssi.distributor_id = distributor.distributor_id
sssi.province_name = distributor.distributor_province_name
@@ -265,7 +263,7 @@ def clerk_sale_submit_api(request):
sssi, _ = SaleclerkSaleStatisticInfo.objects.select_for_update().get_or_create(
brand_id=brand.brand_id,
clerk_id=clerk.clerk_id,
- ymd=y,
+ ymd=ymd[:4],
)
sssi.distributor_id = distributor.distributor_id
sssi.province_name = distributor.distributor_province_name
@@ -5,11 +5,14 @@ from __future__ import division |
||
| 5 | 5 |
import xlrd |
| 6 | 6 |
from django.conf import settings |
| 7 | 7 |
from pysnippets.strsnippets import strip |
| 8 |
+from TimeConvert import TimeConvert as tc |
|
| 8 | 9 |
|
| 9 |
-from mch.models import BrandInfo, DistributorInfo, ModelInfo |
|
| 10 |
+from mch.models import BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, ModelInfo |
|
| 10 | 11 |
from statistic.models import (ConsumeDistributorSaleStatisticInfo, ConsumeModelSaleStatisticInfo, |
| 11 | 12 |
ConsumeProvinceSaleStatisticInfo, ConsumeSaleStatisticInfo, DistributorSaleStatisticInfo, |
| 12 | 13 |
ModelSaleStatisticInfo, ProvinceSaleStatisticInfo, SaleStatisticInfo) |
| 14 |
+from utils.redis.connect import r |
|
| 15 |
+from utils.redis.rkeys import MINI_PROGRAM_GIS_LIST |
|
| 13 | 16 |
|
| 14 | 17 |
|
| 15 | 18 |
PROVINCE_LIST = {
|
@@ -196,3 +199,14 @@ def fill_ym(): |
||
| 196 | 199 |
) |
| 197 | 200 |
ssi.num += o.num |
| 198 | 201 |
ssi.save() |
| 202 |
+ |
|
| 203 |
+ |
|
| 204 |
+def refreshp(): |
|
| 205 |
+ logs = ConsumeInfoSubmitLogInfo.objects.filter(test_user=False) |
|
| 206 |
+ for log in logs: |
|
| 207 |
+ r.rpushjson(MINI_PROGRAM_GIS_LIST, {
|
|
| 208 |
+ 'brand_id': log.brand_id, |
|
| 209 |
+ 'lat': log.lat, |
|
| 210 |
+ 'lon': log.lon, |
|
| 211 |
+ 'ymd': tc.local_string(tc.to_local_datetime(log.created_at), format='%Y%m%d'), |
|
| 212 |
+ }) |
@@ -241,8 +241,8 @@ def ymdtj(brand_id, ymd, lastymd): |
||
| 241 | 241 |
salesmen = SaleclerkSaleStatisticInfo.objects.filter(brand_id=brand_id, ymd=ymd, status=True).order_by('-num')[:20]
|
| 242 | 242 |
salesmen = [s.data for s in salesmen] |
| 243 | 243 |
|
| 244 |
- # [经销商维度] 统计周期内省份销量排行数据,请按顺序返回 |
|
| 245 |
- provinces = ProvinceSaleStatisticInfo.objects.filter(brand_id=brand_id, ymd=ymd, status=True) |
|
| 244 |
+ # [收费者维度] 统计周期内省份销量排行数据,请按顺序返回 |
|
| 245 |
+ provinces = ConsumeProvinceSaleStatisticInfo.objects.filter(brand_id=brand_id, ymd=ymd, status=True) |
|
| 246 | 246 |
provinces = [p.data for p in provinces] |
| 247 | 247 |
|
| 248 | 248 |
return {
|