正在显示
1 个修改的文件
包含
201 行增加
和
202 行删除
@@ -6,7 +6,6 @@ import ( | @@ -6,7 +6,6 @@ import ( | ||
6 | "regexp" | 6 | "regexp" |
7 | "strconv" | 7 | "strconv" |
8 | "strings" | 8 | "strings" |
9 | - "time" | ||
10 | "unicode/utf8" | 9 | "unicode/utf8" |
11 | 10 | ||
12 | "github.com/astaxie/beego/logs" | 11 | "github.com/astaxie/beego/logs" |
@@ -33,140 +32,140 @@ func (c *OrderInfoController) Prepare() { | @@ -33,140 +32,140 @@ func (c *OrderInfoController) Prepare() { | ||
33 | } | 32 | } |
34 | 33 | ||
35 | //PageListOrderPurpose 分页获取意向订单列表 | 34 | //PageListOrderPurpose 分页获取意向订单列表 |
36 | -func (c *OrderInfoController) PageListOrderPurpose() { | ||
37 | - type Parameter struct { | ||
38 | - SearchText string `json:"searchText"` | ||
39 | - Partner int64 `json:"partner"` | ||
40 | - PageSize int `json:"pageSize"` | ||
41 | - PageNumber int `json:"pageNumber"` | ||
42 | - } | ||
43 | - var ( | ||
44 | - param Parameter | ||
45 | - err error | ||
46 | - ) | ||
47 | - if err = c.BindJsonData(¶m); err != nil { | ||
48 | - logs.Error(err) | ||
49 | - c.ResponseError(errors.New("json数据解析失败")) | ||
50 | - return | ||
51 | - } | ||
52 | - if param.PageNumber == 0 { | ||
53 | - param.PageNumber = 1 | ||
54 | - } | ||
55 | - if param.PageSize == 0 { | ||
56 | - param.PageSize = 20 | ||
57 | - } | ||
58 | - companyId := c.GetUserCompany() | ||
59 | - orderSrv := orderService.NewOrderInfoService(nil) | ||
60 | - orderinfos, cnt, err := orderSrv.PageListOrderBase(orderQuery.ListOrderBaseQuery{ | ||
61 | - PartnerId: param.Partner, | ||
62 | - OrderCode: param.SearchText, | ||
63 | - OrderType: domain.OrderIntention, | ||
64 | - Limit: param.PageSize, | ||
65 | - Offset: (param.PageNumber - 1) * param.PageSize, | ||
66 | - CompanyId: companyId, | ||
67 | - }) | ||
68 | - if err != nil { | ||
69 | - c.ResponseError(err) | ||
70 | - return | ||
71 | - } | ||
72 | - rsp := []map[string]interface{}{} | ||
73 | - for i := range orderinfos { | ||
74 | - orderinfo := orderinfos[i] | ||
75 | - m := map[string]interface{}{ | ||
76 | - "createTime": orderinfo.CreateTime.Local().Format("2006-01-02 15:04:05"), | ||
77 | - "updateTime": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:05"), | ||
78 | - "buyer": orderinfo.Buyer.BuyerName, | ||
79 | - "id": orderinfo.Id, | ||
80 | - "orderId": orderinfo.OrderCode, | ||
81 | - "partner": orderinfo.PartnerInfo.PartnerName, | ||
82 | - "orderNum": orderinfo.OrderCompute.PlanOrderCount, | ||
83 | - "orderPrice": orderinfo.OrderCompute.PlanOrderAmount, | ||
84 | - "orderDist": orderinfo.RegionInfo.RegionName, | ||
85 | - } | ||
86 | - rsp = append(rsp, m) | ||
87 | - } | ||
88 | - c.ResponsePageList(rsp, cnt, param.PageNumber) | ||
89 | -} | 35 | +// func (c *OrderInfoController) PageListOrderPurpose() { |
36 | +// type Parameter struct { | ||
37 | +// SearchText string `json:"searchText"` | ||
38 | +// Partner int64 `json:"partner"` | ||
39 | +// PageSize int `json:"pageSize"` | ||
40 | +// PageNumber int `json:"pageNumber"` | ||
41 | +// } | ||
42 | +// var ( | ||
43 | +// param Parameter | ||
44 | +// err error | ||
45 | +// ) | ||
46 | +// if err = c.BindJsonData(¶m); err != nil { | ||
47 | +// logs.Error(err) | ||
48 | +// c.ResponseError(errors.New("json数据解析失败")) | ||
49 | +// return | ||
50 | +// } | ||
51 | +// if param.PageNumber == 0 { | ||
52 | +// param.PageNumber = 1 | ||
53 | +// } | ||
54 | +// if param.PageSize == 0 { | ||
55 | +// param.PageSize = 20 | ||
56 | +// } | ||
57 | +// companyId := c.GetUserCompany() | ||
58 | +// orderSrv := orderService.NewOrderInfoService(nil) | ||
59 | +// orderinfos, cnt, err := orderSrv.PageListOrderBase(orderQuery.ListOrderBaseQuery{ | ||
60 | +// PartnerId: param.Partner, | ||
61 | +// OrderCode: param.SearchText, | ||
62 | +// OrderType: domain.OrderIntention, | ||
63 | +// Limit: param.PageSize, | ||
64 | +// Offset: (param.PageNumber - 1) * param.PageSize, | ||
65 | +// CompanyId: companyId, | ||
66 | +// }) | ||
67 | +// if err != nil { | ||
68 | +// c.ResponseError(err) | ||
69 | +// return | ||
70 | +// } | ||
71 | +// rsp := []map[string]interface{}{} | ||
72 | +// for i := range orderinfos { | ||
73 | +// orderinfo := orderinfos[i] | ||
74 | +// m := map[string]interface{}{ | ||
75 | +// "createTime": orderinfo.CreateTime.Local().Format("2006-01-02 15:04:05"), | ||
76 | +// "updateTime": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:05"), | ||
77 | +// "buyer": orderinfo.Buyer.BuyerName, | ||
78 | +// "id": orderinfo.Id, | ||
79 | +// "orderId": orderinfo.OrderCode, | ||
80 | +// "partner": orderinfo.PartnerInfo.PartnerName, | ||
81 | +// "orderNum": orderinfo.OrderCompute.PlanOrderCount, | ||
82 | +// "orderPrice": orderinfo.OrderCompute.PlanOrderAmount, | ||
83 | +// "orderDist": orderinfo.RegionInfo.RegionName, | ||
84 | +// } | ||
85 | +// rsp = append(rsp, m) | ||
86 | +// } | ||
87 | +// c.ResponsePageList(rsp, cnt, param.PageNumber) | ||
88 | +// } | ||
90 | 89 | ||
91 | //GetOrderPurpose 获取意向订单详情 | 90 | //GetOrderPurpose 获取意向订单详情 |
92 | -func (c *OrderInfoController) GetOrderPurpose() { | ||
93 | - type Parameter struct { | ||
94 | - Id string `json:"id"` | ||
95 | - } | ||
96 | - var ( | ||
97 | - param Parameter | ||
98 | - err error | ||
99 | - ) | ||
100 | - if err = c.BindJsonData(¶m); err != nil { | ||
101 | - logs.Error(err) | ||
102 | - c.ResponseError(errors.New("json数据解析失败")) | ||
103 | - return | ||
104 | - } | ||
105 | - orderid, _ := strconv.ParseInt(param.Id, 10, 64) | ||
106 | - companyId := c.GetUserCompany() | ||
107 | - orderSrv := orderService.NewOrderInfoService(nil) | ||
108 | - orderinfo, err := orderSrv.GetOrderDetail(orderQuery.GetOrderQuery{ | ||
109 | - OrderId: orderid, | ||
110 | - CompanyId: companyId, | ||
111 | - }) | ||
112 | - if err != nil { | ||
113 | - c.ResponseError(err) | ||
114 | - return | ||
115 | - } | ||
116 | - if orderinfo.OrderType != domain.OrderIntention { | ||
117 | - c.ResponseError(errors.New("参数错误")) | ||
118 | - return | ||
119 | - } | ||
120 | - allGoods := []map[string]interface{}{} | ||
121 | - for _, v := range orderinfo.Goods { | ||
122 | - m := map[string]interface{}{ | ||
123 | - "id": v.Id, | ||
124 | - "productName": v.GoodName, | ||
125 | - "orderNum": v.PlanGoodNumber, | ||
126 | - "univalence": v.Price, | ||
127 | - "partnerRatio": v.PartnerBonusPercent, | ||
128 | - "orderPrice": v.GoodCompute.PlanAmount, | ||
129 | - } | ||
130 | - allGoods = append(allGoods, m) | ||
131 | - } | ||
132 | - rsp := map[string]interface{}{ | ||
133 | - "buyer": orderinfo.Buyer.BuyerName, | ||
134 | - "id": orderinfo.Id, | ||
135 | - "partnerID": orderinfo.PartnerInfo.Id, | ||
136 | - "partner": orderinfo.PartnerInfo.PartnerName, | ||
137 | - "orderDist": orderinfo.RegionInfo.RegionName, | ||
138 | - "orderId": orderinfo.OrderCode, | ||
139 | - "product": allGoods, | ||
140 | - "commissionProportion": orderinfo.SalesmanBonusPercent, | ||
141 | - "orderNumCount": orderinfo.OrderCompute.PlanOrderCount, | ||
142 | - "orderAmountAdjustmentCount": orderinfo.OrderCompute.PlanOrderAmount, | ||
143 | - } | ||
144 | - c.ResponseData(rsp) | ||
145 | -} | 91 | +// func (c *OrderInfoController) GetOrderPurpose() { |
92 | +// type Parameter struct { | ||
93 | +// Id string `json:"id"` | ||
94 | +// } | ||
95 | +// var ( | ||
96 | +// param Parameter | ||
97 | +// err error | ||
98 | +// ) | ||
99 | +// if err = c.BindJsonData(¶m); err != nil { | ||
100 | +// logs.Error(err) | ||
101 | +// c.ResponseError(errors.New("json数据解析失败")) | ||
102 | +// return | ||
103 | +// } | ||
104 | +// orderid, _ := strconv.ParseInt(param.Id, 10, 64) | ||
105 | +// companyId := c.GetUserCompany() | ||
106 | +// orderSrv := orderService.NewOrderInfoService(nil) | ||
107 | +// orderinfo, err := orderSrv.GetOrderDetail(orderQuery.GetOrderQuery{ | ||
108 | +// OrderId: orderid, | ||
109 | +// CompanyId: companyId, | ||
110 | +// }) | ||
111 | +// if err != nil { | ||
112 | +// c.ResponseError(err) | ||
113 | +// return | ||
114 | +// } | ||
115 | +// if orderinfo.OrderType != domain.OrderIntention { | ||
116 | +// c.ResponseError(errors.New("参数错误")) | ||
117 | +// return | ||
118 | +// } | ||
119 | +// allGoods := []map[string]interface{}{} | ||
120 | +// for _, v := range orderinfo.Goods { | ||
121 | +// m := map[string]interface{}{ | ||
122 | +// "id": v.Id, | ||
123 | +// "productName": v.GoodName, | ||
124 | +// "orderNum": v.PlanGoodNumber, | ||
125 | +// "univalence": v.Price, | ||
126 | +// "partnerRatio": v.PartnerBonusPercent, | ||
127 | +// "orderPrice": v.GoodCompute.PlanAmount, | ||
128 | +// } | ||
129 | +// allGoods = append(allGoods, m) | ||
130 | +// } | ||
131 | +// rsp := map[string]interface{}{ | ||
132 | +// "buyer": orderinfo.Buyer.BuyerName, | ||
133 | +// "id": orderinfo.Id, | ||
134 | +// "partnerID": orderinfo.PartnerInfo.Id, | ||
135 | +// "partner": orderinfo.PartnerInfo.PartnerName, | ||
136 | +// "orderDist": orderinfo.RegionInfo.RegionName, | ||
137 | +// "orderId": orderinfo.OrderCode, | ||
138 | +// "product": allGoods, | ||
139 | +// "commissionProportion": orderinfo.SalesmanBonusPercent, | ||
140 | +// "orderNumCount": orderinfo.OrderCompute.PlanOrderCount, | ||
141 | +// "orderAmountAdjustmentCount": orderinfo.OrderCompute.PlanOrderAmount, | ||
142 | +// } | ||
143 | +// c.ResponseData(rsp) | ||
144 | +// } | ||
146 | 145 | ||
147 | //RemoveOrderPurpose 删除意向订单 | 146 | //RemoveOrderPurpose 删除意向订单 |
148 | -func (c *OrderInfoController) RemoveOrderPurpose() { | ||
149 | - type Parameter struct { | ||
150 | - Id int64 `json:"id"` | ||
151 | - } | ||
152 | - var ( | ||
153 | - param Parameter | ||
154 | - err error | ||
155 | - ) | ||
156 | - if err = c.BindJsonData(¶m); err != nil { | ||
157 | - logs.Error(err) | ||
158 | - c.ResponseError(errors.New("json数据解析失败")) | ||
159 | - return | ||
160 | - } | ||
161 | - companyId := c.GetUserCompany() | ||
162 | - orderSrv := orderService.NewOrderInfoService(nil) | ||
163 | - err = orderSrv.DeleteOrder(param.Id, companyId) | ||
164 | - if err != nil { | ||
165 | - c.ResponseError(err) | ||
166 | - return | ||
167 | - } | ||
168 | - c.ResponseData(nil) | ||
169 | -} | 147 | +// func (c *OrderInfoController) RemoveOrderPurpose() { |
148 | +// type Parameter struct { | ||
149 | +// Id int64 `json:"id"` | ||
150 | +// } | ||
151 | +// var ( | ||
152 | +// param Parameter | ||
153 | +// err error | ||
154 | +// ) | ||
155 | +// if err = c.BindJsonData(¶m); err != nil { | ||
156 | +// logs.Error(err) | ||
157 | +// c.ResponseError(errors.New("json数据解析失败")) | ||
158 | +// return | ||
159 | +// } | ||
160 | +// companyId := c.GetUserCompany() | ||
161 | +// orderSrv := orderService.NewOrderInfoService(nil) | ||
162 | +// err = orderSrv.DeleteOrder(param.Id, companyId) | ||
163 | +// if err != nil { | ||
164 | +// c.ResponseError(err) | ||
165 | +// return | ||
166 | +// } | ||
167 | +// c.ResponseData(nil) | ||
168 | +// } | ||
170 | 169 | ||
171 | //postPurposeOrderDetail 请求添加/更新的订单数据 | 170 | //postPurposeOrderDetail 请求添加/更新的订单数据 |
172 | type postPurposeOrderDetail struct { | 171 | type postPurposeOrderDetail struct { |
@@ -252,34 +251,34 @@ func (postData *postOrderGood) Valid() error { | @@ -252,34 +251,34 @@ func (postData *postOrderGood) Valid() error { | ||
252 | return nil | 251 | return nil |
253 | } | 252 | } |
254 | 253 | ||
255 | -//UpdateOrderPurpose 更新意向订单 | ||
256 | -func (c *OrderInfoController) UpdateOrderPurpose() { | ||
257 | - //用与适配前端定义的数据结构 | ||
258 | - var ( | ||
259 | - param postPurposeOrderDetail | ||
260 | - err error | ||
261 | - ) | ||
262 | - if err = c.BindJsonData(¶m); err != nil { | ||
263 | - logs.Error(err) | ||
264 | - c.ResponseError(errors.New("json数据解析失败")) | ||
265 | - return | ||
266 | - } | ||
267 | - | ||
268 | - if err := param.Valid(); err != nil { | ||
269 | - c.ResponseError(err) | ||
270 | - return | ||
271 | - } | ||
272 | - if param.Id == 0 { | ||
273 | - err = c.addOrderPurpose(param) | ||
274 | - } else { | ||
275 | - err = c.editOrderPurpose(param) | ||
276 | - } | ||
277 | - if err != nil { | ||
278 | - c.ResponseError(err) | ||
279 | - } | ||
280 | - c.ResponseData(nil) | ||
281 | - return | ||
282 | -} | 254 | +// //UpdateOrderPurpose 更新意向订单 |
255 | +// func (c *OrderInfoController) UpdateOrderPurpose() { | ||
256 | +// //用与适配前端定义的数据结构 | ||
257 | +// var ( | ||
258 | +// param postPurposeOrderDetail | ||
259 | +// err error | ||
260 | +// ) | ||
261 | +// if err = c.BindJsonData(¶m); err != nil { | ||
262 | +// logs.Error(err) | ||
263 | +// c.ResponseError(errors.New("json数据解析失败")) | ||
264 | +// return | ||
265 | +// } | ||
266 | + | ||
267 | +// if err := param.Valid(); err != nil { | ||
268 | +// c.ResponseError(err) | ||
269 | +// return | ||
270 | +// } | ||
271 | +// if param.Id == 0 { | ||
272 | +// err = c.addOrderPurpose(param) | ||
273 | +// } else { | ||
274 | +// err = c.editOrderPurpose(param) | ||
275 | +// } | ||
276 | +// if err != nil { | ||
277 | +// c.ResponseError(err) | ||
278 | +// } | ||
279 | +// c.ResponseData(nil) | ||
280 | +// return | ||
281 | +// } | ||
283 | 282 | ||
284 | func (c *OrderInfoController) addOrderPurpose(param postPurposeOrderDetail) error { | 283 | func (c *OrderInfoController) addOrderPurpose(param postPurposeOrderDetail) error { |
285 | 284 | ||
@@ -364,49 +363,49 @@ func (postData *postOrderPurposeDelivery) Valid() error { | @@ -364,49 +363,49 @@ func (postData *postOrderPurposeDelivery) Valid() error { | ||
364 | } | 363 | } |
365 | 364 | ||
366 | //OrderPurposeDelivery 发货 意向订单转实发单 | 365 | //OrderPurposeDelivery 发货 意向订单转实发单 |
367 | -func (c *OrderInfoController) OrderPurposeDelivery() { | ||
368 | - //用与适配前端定义的数据结构 | ||
369 | - | ||
370 | - var ( | ||
371 | - param postOrderPurposeDelivery | ||
372 | - err error | ||
373 | - ) | ||
374 | - if err = c.BindJsonData(¶m); err != nil { | ||
375 | - logs.Error(err) | ||
376 | - c.ResponseError(errors.New("json数据解析失败")) | ||
377 | - return | ||
378 | - } | ||
379 | - param.ShipmentsId = strings.TrimSpace(param.ShipmentsId) | ||
380 | - orderid, _ := strconv.ParseInt(param.Id, 10, 64) | ||
381 | - if orderid <= 0 { | ||
382 | - c.ResponseError(errors.New("参数错误")) | ||
383 | - return | ||
384 | - } | ||
385 | - if err = param.Valid(); err != nil { | ||
386 | - c.ResponseError(err) | ||
387 | - return | ||
388 | - } | ||
389 | - goods := []orderCmd.OrderGoodData{} | ||
390 | - for _, v := range param.ProductDetail { | ||
391 | - g := orderCmd.OrderGoodData{ | ||
392 | - Id: v.Id, GoodName: v.ProductName, PlanGoodNumber: v.OrderNum, | ||
393 | - Price: v.Univalence, PartnerBonusPercent: v.PartnerRatio, | ||
394 | - } | ||
395 | - goods = append(goods, g) | ||
396 | - } | ||
397 | - companyId := c.GetUserCompany() | ||
398 | - deliveryCommand := orderCmd.OrderDeliveryCommand{ | ||
399 | - OrderId: orderid, DeliveryCode: param.ShipmentsId, | ||
400 | - DeliveryTime: time.Now(), Goods: goods, CompanyId: companyId, | ||
401 | - } | ||
402 | - orderSrv := orderService.NewOrderInfoService(nil) | ||
403 | - err = orderSrv.Delivery(deliveryCommand) | ||
404 | - if err != nil { | ||
405 | - c.ResponseError(err) | ||
406 | - } | ||
407 | - c.ResponseData(nil) | ||
408 | - return | ||
409 | -} | 366 | +// func (c *OrderInfoController) OrderPurposeDelivery() { |
367 | +// //用与适配前端定义的数据结构 | ||
368 | + | ||
369 | +// var ( | ||
370 | +// param postOrderPurposeDelivery | ||
371 | +// err error | ||
372 | +// ) | ||
373 | +// if err = c.BindJsonData(¶m); err != nil { | ||
374 | +// logs.Error(err) | ||
375 | +// c.ResponseError(errors.New("json数据解析失败")) | ||
376 | +// return | ||
377 | +// } | ||
378 | +// param.ShipmentsId = strings.TrimSpace(param.ShipmentsId) | ||
379 | +// orderid, _ := strconv.ParseInt(param.Id, 10, 64) | ||
380 | +// if orderid <= 0 { | ||
381 | +// c.ResponseError(errors.New("参数错误")) | ||
382 | +// return | ||
383 | +// } | ||
384 | +// if err = param.Valid(); err != nil { | ||
385 | +// c.ResponseError(err) | ||
386 | +// return | ||
387 | +// } | ||
388 | +// goods := []orderCmd.OrderGoodData{} | ||
389 | +// for _, v := range param.ProductDetail { | ||
390 | +// g := orderCmd.OrderGoodData{ | ||
391 | +// Id: v.Id, GoodName: v.ProductName, PlanGoodNumber: v.OrderNum, | ||
392 | +// Price: v.Univalence, PartnerBonusPercent: v.PartnerRatio, | ||
393 | +// } | ||
394 | +// goods = append(goods, g) | ||
395 | +// } | ||
396 | +// companyId := c.GetUserCompany() | ||
397 | +// deliveryCommand := orderCmd.OrderDeliveryCommand{ | ||
398 | +// OrderId: orderid, DeliveryCode: param.ShipmentsId, | ||
399 | +// DeliveryTime: time.Now(), Goods: goods, CompanyId: companyId, | ||
400 | +// } | ||
401 | +// orderSrv := orderService.NewOrderInfoService(nil) | ||
402 | +// err = orderSrv.Delivery(deliveryCommand) | ||
403 | +// if err != nil { | ||
404 | +// c.ResponseError(err) | ||
405 | +// } | ||
406 | +// c.ResponseData(nil) | ||
407 | +// return | ||
408 | +// } | ||
410 | 409 | ||
411 | //PageListOrderReal 获取实发订单列表 | 410 | //PageListOrderReal 获取实发订单列表 |
412 | func (c *OrderInfoController) PageListOrderReal() { | 411 | func (c *OrderInfoController) PageListOrderReal() { |
-
请 注册 或 登录 后发表评论