|
@@ -2,6 +2,7 @@ package statistics
|
2
|
2
|
|
3
|
3
|
import (
|
4
|
4
|
"errors"
|
|
5
|
+ "spaceofcheng/services/models"
|
5
|
6
|
"spaceofcheng/services/models/statistics"
|
6
|
7
|
"spaceofcheng/services/service"
|
7
|
8
|
"spaceofcheng/services/utils"
|
|
@@ -50,7 +51,7 @@ func (s *StatisticsServ) GetGoodsStatisticsExcel(caseids, typeid, name string) (
|
50
|
51
|
}
|
51
|
52
|
|
52
|
53
|
// GetGoodsOrdersStatistics 获取商品订单统计信息
|
53
|
|
-func (s *StatisticsServ) GetGoodsOrdersStatistics(status, usertype, caseids, begindate, enddate string, page, pageSize int) (map[string]interface{}, error) {
|
|
54
|
+func (s *StatisticsServ) GetGoodsOrdersStatistics(status, usertype, caseids, begindate, enddate, paytype string, page, pageSize int) (map[string]interface{}, error) {
|
54
|
55
|
if pageSize == 0 {
|
55
|
56
|
pageSize = service.PAGENUM
|
56
|
57
|
}
|
|
@@ -62,12 +63,25 @@ func (s *StatisticsServ) GetGoodsOrdersStatistics(status, usertype, caseids, beg
|
62
|
63
|
return nil, errors.New("请先选择案场信息")
|
63
|
64
|
}
|
64
|
65
|
|
65
|
|
- list, err := s.dao.GetGoodsOrderStatistics(status, usertype, caseids, begindate, enddate, page, pageSize)
|
|
66
|
+ list, err := s.dao.GetGoodsOrderStatistics(status, usertype, caseids, begindate, enddate, paytype, page, pageSize)
|
66
|
67
|
if err != nil {
|
67
|
68
|
utils.LogError("获取商品订单统计数据失败: " + err.Error())
|
68
|
69
|
return nil, errors.New("获取商品订单统计数据失败")
|
69
|
70
|
}
|
70
|
|
- all, err := s.dao.GetGoodsOrderStatisticsCount(status, usertype, caseids, begindate, enddate)
|
|
71
|
+ for a := 0; a < len(list); a++ {
|
|
72
|
+ switch list[a].PayType {
|
|
73
|
+ case models.CONSUME_INNER:
|
|
74
|
+ list[a].PayTypeStr = "案场"
|
|
75
|
+ case models.CONSUME_COUPON:
|
|
76
|
+ list[a].PayTypeStr = "优惠券"
|
|
77
|
+ case models.CONSUME_COINCHG:
|
|
78
|
+ list[a].PayTypeStr = "城币"
|
|
79
|
+ case models.CONSUME_POINTS:
|
|
80
|
+ list[a].PayTypeStr = "积分"
|
|
81
|
+ }
|
|
82
|
+
|
|
83
|
+ }
|
|
84
|
+ all, err := s.dao.GetGoodsOrderStatisticsCount(status, usertype, caseids, begindate, paytype, enddate)
|
71
|
85
|
if err != nil {
|
72
|
86
|
utils.LogError("获取商品订单统计数据失败: " + err.Error())
|
73
|
87
|
return nil, errors.New("获取商品订单统计数据失败")
|
|
@@ -82,12 +96,12 @@ func (s *StatisticsServ) GetGoodsOrdersStatistics(status, usertype, caseids, beg
|
82
|
96
|
}
|
83
|
97
|
|
84
|
98
|
// GetGoodsOrdersStatisticsExcel 商品订单导出
|
85
|
|
-func (s *StatisticsServ) GetGoodsOrdersStatisticsExcel(status, usertype, caseids, begindate, enddate string) ([]statistics.GoodsOrdersStatistics, error) {
|
|
99
|
+func (s *StatisticsServ) GetGoodsOrdersStatisticsExcel(status, usertype, caseids, begindate, enddate, paytype string) ([]statistics.GoodsOrdersStatistics, error) {
|
86
|
100
|
if caseids == "" {
|
87
|
101
|
return nil, errors.New("请先选择案场信息")
|
88
|
102
|
}
|
89
|
103
|
|
90
|
|
- all, err := s.dao.GetGoodsOrderStatisticsCount(status, usertype, caseids, begindate, enddate)
|
|
104
|
+ all, err := s.dao.GetGoodsOrderStatisticsCount(status, usertype, caseids, begindate, enddate, paytype)
|
91
|
105
|
if err != nil {
|
92
|
106
|
utils.LogError("获取商品订单统计数据失败: " + err.Error())
|
93
|
107
|
return nil, errors.New("获取商品订单统计数据失败")
|