正在显示
5 个修改的文件
包含
62 行增加
和
12 行删除
@@ -39,6 +39,7 @@ func (service OrderService) PageListOrder(listOrderQuery query.ListOrderQuery) ( | @@ -39,6 +39,7 @@ func (service OrderService) PageListOrder(listOrderQuery query.ListOrderQuery) ( | ||
39 | OrderCode: listOrderQuery.OrderCode, | 39 | OrderCode: listOrderQuery.OrderCode, |
40 | Offset: listOrderQuery.Offset, | 40 | Offset: listOrderQuery.Offset, |
41 | Limit: listOrderQuery.Limit, | 41 | Limit: listOrderQuery.Limit, |
42 | + OrderType: listOrderQuery.OrderType, | ||
42 | } | 43 | } |
43 | orders, err = orderRepository.Find(query) | 44 | orders, err = orderRepository.Find(query) |
44 | if err != nil { | 45 | if err != nil { |
@@ -282,6 +283,9 @@ func (service OrderService) RemoveOrder(id int64) error { | @@ -282,6 +283,9 @@ func (service OrderService) RemoveOrder(id int64) error { | ||
282 | if err != nil { | 283 | if err != nil { |
283 | return lib.ThrowError(lib.RES_NO_FIND_ERROR, err.Error()) | 284 | return lib.ThrowError(lib.RES_NO_FIND_ERROR, err.Error()) |
284 | } | 285 | } |
286 | + if order.OrderType != domain.OrderIntention { | ||
287 | + return lib.ThrowError(lib.BUSINESS_ERROR, "订单不是意向单") | ||
288 | + } | ||
285 | err = orderRepository.Remove(order.Id) | 289 | err = orderRepository.Remove(order.Id) |
286 | if err != nil { | 290 | if err != nil { |
287 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 291 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -289,7 +293,7 @@ func (service OrderService) RemoveOrder(id int64) error { | @@ -289,7 +293,7 @@ func (service OrderService) RemoveOrder(id int64) error { | ||
289 | return nil | 293 | return nil |
290 | } | 294 | } |
291 | 295 | ||
292 | -//UpdateOrderReal 更新实发单 | 296 | +//UpdateOrderReal 更新为实发单 |
293 | func (service OrderService) UpdateOrderReal(command command.UpdateOrderRealCommand) error { | 297 | func (service OrderService) UpdateOrderReal(command command.UpdateOrderRealCommand) error { |
294 | var ( | 298 | var ( |
295 | transactionContext, _ = factory.CreateTransactionContext(nil) | 299 | transactionContext, _ = factory.CreateTransactionContext(nil) |
@@ -88,13 +88,13 @@ func (repository OrderRepository) Find(queryOption domain.OrderFindQuery) ([]dom | @@ -88,13 +88,13 @@ func (repository OrderRepository) Find(queryOption domain.OrderFindQuery) ([]dom | ||
88 | orderModels := []models.Order{} | 88 | orderModels := []models.Order{} |
89 | query := db.Model(&orderModels) | 89 | query := db.Model(&orderModels) |
90 | if queryOption.PartnerId > 0 { | 90 | if queryOption.PartnerId > 0 { |
91 | - query = query.Where("order.partner_id=?", queryOption.PartnerId) | 91 | + query = query.Where("partner_id=?", queryOption.PartnerId) |
92 | } | 92 | } |
93 | if len(queryOption.OrderCode) > 0 { | 93 | if len(queryOption.OrderCode) > 0 { |
94 | - query = query.Where("order.order_code like ?", "%"+queryOption.OrderCode+"%") | 94 | + query = query.Where("order_code like ?", "%"+queryOption.OrderCode+"%") |
95 | } | 95 | } |
96 | if queryOption.OrderType > 0 { | 96 | if queryOption.OrderType > 0 { |
97 | - query = query.Where("order.order_type=?", queryOption.OrderType) | 97 | + query = query.Where("order_type=?", queryOption.OrderType) |
98 | } | 98 | } |
99 | if queryOption.Offset > -1 { | 99 | if queryOption.Offset > -1 { |
100 | query = query.Offset(queryOption.Offset) | 100 | query = query.Offset(queryOption.Offset) |
@@ -108,7 +108,7 @@ func (repository OrderRepository) Find(queryOption domain.OrderFindQuery) ([]dom | @@ -108,7 +108,7 @@ func (repository OrderRepository) Find(queryOption domain.OrderFindQuery) ([]dom | ||
108 | err error | 108 | err error |
109 | ordersReturn = make([]domain.Order, 0) | 109 | ordersReturn = make([]domain.Order, 0) |
110 | ) | 110 | ) |
111 | - query = query.Order("order.id DESC ") | 111 | + query = query.Order("order.id DESC") |
112 | err = query.Select() | 112 | err = query.Select() |
113 | if err != nil { | 113 | if err != nil { |
114 | return ordersReturn, err | 114 | return ordersReturn, err |
@@ -128,10 +128,13 @@ func (repository OrderRepository) CountAll(queryOption domain.OrderFindQuery) (i | @@ -128,10 +128,13 @@ func (repository OrderRepository) CountAll(queryOption domain.OrderFindQuery) (i | ||
128 | orderModels := []models.Order{} | 128 | orderModels := []models.Order{} |
129 | query := db.Model(&orderModels) | 129 | query := db.Model(&orderModels) |
130 | if queryOption.PartnerId > 0 { | 130 | if queryOption.PartnerId > 0 { |
131 | - query = query.Where("order.partner_id=?", queryOption.PartnerId) | 131 | + query = query.Where("partner_id=?", queryOption.PartnerId) |
132 | } | 132 | } |
133 | if len(queryOption.OrderCode) > 0 { | 133 | if len(queryOption.OrderCode) > 0 { |
134 | - query = query.Where("order.order_code like ?", "%"+queryOption.OrderCode+"%") | 134 | + query = query.Where("order_code like ?", "%"+queryOption.OrderCode+"%") |
135 | + } | ||
136 | + if queryOption.OrderType > 0 { | ||
137 | + query = query.Where("order_type=?", queryOption.OrderType) | ||
135 | } | 138 | } |
136 | var ( | 139 | var ( |
137 | err error | 140 | err error |
@@ -140,7 +143,7 @@ func (repository OrderRepository) CountAll(queryOption domain.OrderFindQuery) (i | @@ -140,7 +143,7 @@ func (repository OrderRepository) CountAll(queryOption domain.OrderFindQuery) (i | ||
140 | if err != nil { | 143 | if err != nil { |
141 | return cnt, err | 144 | return cnt, err |
142 | } | 145 | } |
143 | - return 0, nil | 146 | + return cnt, nil |
144 | } | 147 | } |
145 | 148 | ||
146 | func (repository OrderRepository) FindOne(qureyOptions domain.OrderFindOneQuery) (*domain.Order, error) { | 149 | func (repository OrderRepository) FindOne(qureyOptions domain.OrderFindOneQuery) (*domain.Order, error) { |
1 | package controllers | 1 | package controllers |
2 | + | ||
3 | +import ( | ||
4 | + partnerQuery "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/partnerInfo/query" | ||
5 | + partnerInfoService "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/partnerInfo/service" | ||
6 | +) | ||
7 | + | ||
8 | +type CommonController struct { | ||
9 | + BaseController | ||
10 | +} | ||
11 | + | ||
12 | +////Prepare 重写 BaseController 的Prepare方法 | ||
13 | +func (c *CommonController) Prepare() { | ||
14 | + c.BaseController.Prepare() | ||
15 | + if ok := c.ValidJWTToken(); !ok { | ||
16 | + return | ||
17 | + } | ||
18 | +} | ||
19 | + | ||
20 | +// GetPartnerList 下拉选项数据通用接口,获取合伙人列表 | ||
21 | +func (c *CommonController) GetPartnerList() { | ||
22 | + query := partnerQuery.ListPartnerInfoQuery{ | ||
23 | + Limit: 2000, | ||
24 | + Offset: 0, | ||
25 | + } | ||
26 | + newPartnerService := partnerInfoService.NewPartnerInfoService(nil) | ||
27 | + _, partners, err := newPartnerService.ListPartnerInfo(&query) | ||
28 | + if err != nil { | ||
29 | + c.ResponseError(err) | ||
30 | + return | ||
31 | + } | ||
32 | + resp := []map[string]interface{}{} | ||
33 | + for i := range partners { | ||
34 | + m := map[string]interface{}{ | ||
35 | + "id": partners[i].Partner.Id, | ||
36 | + "account": partners[i].Partner.Account, | ||
37 | + "partnerName": partners[i].Partner.PartnerName, | ||
38 | + } | ||
39 | + | ||
40 | + resp = append(resp, m) | ||
41 | + } | ||
42 | + c.ResponseData(resp) | ||
43 | +} |
@@ -229,7 +229,7 @@ func (c *OrderController) PageListOrderPurpose() { | @@ -229,7 +229,7 @@ func (c *OrderController) PageListOrderPurpose() { | ||
229 | "partner": orderinfo.PartnerInfo.PartnerName, | 229 | "partner": orderinfo.PartnerInfo.PartnerName, |
230 | "partnerRatio": orderinfo.PartnerBonusPercent, | 230 | "partnerRatio": orderinfo.PartnerBonusPercent, |
231 | "orderName": orderinfo.OrderName, | 231 | "orderName": orderinfo.OrderName, |
232 | - "OrderNum": orderinfo.OrderCount, | 232 | + "orderNum": orderinfo.OrderCount, |
233 | "orderPrice": orderinfo.OrderAmount, | 233 | "orderPrice": orderinfo.OrderAmount, |
234 | "orderDist": orderinfo.OrderRegionInfo.RegionName, | 234 | "orderDist": orderinfo.OrderRegionInfo.RegionName, |
235 | "orderStatue": orderinfo.OrderStatus, | 235 | "orderStatue": orderinfo.OrderStatus, |
@@ -310,7 +310,7 @@ func (c *OrderController) PageListOrderReal() { | @@ -310,7 +310,7 @@ func (c *OrderController) PageListOrderReal() { | ||
310 | "partner": orderinfo.PartnerInfo.PartnerName, | 310 | "partner": orderinfo.PartnerInfo.PartnerName, |
311 | "partnerRatio": orderinfo.PartnerBonusPercent, | 311 | "partnerRatio": orderinfo.PartnerBonusPercent, |
312 | "orderName": orderinfo.OrderName, | 312 | "orderName": orderinfo.OrderName, |
313 | - "OrderNum": orderinfo.OrderCount, | 313 | + "orderNum": orderinfo.OrderCount, |
314 | "orderPrice": orderinfo.OrderAmount, | 314 | "orderPrice": orderinfo.OrderAmount, |
315 | "orderActualNum": orderinfo.OrderActualCount, | 315 | "orderActualNum": orderinfo.OrderActualCount, |
316 | "orderActualPrice": orderinfo.OrderActualAmount, | 316 | "orderActualPrice": orderinfo.OrderActualAmount, |
@@ -42,8 +42,9 @@ func init() { | @@ -42,8 +42,9 @@ func init() { | ||
42 | beego.NSRouter("/actual/update", &controllers.OrderController{}, "POST:UpdateOrderReal"), | 42 | beego.NSRouter("/actual/update", &controllers.OrderController{}, "POST:UpdateOrderReal"), |
43 | beego.NSRouter("/actual/detail", &controllers.OrderController{}, "POST:GetOrderReal"), | 43 | beego.NSRouter("/actual/detail", &controllers.OrderController{}, "POST:GetOrderReal"), |
44 | ), | 44 | ), |
45 | - beego.NSNamespace("/common"), // beego.NSRouter("/partner", &controllers.OrderController{}, "POST:PageListOrderPurpose"), | ||
46 | - | 45 | + beego.NSNamespace("/common", |
46 | + beego.NSRouter("/partner", &controllers.CommonController{}, "POST:GetPartnerList"), | ||
47 | + ), | ||
47 | ) | 48 | ) |
48 | beego.AddNamespace(adminRouter) | 49 | beego.AddNamespace(adminRouter) |
49 | } | 50 | } |
-
请 注册 或 登录 后发表评论