num-old">
@@ -0,0 +1,20 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.28 on 2020-03-01 12:52
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations, models
6
+
7
+
8
+class Migration(migrations.Migration):
9
+
10
+    dependencies = [
11
+        ('integral', '0012_saleclerksubmitloginfo_is_wxwork'),
12
+    ]
13
+
14
+    operations = [
15
+        migrations.AddField(
16
+            model_name='saleclerksubmitloginfo',
17
+            name='is_staff_delete',
18
+            field=models.BooleanField(db_index=True, default=False, help_text='\u662f\u5426\u7ba1\u7406\u5458\u5220\u9664', verbose_name='is_staff_delete'),
19
+        ),
20
+    ]

+ 2 - 0
integral/models.py

@@ -114,6 +114,8 @@ class SaleclerkSubmitLogInfo(BaseModelMixin):
114 114
 
115 115
     is_wxwork = models.BooleanField(_(u'is_wxwork'), default=False, help_text=_(u'是否为企业微信端'), db_index=True)
116 116
 
117
+    is_staff_delete = models.BooleanField(_(u'is_staff_delete'), default=False, help_text=_(u'是否管理员删除'), db_index=True)
118
+
117 119
     class Meta:
118 120
         verbose_name = _(u'销售员扫码出库记录')
119 121
         verbose_name_plural = _(u'销售员扫码出库记录')

+ 1 - 0
kodo/settings.py

@@ -71,6 +71,7 @@ INSTALLED_APPS = (
71 71
     'pre',
72 72
     'sales',
73 73
     'server',
74
+    'staff',
74 75
     'statistic',
75 76
     'website',
76 77
     'daterange_filter',

+ 3 - 0
logs/admin.py

@@ -21,15 +21,18 @@ class MchLogInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):
21 21
     list_filter = ('operator_id', 'app_version', 'status')
22 22
     search_fields = ('operator_id', 'app_version')
23 23
 
24
+
24 25
 class MchLogInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin):
25 26
     list_display = ('log_id', 'log_file', 'operator_id', 'app_version', 'status', 'created_at', 'updated_at')
26 27
     list_filter = ('operator_id', 'app_version', 'status')
27 28
     search_fields = ('operator_id', 'app_version')
28 29
 
30
+
29 31
 class MchSearchModelAndCameraLogInfoAdmin(admin.ModelAdmin):
30 32
     list_display = ('user_id', 'is_search_model', 'is_selected_model', 'is_search_camera', 'is_search_model_camera', 'is_search_camera_after_model', 'created_at')
31 33
     list_filter = ('is_search_model', 'is_selected_model', 'is_search_camera', 'is_search_model_camera', 'is_search_camera_after_model')
32 34
 
35
+
33 36
 admin.site.register(MchInfoDecryptLogInfo, MchInfoDecryptLogInfoAdmin)
34 37
 admin.site.register(MchInfoEncryptLogInfo, MchInfoEncryptLogInfoAdmin)
35 38
 admin.site.register(MchSearchModelAndCameraLogInfo, MchSearchModelAndCameraLogInfoAdmin)

+ 35 - 0
logs/migrations/0008_mchsearchmodelandcameraloginfo.py

@@ -0,0 +1,35 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.26 on 2020-02-27 16:58
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations, models
6
+import shortuuidfield.fields
7
+
8
+
9
+class Migration(migrations.Migration):
10
+
11
+    dependencies = [
12
+        ('logs', '0007_auto_20200114_1229'),
13
+    ]
14
+
15
+    operations = [
16
+        migrations.CreateModel(
17
+            name='MchSearchModelAndCameraLogInfo',
18
+            fields=[
19
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20
+                ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
21
+                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
22
+                ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
23
+                ('user_id', models.CharField(blank=True, db_index=True, help_text='\u7528\u6237\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='user_id')),
24
+                ('log_id', shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, help_text='\u65e5\u5fd7\u552f\u4e00\u6807\u8bc6', max_length=22)),
25
+                ('is_search_model', models.IntegerField(db_index=True, default=0, help_text='\u641c\u7d22\u955c\u5934\u578b\u53f7', verbose_name='is_search_model')),
26
+                ('is_search_camera', models.IntegerField(db_index=True, default=0, help_text='\u641c\u7d22\u76f8\u673a\u578b\u53f7', verbose_name='is_search_model')),
27
+                ('is_search_model_camera', models.IntegerField(db_index=True, default=0, help_text='\u641c\u7d22\u76f8\u673a\u578b\u53f7\u548c\u955c\u5934\u578b\u53f7', verbose_name='is_search_model')),
28
+                ('is_search_camera_after_model', models.IntegerField(db_index=True, default=0, help_text='\u9009\u62e9\u955c\u5934\u540e\u641c\u7d22\u76f8\u673a\u578b\u53f7', verbose_name='is_search_camera_after_model')),
29
+            ],
30
+            options={
31
+                'verbose_name': 'mchsearchmodelandcameraloginfo',
32
+                'verbose_name_plural': 'mchsearchmodelandcameraloginfo',
33
+            },
34
+        ),
35
+    ]

+ 20 - 0
logs/migrations/0009_mchsearchmodelandcameraloginfo_is_selected_model.py

@@ -0,0 +1,20 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.26 on 2020-02-27 17:08
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations, models
6
+
7
+
8
+class Migration(migrations.Migration):
9
+
10
+    dependencies = [
11
+        ('logs', '0008_mchsearchmodelandcameraloginfo'),
12
+    ]
13
+
14
+    operations = [
15
+        migrations.AddField(
16
+            model_name='mchsearchmodelandcameraloginfo',
17
+            name='is_selected_model',
18
+            field=models.IntegerField(db_index=True, default=0, help_text='\u641c\u7d22\u76f8\u673a\u578b\u53f7', verbose_name='is_selected_model'),
19
+        ),
20
+    ]

+ 2 - 1
logs/models.py

@@ -72,6 +72,7 @@ class MchLogInfo(BaseModelMixin):
72 72
     def __unicode__(self):
73 73
         return unicode(self.pk)
74 74
 
75
+
75 76
 class MchSearchModelAndCameraLogInfo(BaseModelMixin):
76 77
     user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
77 78
 
@@ -88,4 +89,4 @@ class MchSearchModelAndCameraLogInfo(BaseModelMixin):
88 89
         verbose_name_plural = _(u'mchsearchmodelandcameraloginfo')
89 90
 
90 91
     def __unicode__(self):
91
-        return unicode(self.pk)
92
+        return unicode(self.pk)

+ 20 - 0
mch/migrations/0044_modelcamerabodyinfo_camera_brand_name.py

@@ -0,0 +1,20 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.26 on 2020-02-23 08:32
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations, models
6
+
7
+
8
+class Migration(migrations.Migration):
9
+
10
+    dependencies = [
11
+        ('mch', '0043_modelcamerabodyinfo'),
12
+    ]
13
+
14
+    operations = [
15
+        migrations.AddField(
16
+            model_name='modelcamerabodyinfo',
17
+            name='camera_brand_name',
18
+            field=models.CharField(blank=True, help_text='\u673a\u8eab\u54c1\u724c', max_length=255, null=True, verbose_name='camera_brand_name'),
19
+        ),
20
+    ]

+ 2 - 1
mch/models.py

@@ -635,7 +635,7 @@ class ConsumeInfoSubmitLogInfo(BaseModelMixin):
635 635
             model_info = ModelInfo.objects.get(model_id=self.model_id)
636 636
         except ModelInfo.DoesNotExist:
637 637
             model_info = {}
638
-        
638
+
639 639
         return {
640 640
             'model_name': self.model_name,
641 641
             'serialNo': self.serialNo,
@@ -644,6 +644,7 @@ class ConsumeInfoSubmitLogInfo(BaseModelMixin):
644 644
             'created_at': tc.local_string(self.created_at, format='%Y-%m-%d'),
645 645
         }
646 646
 
647
+
647 648
 class ActivityInfo(BaseModelMixin):
648 649
     FIXED_EXPIRED_TIME = 0
649 650
     CHANGED_EXPIRED_TIME = 1

+ 1 - 1
member/models.py

@@ -91,7 +91,7 @@ class GoodsInfo(BaseModelMixin):
91 91
             'able': True,
92 92
             'value': self.value,
93 93
         }
94
-    
94
+
95 95
     def details(self, user_id):
96 96
         detail = self.data(user_id)
97 97
         detail['desc'] = self.desc

+ 2 - 15
page/sale_views.py

@@ -97,9 +97,7 @@ def clerk_sale_submit_api(request):
97 97
     ymd = tc.local_string(format='%Y%m%d')
98 98
 
99 99
     # 是否被消费者扫过
100
-    has_scan = ConsumeInfoSubmitLogInfo.objects.filter(
101
-        model_id=model.model_id,
102
-        serialNo=serialNo).exists()
100
+    has_scan = ConsumeInfoSubmitLogInfo.objects.filter(model_id=model.model_id, serialNo=serialNo).exists()
103 101
 
104 102
     # 店员提交记录
105 103
     ssli = SaleclerkSubmitLogInfo.objects.create(
@@ -239,7 +237,6 @@ def clerk_sale_submit_api(request):
239 237
         mssi.num = len(mssi.saleclerks)
240 238
         mssi.save()
241 239
 
242
-
243 240
         # 经销商销量统计
244 241
         dssi, _ = DistributorSaleStatisticInfo.objects.select_for_update().get_or_create(
245 242
             brand_id=brand.brand_id,
@@ -287,15 +284,6 @@ def clerk_sale_submit_api(request):
287 284
         pssi.num += 1
288 285
         pssi.save()
289 286
 
290
-        # pssi2, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
291
-        #     brand_id=brand.brand_id,
292
-        #     province_code=distributor.distributor_province_code,
293
-        #     ymd=0,
294
-        # )
295
-        # pssi2.province_name = distributor.distributor_province_name
296
-        # pssi2.num += 1
297
-        # pssi2.save()
298
-
299 287
         # 日销售员销量统计
300 288
         sssi, _ = SaleclerkSaleStatisticInfo.objects.select_for_update().get_or_create(
301 289
             brand_id=brand.brand_id,
@@ -451,9 +439,8 @@ def clerk_checkout_serialNo_api(request):
451 439
     except SaleclerkInfo.DoesNotExist:
452 440
         return response(SaleclerkStatusCode.CLERK_NOT_FOUND)
453 441
 
454
-
455 442
     log = MchInfoEncryptLogInfo.objects.filter(model_pk=model_pk, sn=serialNo)
456
-    
443
+
457 444
     if not log:
458 445
         return response(ProductMachineStatusCode.SN_NOT_FOUND)
459 446
 

+ 0 - 2
pre/market_code.py

@@ -37,5 +37,3 @@ def marketcodedownload(application_id, code_start, code_end, isv_application_id=
37 37
                 code_index=code_index,
38 38
                 code_url=code_url
39 39
             )
40
-
41
-

+ 248 - 76
pre/views.py

@@ -4,14 +4,17 @@ from __future__ import division
4 4
 
5 5
 import xlrd
6 6
 from django.conf import settings
7
+from django.db import transaction
7 8
 from pysnippets.strsnippets import strip
8 9
 from TimeConvert import TimeConvert as tc
9 10
 
10
-from mch.models import BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, ModelInfo, ModelCameraBodyInfo
11
+from integral.models import SaleclerkSubmitLogInfo
12
+from mch.models import (BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, ModelCameraBodyInfo, ModelInfo,
13
+                        SaleclerkInfo)
11 14
 from statistic.models import (ConsumeDistributorSaleStatisticInfo, ConsumeModelSaleStatisticInfo,
12 15
                               ConsumeProvinceSaleStatisticInfo, ConsumeSaleStatisticInfo, ConsumeUserStatisticInfo,
13 16
                               DistributorSaleStatisticInfo, ModelSaleStatisticInfo, ProvinceSaleStatisticInfo,
14
-                              SaleStatisticInfo)
17
+                              SaleclerkSaleStatisticInfo, SaleStatisticInfo)
15 18
 from utils.redis.connect import r
16 19
 from utils.redis.rkeys import MINI_PROGRAM_GIS_LIST
17 20
 
@@ -253,77 +256,246 @@ def refreshs():
253 256
         except ModelInfo.DoesNotExist:
254 257
             continue
255 258
 
256
-        cusi, _ = ConsumeUserStatisticInfo.objects.get_or_create(
257
-            brand_id=mdl.brand_id,
258
-            ymd=ymd,
259
-        )
260
-        cusi.users = list(set(cusi.users + [log.user_id]))
261
-        cusi.num = len(cusi.users)
262
-        cusi.save()
263
-        cusi, _ = ConsumeUserStatisticInfo.objects.get_or_create(
264
-            brand_id=mdl.brand_id,
265
-            ymd=ymd[:6],
266
-        )
267
-        cusi.users = list(set(cusi.users + [log.user_id]))
268
-        cusi.num = len(cusi.users)
269
-        cusi.save()
270
-        cusi, _ = ConsumeUserStatisticInfo.objects.get_or_create(
271
-            brand_id=mdl.brand_id,
272
-            ymd=ymd[:4],
273
-        )
274
-        cusi.users = list(set(cusi.users + [log.user_id]))
275
-        cusi.num = len(cusi.users)
276
-        cusi.save()
277
-
278
-        cssi, _ = ConsumeSaleStatisticInfo.objects.get_or_create(
279
-            brand_id=mdl.brand_id,
280
-            ymd=ymd,
281
-        )
282
-        cssi.num += 1
283
-        cssi.save()
284
-        cssi, _ = ConsumeSaleStatisticInfo.objects.get_or_create(
285
-            brand_id=mdl.brand_id,
286
-            ymd=ymd[:6],
287
-        )
288
-        cssi.num += 1
289
-        cssi.save()
290
-        cssi, _ = ConsumeSaleStatisticInfo.objects.get_or_create(
291
-            brand_id=mdl.brand_id,
292
-            ymd=ymd[:4],
293
-        )
294
-        cssi.num += 1
295
-        cssi.save()
296
-
297
-        # 日型号销量统计
298
-        cmssi, _ = ConsumeModelSaleStatisticInfo.objects.get_or_create(
299
-            brand_id=mdl.brand_id,
300
-            model_name=mdl.model_uni_name,
301
-            ymd=ymd,
302
-        )
303
-        cmssi.num += 1
304
-        cmssi.save()
305
-        # 月型号销量统计
306
-        cmssi, _ = ConsumeModelSaleStatisticInfo.objects.get_or_create(
307
-            brand_id=mdl.brand_id,
308
-            model_name=mdl.model_uni_name,
309
-            ymd=ymd[:6],
310
-        )
311
-        cmssi.num += 1
312
-        cmssi.save()
313
-        # 年型号销量统计
314
-        cmssi, _ = ConsumeModelSaleStatisticInfo.objects.get_or_create(
315
-            brand_id=mdl.brand_id,
316
-            model_name=mdl.model_uni_name,
317
-            ymd=ymd[:4],
318
-        )
319
-        cmssi.num += 1
320
-        cmssi.save()
321
-
322
-        r.rpushjson(MINI_PROGRAM_GIS_LIST, {
323
-            'brand_id': log.brand_id,
324
-            'user_id': log.user_id,
325
-            'lat': log.lat,
326
-            'lon': log.lon,
327
-            'phone': log.phone,
328
-            'ymd': tc.local_string(tc.to_local_datetime(log.created_at), format='%Y%m%d'),
329
-        })
259
+        with transaction.atomic():
260
+            cusi, _ = ConsumeUserStatisticInfo.objects.select_for_update().get_or_create(
261
+                brand_id=mdl.brand_id,
262
+                ymd=ymd,
263
+            )
264
+            cusi.users = list(set(cusi.users + [log.user_id]))
265
+            cusi.num = len(cusi.users)
266
+            cusi.save()
267
+            cusi, _ = ConsumeUserStatisticInfo.objects.select_for_update().get_or_create(
268
+                brand_id=mdl.brand_id,
269
+                ymd=ymd[:6],
270
+            )
271
+            cusi.users = list(set(cusi.users + [log.user_id]))
272
+            cusi.num = len(cusi.users)
273
+            cusi.save()
274
+            cusi, _ = ConsumeUserStatisticInfo.objects.select_for_update().get_or_create(
275
+                brand_id=mdl.brand_id,
276
+                ymd=ymd[:4],
277
+            )
278
+            cusi.users = list(set(cusi.users + [log.user_id]))
279
+            cusi.num = len(cusi.users)
280
+            cusi.save()
281
+
282
+            cssi, _ = ConsumeSaleStatisticInfo.objects.select_for_update().get_or_create(
283
+                brand_id=mdl.brand_id,
284
+                ymd=ymd,
285
+            )
286
+            cssi.num += 1
287
+            cssi.save()
288
+            cssi, _ = ConsumeSaleStatisticInfo.objects.select_for_update().get_or_create(
289
+                brand_id=mdl.brand_id,
290
+                ymd=ymd[:6],
291
+            )
292
+            cssi.num += 1
293
+            cssi.save()
294
+            cssi, _ = ConsumeSaleStatisticInfo.objects.select_for_update().get_or_create(
295
+                brand_id=mdl.brand_id,
296
+                ymd=ymd[:4],
297
+            )
298
+            cssi.num += 1
299
+            cssi.save()
300
+
301
+            # 日型号销量统计
302
+            cmssi, _ = ConsumeModelSaleStatisticInfo.objects.select_for_update().get_or_create(
303
+                brand_id=mdl.brand_id,
304
+                model_name=mdl.model_uni_name,
305
+                ymd=ymd,
306
+            )
307
+            cmssi.num += 1
308
+            cmssi.save()
309
+            # 月型号销量统计
310
+            cmssi, _ = ConsumeModelSaleStatisticInfo.objects.select_for_update().get_or_create(
311
+                brand_id=mdl.brand_id,
312
+                model_name=mdl.model_uni_name,
313
+                ymd=ymd[:6],
314
+            )
315
+            cmssi.num += 1
316
+            cmssi.save()
317
+            # 年型号销量统计
318
+            cmssi, _ = ConsumeModelSaleStatisticInfo.objects.select_for_update().get_or_create(
319
+                brand_id=mdl.brand_id,
320
+                model_name=mdl.model_uni_name,
321
+                ymd=ymd[:4],
322
+            )
323
+            cmssi.num += 1
324
+            cmssi.save()
325
+
326
+            r.rpushjson(MINI_PROGRAM_GIS_LIST, {
327
+                'brand_id': log.brand_id,
328
+                'user_id': log.user_id,
329
+                'lat': log.lat,
330
+                'lon': log.lon,
331
+                'phone': log.phone,
332
+                'ymd': tc.local_string(tc.to_local_datetime(log.created_at), format='%Y%m%d'),
333
+            })
334
+
335
+
336
+def refreshs2():
337
+    SaleStatisticInfo.objects.all().delete()
338
+    ModelSaleStatisticInfo.objects.all().delete()
339
+    DistributorSaleStatisticInfo.objects.all().delete()
340
+    ProvinceSaleStatisticInfo.objects.all().delete()
341
+    SaleclerkSaleStatisticInfo.objects.all().delete()
342
+
343
+    logs = SaleclerkSubmitLogInfo.objects.filter(dupload=False, test_user=False, test_sn=False, status=True)
344
+
345
+    for log in logs:
346
+        ymd = tc.local_string(tc.to_local_datetime(log.created_at), format='%Y%m%d')
347
+
348
+        try:
349
+            brand = BrandInfo.objects.get(pk=log.brand_pk)
350
+        except BrandInfo.DoesNotExist:
351
+            continue
352
+
353
+        try:
354
+            model = ModelInfo.objects.get(pk=log.model_pk)
355
+        except ModelInfo.DoesNotExist:
356
+            continue
357
+
358
+        try:
359
+            clerk = SaleclerkInfo.objects.get(clerk_id=log.clerk_id, status=True)
360
+        except SaleclerkInfo.DoesNotExist:
361
+            continue
362
+
363
+        try:
364
+            distributor = DistributorInfo.objects.get(distributor_id=clerk.distributor_id)
365
+        except DistributorInfo.DoesNotExist:
366
+            continue
367
+
368
+        with transaction.atomic():
369
+            # 日销量统计
370
+            ssi, _ = SaleStatisticInfo.objects.select_for_update().get_or_create(
371
+                brand_id=brand.brand_id,
372
+                ymd=ymd,
373
+            )
374
+            ssi.num += 1
375
+            ssi.save()
376
+            # 月销量统计
377
+            ssi, _ = SaleStatisticInfo.objects.select_for_update().get_or_create(
378
+                brand_id=brand.brand_id,
379
+                ymd=ymd[:6],
380
+            )
381
+            ssi.num += 1
382
+            ssi.save()
383
+            # 年销量统计
384
+            ssi, _ = SaleStatisticInfo.objects.select_for_update().get_or_create(
385
+                brand_id=brand.brand_id,
386
+                ymd=ymd[:4],
387
+            )
388
+            ssi.num += 1
389
+            ssi.save()
390
+
391
+            # 型号销量统计
392
+            mssi, _ = ModelSaleStatisticInfo.objects.select_for_update().get_or_create(
393
+                brand_id=brand.brand_id,
394
+                model_name=model.model_uni_name,
395
+                ymd=ymd,
396
+            )
397
+            mssi.saleclerks += [clerk.clerk_id]
398
+            mssi.num = len(mssi.saleclerks)
399
+            mssi.save()
400
+
401
+            mssi, _ = ModelSaleStatisticInfo.objects.select_for_update().get_or_create(
402
+                brand_id=brand.brand_id,
403
+                model_name=model.model_uni_name,
404
+                ymd=ymd[:6],
405
+            )
406
+            mssi.saleclerks += [clerk.clerk_id]
407
+            mssi.num = len(mssi.saleclerks)
408
+            mssi.save()
409
+
410
+            mssi, _ = ModelSaleStatisticInfo.objects.select_for_update().get_or_create(
411
+                brand_id=brand.brand_id,
412
+                model_name=model.model_uni_name,
413
+                ymd=ymd[:4],
414
+            )
415
+            mssi.saleclerks += [clerk.clerk_id]
416
+            mssi.num = len(mssi.saleclerks)
417
+            mssi.save()
418
+
419
+            # 经销商销量统计
420
+            dssi, _ = DistributorSaleStatisticInfo.objects.select_for_update().get_or_create(
421
+                brand_id=brand.brand_id,
422
+                distributor_id=distributor.distributor_id,
423
+                ymd=ymd,
424
+            )
425
+            dssi.distributor_name = distributor.distributor_name
426
+            dssi.num += 1
427
+            dssi.save()
428
+
429
+            dssi2, _ = DistributorSaleStatisticInfo.objects.select_for_update().get_or_create(
430
+                brand_id=brand.brand_id,
431
+                distributor_id=distributor.distributor_id,
432
+                ymd=0,
433
+            )
434
+            dssi2.distributor_name = distributor.distributor_name
435
+            dssi2.num += 1
436
+            dssi2.save()
437
+
438
+            # 日省份销量统计
439
+            pssi, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
440
+                brand_id=brand.brand_id,
441
+                province_code=distributor.distributor_province_code,
442
+                ymd=ymd,
443
+            )
444
+            pssi.province_name = distributor.distributor_province_name
445
+            pssi.num += 1
446
+            pssi.save()
447
+            # 月省份销量统计
448
+            pssi, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
449
+                brand_id=brand.brand_id,
450
+                province_code=distributor.distributor_province_code,
451
+                ymd=ymd[:6],
452
+            )
453
+            pssi.province_name = distributor.distributor_province_name
454
+            pssi.num += 1
455
+            pssi.save()
456
+            # 年省份销量统计
457
+            pssi, _ = ProvinceSaleStatisticInfo.objects.select_for_update().get_or_create(
458
+                brand_id=brand.brand_id,
459
+                province_code=distributor.distributor_province_code,
460
+                ymd=ymd[:4],
461
+            )
462
+            pssi.province_name = distributor.distributor_province_name
463
+            pssi.num += 1
464
+            pssi.save()
465
+
466
+            # 日销售员销量统计
467
+            sssi, _ = SaleclerkSaleStatisticInfo.objects.select_for_update().get_or_create(
468
+                brand_id=brand.brand_id,
469
+                clerk_id=clerk.clerk_id,
470
+                ymd=ymd,
471
+            )
472
+            sssi.distributor_id = distributor.distributor_id
473
+            sssi.distributor_name = distributor.distributor_name
474
+            sssi.distributor_short_name = distributor.distributor_short_name
475
+            sssi.clerk_name = clerk.clerk_name
476
+            sssi.num += 1
477
+            sssi.save()
478
+            # 月销售员销量统计
479
+            sssi, _ = SaleclerkSaleStatisticInfo.objects.select_for_update().get_or_create(
480
+                brand_id=brand.brand_id,
481
+                clerk_id=clerk.clerk_id,
482
+                ymd=ymd[:6],
483
+            )
484
+            sssi.distributor_id = distributor.distributor_id
485
+            sssi.distributor_name = distributor.distributor_name
486
+            sssi.distributor_short_name = distributor.distributor_short_name
487
+            sssi.clerk_name = clerk.clerk_name
488
+            sssi.num += 1
489
+            sssi.save()
490
+            # 年销售员销量统计
491
+            sssi, _ = SaleclerkSaleStatisticInfo.objects.select_for_update().get_or_create(
492
+                brand_id=brand.brand_id,
493
+                clerk_id=clerk.clerk_id,
494
+                ymd=ymd[:4],
495
+            )
496
+            sssi.distributor_id = distributor.distributor_id
497
+            sssi.distributor_name = distributor.distributor_name
498
+            sssi.distributor_short_name = distributor.distributor_short_name
499
+            sssi.clerk_name = clerk.clerk_name
500
+            sssi.num += 1
501
+            sssi.save()

+ 1 - 0
shells/admin.py

@@ -3,4 +3,5 @@ from __future__ import unicode_literals
3 3
 
4 4
 from django.contrib import admin
5 5
 
6
+
6 7
 # Register your models here.

+ 1 - 0
shells/models.py

@@ -3,4 +3,5 @@ from __future__ import unicode_literals
3 3
 
4 4
 from django.db import models
5 5
 
6
+
6 7
 # Create your models here.

+ 1 - 0
shells/tests.py

@@ -3,4 +3,5 @@ from __future__ import unicode_literals
3 3
 
4 4
 from django.test import TestCase
5 5
 
6
+
6 7
 # Create your tests here.

+ 0 - 0
staff/__init__.py


+ 12 - 0
staff/admin.py

@@ -0,0 +1,12 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from django.contrib import admin
4
+
5
+from staff.models import StaffDeleteClerkSaleSubmitLogInfo
6
+
7
+
8
+class StaffDeleteClerkSaleSubmitLogInfoAdmin(admin.ModelAdmin):
9
+    list_display = ('username', 'code', 'status', 'created_at', 'updated_at')
10
+
11
+
12
+admin.site.register(StaffDeleteClerkSaleSubmitLogInfo, StaffDeleteClerkSaleSubmitLogInfoAdmin)

+ 8 - 0
staff/apps.py

@@ -0,0 +1,8 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.apps import AppConfig
5
+
6
+
7
+class StaffConfig(AppConfig):
8
+    name = 'staff'

+ 31 - 0
staff/migrations/0001_initial.py

@@ -0,0 +1,31 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.28 on 2020-03-01 13:19
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations, models
6
+
7
+
8
+class Migration(migrations.Migration):
9
+
10
+    initial = True
11
+
12
+    dependencies = [
13
+    ]
14
+
15
+    operations = [
16
+        migrations.CreateModel(
17
+            name='StaffDeleteClerkSaleSubmitLogInfo',
18
+            fields=[
19
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20
+                ('status', models.BooleanField(db_index=True, default=True, help_text='Status', verbose_name='status')),
21
+                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
22
+                ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
23
+                ('username', models.CharField(blank=True, db_index=True, help_text='\u7528\u6237\u540d', max_length=32, null=True, verbose_name='username')),
24
+                ('code', models.CharField(blank=True, db_index=True, help_text='\u673a\u8eab\u7801', max_length=32, null=True, verbose_name='code')),
25
+            ],
26
+            options={
27
+                'verbose_name': 'staffdeleteclerksalesubmitloginfo',
28
+                'verbose_name_plural': 'staffdeleteclerksalesubmitloginfo',
29
+            },
30
+        ),
31
+    ]

+ 0 - 0
staff/migrations/__init__.py


+ 17 - 0
staff/models.py

@@ -0,0 +1,17 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from django.db import models
4
+from django.utils.translation import ugettext_lazy as _
5
+from django_models_ext import BaseModelMixin
6
+
7
+
8
+class StaffDeleteClerkSaleSubmitLogInfo(BaseModelMixin):
9
+    username = models.CharField(_(u'username'), max_length=32, blank=True, null=True, help_text=u'用户名', db_index=True)
10
+    code = models.CharField(_(u'code'), max_length=32, blank=True, null=True, help_text=u'机身码', db_index=True)
11
+
12
+    class Meta:
13
+        verbose_name = _(u'staffdeleteclerksalesubmitloginfo')
14
+        verbose_name_plural = _(u'staffdeleteclerksalesubmitloginfo')
15
+
16
+    def __unicode__(self):
17
+        return unicode(self.pk)

+ 6 - 0
staff/tests.py

@@ -0,0 +1,6 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.test import TestCase
5
+
6
+# Create your tests here.

+ 6 - 0
staff/views.py

@@ -0,0 +1,6 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.shortcuts import render
5
+
6
+# Create your views here.

Pai2/pai2 - Gogs: Go Git Service

209 Commits (3b39460e5977e4521bf698db2c34e3b6431a9a98)

Author SHA1 Nachricht Datum
  Brightcells 3b39460e59 update wechat relative vor 9 Jahren
  Brightcells 48c5514e05 update jswe.js vor 9 Jahren
  Brightcells c81acc73e4 update DATABASES comment vor 9 Jahren
  Brightcells 32b6dfd487 add redis_conf vor 9 Jahren
  Brightcells 3fe58578d8 update requirements.txt vor 9 Jahren
  Brightcells 7dee2f9449 update requirements.txt vor 9 Jahren
  Brightcells 2eb44593ee fix bug: logs lost using ConcurrentRotatingFileHandler vor 9 Jahren
  Brightcells c7071ae7f1 wx_uid to openid vor 9 Jahren
  Brightcells 9b0b9c0587 fix bug: int error vor 9 Jahren
  Brightcells a71f3c569b add src for feedback vor 9 Jahren
  Brightcells f07f4fc893 JsonResponse to response vor 9 Jahren
  Brightcells 72890dc75c user to user_id vor 9 Jahren
  Brightcells 7161824a44 session to session_id vor 9 Jahren
  Brightcells 57e79f38df fix bug: Duplicate entry 'xxx' for key 'user_id' vor 9 Jahren
  Brightcells 3af14d4a96 fix bug: Duplicate entry 'xxx' for key 'account_userinfo_unionid_3c1f5d4e4e1b84a9_uniq vor 9 Jahren
  Brightcells 6626af8a8d add api lensman_wx_authorize_api vor 9 Jahren
  Brightcells 30d24179d9 add refused relative vor 9 Jahren
  Brightcells 6fb6025912 hideOptionMenu in wx & display status & forbidden modify after Actived vor 9 Jahren
  Brightcells 08f87a7634 add wechat diy share for lensman_oauth vor 9 Jahren
  Brightcells 77023892d9 add wechat diy share for lensman_oauth vor 9 Jahren
  Brightcells 6faf4d4d8c fix bug: WECHAT_REDIRECT_URI not exists vor 9 Jahren
  Brightcells d0affd4b01 add lensman_oauth page vor 9 Jahren
  Brightcells 7bd5e500b8 add hiredis package & upgrade some package vor 9 Jahren
  Brightcells 40165198cd change to use redis.ConnectionPool vor 9 Jahren
  Brightcells 6102143d8e reduce balance vor 9 Jahren
  Brightcells 92da943e9e check wx_uid for api wx_balance_withdraw_api vor 9 Jahren
  Brightcells fa2729a4e1 add api wx_balance_withdraw_api vor 9 Jahren
  Brightcells d3fd6adf70 add api lensman_login_api/lensman_upload_photo_api vor 10 Jahren
  Brightcells 6d6c8485ce bind LensmanInfo and UserInfo vor 10 Jahren
  Brightcells b2cf473db5 optimize pagination vor 10 Jahren
  Brightcells 54dd8f095f update requirements vor 10 Jahren
  Brightcells fa36c26ce4 extend param to_uid for comment_submit_api vor 10 Jahren
  Brightcells abc5fdce05 fix bug multi message for photo owner vor 10 Jahren
  Brightcells 3c11ca7b16 fix bug multi message for photo owner vor 10 Jahren
  Brightcells 9618c6d3bd add var for jswe.js vor 10 Jahren
  Brightcells 09d7f479cb fix bug import GROUP_PHOTO_WATCHER_SET vor 10 Jahren
  Brightcells 2a7e6d170d sadd user_id into GROUP_PHOTO_WATCHER_SET vor 10 Jahren
  Brightcells 9ae03cd4df refresh GROUP_PHOTO_COMMENT_LIST/GROUP_PHOTO_THUMB_UP_LIST vor 10 Jahren
  Brightcells 86aa86bbba add GROUP_PHOTO_WATCHER_SET vor 10 Jahren
  Brightcells 47eb096687 fix bug add cls=DjangoJSONEncoder for json.dumps vor 10 Jahren
  Brightcells e920b279d1 send message for all watched users vor 10 Jahren
  Brightcells 1a0427282e change to auto_response of django-json-response vor 10 Jahren
  Brightcells 29185bf2d4 reback to use raw sql instead of records vor 10 Jahren
  Brightcells a02504cc21 Fix Bug: created_at format error vor 10 Jahren
  Brightcells 148da098dd add wexin diy share for session_detail vor 10 Jahren
  Brightcells 5a00022a72 close debug vor 10 Jahren
  Brightcells 4f1aa43391 nonceStr vor 10 Jahren
  Brightcells f3edf9f11f add wexin diy share vor 10 Jahren
  Brightcells 8f43551640 add api wx_jsapi_signature_api vor 10 Jahren
  Brightcells b5857bab0c dialect[+driver]://user:password@host/dbname[?key=value..] vor 10 Jahren