正在显示
7 个修改的文件
包含
150 行增加
和
115 行删除
@@ -2,19 +2,17 @@ package query | @@ -2,19 +2,17 @@ package query | ||
2 | 2 | ||
3 | //ListOrderQuery 获取用户列表 | 3 | //ListOrderQuery 获取用户列表 |
4 | type ListOrderBaseQuery struct { | 4 | type ListOrderBaseQuery struct { |
5 | - //合伙人id | ||
6 | - PartnerId int64 `json:"partnerId" ` | ||
7 | - //订单编号 | ||
8 | - OrderCode string `json:"order_code"` | ||
9 | // 查询偏离量 | 5 | // 查询偏离量 |
10 | Offset int `json:"offset" ` | 6 | Offset int `json:"offset" ` |
11 | // 查询限制 | 7 | // 查询限制 |
12 | Limit int `json:"limit"` | 8 | Limit int `json:"limit"` |
13 | //发货单号 | 9 | //发货单号 |
14 | - DeliveryCode string `json:"deliveryCode"` | ||
15 | - CompanyId int64 `json:"companyId"` | ||
16 | - | 10 | + PartnerOrCode string `json:"partnerOrCode"` |
11 | + CompanyId int64 `json:"companyId"` | ||
17 | //订单类型 | 12 | //订单类型 |
18 | - OrderType int `json:"orderType"` | ||
19 | - PartnerOrCode string `json:"partner_or_code"` | 13 | + OrderType int `json:"orderType"` |
14 | + //合伙人分类 | ||
15 | + PartnerCategory int `json:"partnerCategory"` | ||
16 | + UpdateTimeBegin string `json:"updateTimeBegin"` | ||
17 | + UpdateTimeEnd string `json:"updateTimeEnd"` | ||
20 | } | 18 | } |
@@ -6,8 +6,8 @@ type ListOrderBonusQuery struct { | @@ -6,8 +6,8 @@ type ListOrderBonusQuery struct { | ||
6 | // 查询限制 | 6 | // 查询限制 |
7 | Limit int `json:"limit"` | 7 | Limit int `json:"limit"` |
8 | CompanyId int64 `json:"companyId"` | 8 | CompanyId int64 `json:"companyId"` |
9 | - PartnerCategory int `json:"partner_category"` | 9 | + PartnerCategory int `json:"partnerCategory"` |
10 | //订单类型 | 10 | //订单类型 |
11 | OrderType int `json:"orderType"` | 11 | OrderType int `json:"orderType"` |
12 | - PartnerOrCode string `json:"partner_or_code"` | 12 | + PartnerOrCode string `json:"partnerOrCode"` |
13 | } | 13 | } |
@@ -29,7 +29,8 @@ func NewOrderInfoService(option map[string]interface{}) *OrderInfoService { | @@ -29,7 +29,8 @@ func NewOrderInfoService(option map[string]interface{}) *OrderInfoService { | ||
29 | } | 29 | } |
30 | 30 | ||
31 | // PageListOrderBase 获取订单列表 | 31 | // PageListOrderBase 获取订单列表 |
32 | -func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrderBaseQuery) ([]domain.OrderBase, int, error) { | 32 | +func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrderBaseQuery) ([]map[string]interface{}, int, error) { |
33 | + var err error | ||
33 | transactionContext, err := factory.CreateTransactionContext(nil) | 34 | transactionContext, err := factory.CreateTransactionContext(nil) |
34 | if err != nil { | 35 | if err != nil { |
35 | return nil, 0, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) | 36 | return nil, 0, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) |
@@ -41,28 +42,24 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder | @@ -41,28 +42,24 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder | ||
41 | transactionContext.RollbackTransaction() | 42 | transactionContext.RollbackTransaction() |
42 | }() | 43 | }() |
43 | var ( | 44 | var ( |
44 | - orderRepository domain.OrderBaseRepository | ||
45 | - orders []domain.OrderBase | ||
46 | - cnt int | 45 | + orderDao *dao.OrderBaseDao |
46 | + orders []models.OrderBase | ||
47 | + cnt int | ||
47 | ) | 48 | ) |
48 | 49 | ||
49 | - if value, err := factory.CreateOrderBaseRepository(map[string]interface{}{ | 50 | + if orderDao, err = factory.CreateOrderBaseDao(map[string]interface{}{ |
50 | "transactionContext": transactionContext, | 51 | "transactionContext": transactionContext, |
51 | }); err != nil { | 52 | }); err != nil { |
52 | return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 53 | return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
53 | - } else { | ||
54 | - orderRepository = value | ||
55 | - } | ||
56 | - query := domain.OrderBaseFindQuery{ | ||
57 | - PartnerId: listOrderQuery.PartnerId, | ||
58 | - OrderCode: listOrderQuery.OrderCode, | ||
59 | - Offset: listOrderQuery.Offset, | ||
60 | - Limit: listOrderQuery.Limit, | ||
61 | - OrderType: listOrderQuery.OrderType, | ||
62 | - DeliveryCode: listOrderQuery.DeliveryCode, | ||
63 | - CompanyId: listOrderQuery.CompanyId, | ||
64 | - } | ||
65 | - orders, cnt, err = orderRepository.Find(query) | 54 | + } |
55 | + orders, cnt, err = orderDao.OrderListByCondition( | ||
56 | + listOrderQuery.CompanyId, | ||
57 | + listOrderQuery.OrderType, | ||
58 | + listOrderQuery.PartnerOrCode, | ||
59 | + [2]string{listOrderQuery.UpdateTimeBegin, listOrderQuery.UpdateTimeEnd}, | ||
60 | + listOrderQuery.PartnerCategory, | ||
61 | + listOrderQuery.Limit, listOrderQuery.Offset, | ||
62 | + ) | ||
66 | if err != nil { | 63 | if err != nil { |
67 | return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 64 | return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
68 | } | 65 | } |
@@ -72,6 +69,8 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder | @@ -72,6 +69,8 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder | ||
72 | }); err != nil { | 69 | }); err != nil { |
73 | return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 70 | return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
74 | } | 71 | } |
72 | + | ||
73 | + orderDataReturn := make([]map[string]interface{}, 0) | ||
75 | for i := range orders { | 74 | for i := range orders { |
76 | partnerData := &domain.PartnerInfo{} | 75 | partnerData := &domain.PartnerInfo{} |
77 | partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{ | 76 | partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{ |
@@ -79,12 +78,33 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder | @@ -79,12 +78,33 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder | ||
79 | }) | 78 | }) |
80 | if err != nil { | 79 | if err != nil { |
81 | logs.Error("获取合伙(id=%d)失败%s", orders[i].PartnerId, err) | 80 | logs.Error("获取合伙(id=%d)失败%s", orders[i].PartnerId, err) |
82 | - } else { | ||
83 | - orders[i].PartnerInfo = partnerData.Partner | ||
84 | } | 81 | } |
82 | + m := map[string]interface{}{ | ||
83 | + "createTime": orders[i].CreateTime.Local().Format("2006-01-02 15:04:05"), | ||
84 | + "updateTime": orders[i].UpdateTime.Local().Format("2006-01-02 15:04:05"), | ||
85 | + "buyer": orders[i].Buyer.BuyerName, | ||
86 | + "id": orders[i].Id, | ||
87 | + "orderId": orders[i].OrderCode, | ||
88 | + "shipmentsId": orders[i].DeliveryCode, | ||
89 | + "partner": partnerData.Partner.PartnerName, | ||
90 | + "orderNum": orders[i].PlanOrderCount, | ||
91 | + "orderPrice": orders[i].PlanOrderAmount, | ||
92 | + "orderDist": orders[i].RegionInfo.RegionName, | ||
93 | + "quantityControl": "", | ||
94 | + "priceControl": "", | ||
95 | + "status": orders[i].IsDisable, | ||
96 | + "partnerCategory": orders[i].PartnerCategory.Name, | ||
97 | + } | ||
98 | + if orders[i].UseOrderCount >= 0 { | ||
99 | + m["quantityControl"] = fmt.Sprint(orders[i].UseOrderCount) | ||
100 | + } | ||
101 | + if orders[i].UseOrderAmount >= 0 { | ||
102 | + m["priceControl"] = fmt.Sprint(orders[i].UseOrderAmount) | ||
103 | + } | ||
104 | + orderDataReturn = append(orderDataReturn, m) | ||
85 | } | 105 | } |
86 | transactionContext.CommitTransaction() | 106 | transactionContext.CommitTransaction() |
87 | - return orders, cnt, nil | 107 | + return orderDataReturn, cnt, nil |
88 | } | 108 | } |
89 | 109 | ||
90 | //GetOrderDetail 获取订单详情 | 110 | //GetOrderDetail 获取订单详情 |
@@ -766,6 +786,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde | @@ -766,6 +786,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde | ||
766 | listOrderQuery.CompanyId, | 786 | listOrderQuery.CompanyId, |
767 | listOrderQuery.OrderType, | 787 | listOrderQuery.OrderType, |
768 | listOrderQuery.PartnerOrCode, | 788 | listOrderQuery.PartnerOrCode, |
789 | + listOrderQuery.PartnerCategory, | ||
769 | listOrderQuery.Limit, | 790 | listOrderQuery.Limit, |
770 | listOrderQuery.Offset, | 791 | listOrderQuery.Offset, |
771 | ) | 792 | ) |
@@ -17,9 +17,10 @@ type SyncCompanyService struct{} | @@ -17,9 +17,10 @@ type SyncCompanyService struct{} | ||
17 | var _ SyncAction = (*SyncCompanyService)(nil) | 17 | var _ SyncAction = (*SyncCompanyService)(nil) |
18 | 18 | ||
19 | type CompanyBaseApplet struct { | 19 | type CompanyBaseApplet struct { |
20 | - Name string `json:"name"` | ||
21 | - URL string `json:"url"` | ||
22 | - Id string `json:"id"` | 20 | + Name string `json:"name"` |
21 | + URL string `json:"url"` | ||
22 | + Id string `json:"id"` | ||
23 | + ImageUrl string `json:"image_url"` | ||
23 | } | 24 | } |
24 | 25 | ||
25 | //企业平台的公司基础数据 | 26 | //企业平台的公司基础数据 |
@@ -114,9 +115,10 @@ func (service SyncCompanyService) addCompany(data CompanytData) error { | @@ -114,9 +115,10 @@ func (service SyncCompanyService) addCompany(data CompanytData) error { | ||
114 | applets := []domain.CompanyApplets{} | 115 | applets := []domain.CompanyApplets{} |
115 | for _, v := range data.Company.Applets { | 116 | for _, v := range data.Company.Applets { |
116 | app := domain.CompanyApplets{ | 117 | app := domain.CompanyApplets{ |
117 | - Name: v.Name, | ||
118 | - URL: v.URL, | ||
119 | - Id: v.Id, | 118 | + Name: v.Name, |
119 | + URL: v.URL, | ||
120 | + Id: v.Id, | ||
121 | + ImageUrl: v.ImageUrl, | ||
120 | } | 122 | } |
121 | applets = append(applets, app) | 123 | applets = append(applets, app) |
122 | } | 124 | } |
@@ -207,9 +209,10 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error { | @@ -207,9 +209,10 @@ func (service SyncCompanyService) updateCompany(data CompanytData) error { | ||
207 | applets := []domain.CompanyApplets{} | 209 | applets := []domain.CompanyApplets{} |
208 | for _, v := range data.Company.Applets { | 210 | for _, v := range data.Company.Applets { |
209 | app := domain.CompanyApplets{ | 211 | app := domain.CompanyApplets{ |
210 | - Name: v.Name, | ||
211 | - URL: v.URL, | ||
212 | - Id: v.Id, | 212 | + Name: v.Name, |
213 | + URL: v.URL, | ||
214 | + Id: v.Id, | ||
215 | + ImageUrl: v.ImageUrl, | ||
213 | } | 216 | } |
214 | applets = append(applets, app) | 217 | applets = append(applets, app) |
215 | } | 218 | } |
@@ -18,9 +18,10 @@ const ( | @@ -18,9 +18,10 @@ const ( | ||
18 | ) | 18 | ) |
19 | 19 | ||
20 | type CompanyApplets struct { | 20 | type CompanyApplets struct { |
21 | - Name string `json:"name"` | ||
22 | - URL string `json:"url"` | ||
23 | - Id string `json:"id"` | 21 | + Name string `json:"name"` |
22 | + URL string `json:"url"` | ||
23 | + Id string `json:"id"` | ||
24 | + ImageUrl string `json:"imageUrl"` | ||
24 | } | 25 | } |
25 | 26 | ||
26 | // 公司信息 | 27 | // 公司信息 |
@@ -50,7 +50,8 @@ func (dao OrderBaseDao) DeliveryCodeExist(code string, companyId int64, notId .. | @@ -50,7 +50,8 @@ func (dao OrderBaseDao) DeliveryCodeExist(code string, companyId int64, notId .. | ||
50 | //OrderListByCondition 根据条件获取订单分红列表 | 50 | //OrderListByCondition 根据条件获取订单分红列表 |
51 | //orderType 订单类型 | 51 | //orderType 订单类型 |
52 | //partnerOrCode 合伙人姓名或订单号或发货单号 | 52 | //partnerOrCode 合伙人姓名或订单号或发货单号 |
53 | -func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int, partnerOrCode string, limit, offset int) ([]models.OrderBase, int, error) { | 53 | +func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int, partnerOrCode string, |
54 | + partnerCategory int, limit, offset int) ([]models.OrderBase, int, error) { | ||
54 | tx := dao.transactionContext.GetDB() | 55 | tx := dao.transactionContext.GetDB() |
55 | var orders []models.OrderBase | 56 | var orders []models.OrderBase |
56 | query := tx.Model(&orders).Where("order_base.company_id=?", companyId) | 57 | query := tx.Model(&orders).Where("order_base.company_id=?", companyId) |
@@ -59,6 +60,9 @@ func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int | @@ -59,6 +60,9 @@ func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int | ||
59 | } else { | 60 | } else { |
60 | query = query.Where("order_base.order_type<>?", domain.OrderIntention) | 61 | query = query.Where("order_base.order_type<>?", domain.OrderIntention) |
61 | } | 62 | } |
63 | + if partnerCategory > 0 { | ||
64 | + query = query.Where(`order_base.partner_category@>'{"id":?}'`, partnerCategory) | ||
65 | + } | ||
62 | if len(partnerOrCode) > 0 { | 66 | if len(partnerOrCode) > 0 { |
63 | query = query.Join("LEFT JOIN partner_info as p ON order_base.partner_id=p.id"). | 67 | query = query.Join("LEFT JOIN partner_info as p ON order_base.partner_id=p.id"). |
64 | WhereGroup(func(q *orm.Query) (*orm.Query, error) { | 68 | WhereGroup(func(q *orm.Query) (*orm.Query, error) { |
@@ -76,36 +80,7 @@ func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int | @@ -76,36 +80,7 @@ func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int | ||
76 | return orders, cnt, err | 80 | return orders, cnt, err |
77 | } | 81 | } |
78 | 82 | ||
79 | -//导出分红列表所用的sql | ||
80 | -// SELECT | ||
81 | -// ROW_NUMBER() over(ORDER BY t1.update_time DESC) AS num, | ||
82 | -// t1.ID AS order_id, | ||
83 | -// t1.order_type, | ||
84 | -// t1.order_code, | ||
85 | -// t1.bonus_status, | ||
86 | -// to_char(t1.update_time at time zone 'CCT' ,'YYYY-MM-DD HH24:MI:SS') AS update_time, | ||
87 | -// (CASE | ||
88 | -// WHEN t1.use_partner_bonus>0 | ||
89 | -// THEN | ||
90 | -// t1.use_partner_bonus | ||
91 | -// ELSE | ||
92 | -// t1.plan_partner_bonus | ||
93 | -// END) AS partner_bonus, | ||
94 | -// t1.partner_bonus_has, | ||
95 | -// t1.partner_bonus_not, | ||
96 | -// t1.partner_bonus_expense, | ||
97 | -// tt1.has_bonus_percent, | ||
98 | -// t2.partner_name | ||
99 | -// FROM | ||
100 | -// order_base AS t1 | ||
101 | -// LEFT JOIN partner_info AS t2 ON t1.partner_id = t2."id" | ||
102 | -// LEFT JOIN ( | ||
103 | -// SELECT COUNT ( * ) AS has_bonus_percent, t3.order_id | ||
104 | -// FROM "order_good" AS t3 | ||
105 | -// WHERE t3.partner_bonus_percent >= 0 | ||
106 | -// GROUP BY t3.order_id | ||
107 | -// ) AS tt1 ON t1."id" = tt1.order_id | ||
108 | - | 83 | +//CustomOrderBonusForExcel 导出分红列表所用的结构 |
109 | type CustomOrderBonusForExcel struct { | 84 | type CustomOrderBonusForExcel struct { |
110 | Num int | 85 | Num int |
111 | OrderId int64 | 86 | OrderId int64 |
@@ -127,11 +102,10 @@ type CustomOrderBonusForExcel struct { | @@ -127,11 +102,10 @@ type CustomOrderBonusForExcel struct { | ||
127 | //@param orderType 订单类型 | 102 | //@param orderType 订单类型 |
128 | //@param partnerOrCode 合伙人姓名或订单号或发货单号 | 103 | //@param partnerOrCode 合伙人姓名或订单号或发货单号 |
129 | //@param partnerCategory 合伙人类型id | 104 | //@param partnerCategory 合伙人类型id |
130 | -//@return result 处理后的数据,可直接用于导出数据到excel | ||
131 | -//@return column 数据对应的键名,例 [0][英文键名,中文名称] | 105 | +//@return result 查询结果数据 |
132 | func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, partnerOrCode string, | 106 | func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, partnerOrCode string, |
133 | partnerCategory int) (result []CustomOrderBonusForExcel, err error) { | 107 | partnerCategory int) (result []CustomOrderBonusForExcel, err error) { |
134 | - | 108 | + //导出分红列表所用的sql |
135 | sqlStr := `SELECT | 109 | sqlStr := `SELECT |
136 | t1.ID AS order_id, | 110 | t1.ID AS order_id, |
137 | t1.order_type, | 111 | t1.order_type, |
@@ -188,3 +162,46 @@ func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, p | @@ -188,3 +162,46 @@ func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, p | ||
188 | } | 162 | } |
189 | return result, nil | 163 | return result, nil |
190 | } | 164 | } |
165 | + | ||
166 | +//OrderListByCondition 获取实际订单列表 | ||
167 | +//@param companyId 公司id | ||
168 | +//@param orderType 订单类型 | ||
169 | +//@param partnerOrCode 合伙人姓名或订单号或发货单号 | ||
170 | +//@param partnerCategory 合伙人类型id | ||
171 | +//@param updateTime 订单更新时间范围"[开始时间,结束时间]",时间格式"2016-01-02 15:04:05+07" | ||
172 | +func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, partnerOrCode string, | ||
173 | + updateTime [2]string, partnerCategory int, limit, offset int) ([]models.OrderBase, int, error) { | ||
174 | + tx := dao.transactionContext.GetDB() | ||
175 | + var orders []models.OrderBase | ||
176 | + query := tx.Model(&orders).Where("order_base.company_id=?", companyId) | ||
177 | + if orderType > 0 { | ||
178 | + query = query.Where("order_base.order_type=?", orderType) | ||
179 | + } else { | ||
180 | + query = query.Where("order_base.order_type<>?", domain.OrderIntention) | ||
181 | + } | ||
182 | + if partnerCategory > 0 { | ||
183 | + query = query.Where(`order_base.partner_category@>'{"id":?}'`, partnerCategory) | ||
184 | + } | ||
185 | + if len(updateTime[0]) > 0 { | ||
186 | + query = query.Where(`order_base.update_time>=?`, updateTime[0]) | ||
187 | + } | ||
188 | + if len(updateTime[1]) > 0 { | ||
189 | + query = query.Where(`order_base.update_time<=?`, updateTime[1]) | ||
190 | + } | ||
191 | + if len(partnerOrCode) > 0 { | ||
192 | + query = query.Join("LEFT JOIN partner_info as p ON order_base.partner_id=p.id"). | ||
193 | + WhereGroup(func(q *orm.Query) (*orm.Query, error) { | ||
194 | + q = q.WhereOr("order_base.order_code like ? ", "%"+partnerOrCode+"%"). | ||
195 | + WhereOr("order_base.delivery_code like ? ", "%"+partnerOrCode+"%"). | ||
196 | + WhereOr("p.partner_name like ? ", "%"+partnerOrCode+"%") | ||
197 | + return q, nil | ||
198 | + }) | ||
199 | + } | ||
200 | + query = query.Order("order_base.update_time DESC"). | ||
201 | + Offset(offset). | ||
202 | + Limit(limit) | ||
203 | + | ||
204 | + cnt, err := query.SelectAndCount() | ||
205 | + return orders, cnt, err | ||
206 | + | ||
207 | +} |
@@ -6,6 +6,7 @@ import ( | @@ -6,6 +6,7 @@ import ( | ||
6 | "regexp" | 6 | "regexp" |
7 | "strconv" | 7 | "strconv" |
8 | "strings" | 8 | "strings" |
9 | + "time" | ||
9 | "unicode/utf8" | 10 | "unicode/utf8" |
10 | 11 | ||
11 | "github.com/astaxie/beego/logs" | 12 | "github.com/astaxie/beego/logs" |
@@ -410,10 +411,12 @@ func (postData *postOrderPurposeDelivery) Valid() error { | @@ -410,10 +411,12 @@ func (postData *postOrderPurposeDelivery) Valid() error { | ||
410 | //PageListOrderReal 获取实发订单列表 | 411 | //PageListOrderReal 获取实发订单列表 |
411 | func (c *OrderInfoController) PageListOrderReal() { | 412 | func (c *OrderInfoController) PageListOrderReal() { |
412 | type Parameter struct { | 413 | type Parameter struct { |
413 | - SearchText string `json:"searchText"` | ||
414 | - Partner int64 `json:"partner"` | ||
415 | - PageSize int `json:"pageSize"` | ||
416 | - PageNumber int `json:"pageNumber"` | 414 | + SearchText string `json:"searchText"` |
415 | + PartnerCategory int `json:"PartnerCategory"` | ||
416 | + PageSize int `json:"pageSize"` | ||
417 | + PageNumber int `json:"pageNumber"` | ||
418 | + UpdateTimeBegin string `json:"updateTimeBegin"` | ||
419 | + UpdateTimeEnd string `json:"updateTimeEnd"` | ||
417 | } | 420 | } |
418 | var ( | 421 | var ( |
419 | param Parameter | 422 | param Parameter |
@@ -430,47 +433,39 @@ func (c *OrderInfoController) PageListOrderReal() { | @@ -430,47 +433,39 @@ func (c *OrderInfoController) PageListOrderReal() { | ||
430 | if param.PageSize == 0 { | 433 | if param.PageSize == 0 { |
431 | param.PageSize = 20 | 434 | param.PageSize = 20 |
432 | } | 435 | } |
436 | + if len(param.UpdateTimeBegin) > 0 { | ||
437 | + t, err := time.Parse("2016-01-02 15:04:05+07", param.UpdateTimeBegin) | ||
438 | + if err != nil { | ||
439 | + c.ResponseError(errors.New("UpdateTimeBegin 时间格式错误")) | ||
440 | + return | ||
441 | + } | ||
442 | + param.UpdateTimeBegin = t.Format("2016-01-02 15:04:05+07") | ||
443 | + } | ||
444 | + if len(param.UpdateTimeEnd) > 0 { | ||
445 | + t, err := time.Parse("2016-01-02 15:04:05+07", param.UpdateTimeEnd) | ||
446 | + if err != nil { | ||
447 | + c.ResponseError(errors.New("UpdateTimeEnd 时间格式错误")) | ||
448 | + return | ||
449 | + } | ||
450 | + param.UpdateTimeEnd = t.Format("2016-01-02 15:04:05+07") | ||
451 | + } | ||
433 | companyId := c.GetUserCompany() | 452 | companyId := c.GetUserCompany() |
434 | orderSrv := orderService.NewOrderInfoService(nil) | 453 | orderSrv := orderService.NewOrderInfoService(nil) |
435 | orderinfos, cnt, err := orderSrv.PageListOrderBase(orderQuery.ListOrderBaseQuery{ | 454 | orderinfos, cnt, err := orderSrv.PageListOrderBase(orderQuery.ListOrderBaseQuery{ |
436 | - PartnerId: param.Partner, | ||
437 | - DeliveryCode: param.SearchText, | ||
438 | - OrderType: domain.OrderReal, | ||
439 | - Limit: param.PageSize, | ||
440 | - Offset: (param.PageNumber - 1) * param.PageSize, | ||
441 | - CompanyId: companyId, | 455 | + PartnerOrCode: param.SearchText, |
456 | + OrderType: domain.OrderReal, | ||
457 | + Limit: param.PageSize, | ||
458 | + Offset: (param.PageNumber - 1) * param.PageSize, | ||
459 | + CompanyId: companyId, | ||
460 | + PartnerCategory: param.PartnerCategory, | ||
461 | + UpdateTimeBegin: param.UpdateTimeBegin, | ||
462 | + UpdateTimeEnd: param.UpdateTimeEnd, | ||
442 | }) | 463 | }) |
443 | if err != nil { | 464 | if err != nil { |
444 | c.ResponseError(err) | 465 | c.ResponseError(err) |
445 | return | 466 | return |
446 | } | 467 | } |
447 | - rsp := []map[string]interface{}{} | ||
448 | - for i := range orderinfos { | ||
449 | - orderinfo := orderinfos[i] | ||
450 | - m := map[string]interface{}{ | ||
451 | - "createTime": orderinfo.CreateTime.Local().Format("2006-01-02 15:04:05"), | ||
452 | - "updateTime": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:05"), | ||
453 | - "buyer": orderinfo.Buyer.BuyerName, | ||
454 | - "id": orderinfo.Id, | ||
455 | - "orderId": orderinfo.OrderCode, | ||
456 | - "shipmentsId": orderinfo.DeliveryCode, | ||
457 | - "partner": orderinfo.PartnerInfo.PartnerName, | ||
458 | - "orderNum": orderinfo.OrderCompute.PlanOrderCount, | ||
459 | - "orderPrice": orderinfo.OrderCompute.PlanOrderAmount, | ||
460 | - "orderDist": orderinfo.RegionInfo.RegionName, | ||
461 | - "quantityControl": "", | ||
462 | - "priceControl": "", | ||
463 | - "status": orderinfo.IsDisable, | ||
464 | - } | ||
465 | - if orderinfo.OrderCompute.UseOrderCount >= 0 { | ||
466 | - m["quantityControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderCount) | ||
467 | - } | ||
468 | - if orderinfo.OrderCompute.UseOrderAmount >= 0 { | ||
469 | - m["priceControl"] = fmt.Sprint(orderinfo.OrderCompute.UseOrderAmount) | ||
470 | - } | ||
471 | - rsp = append(rsp, m) | ||
472 | - } | ||
473 | - c.ResponsePageList(rsp, cnt, param.PageNumber) | 468 | + c.ResponsePageList(orderinfos, cnt, param.PageNumber) |
474 | return | 469 | return |
475 | } | 470 | } |
476 | 471 |
-
请 注册 或 登录 后发表评论