正在显示
4 个修改的文件
包含
91 行增加
和
20 行删除
@@ -147,14 +147,7 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( | @@ -147,14 +147,7 @@ func (service OrderInfoService) CreateNewOrder(cmd command.CreateOrderCommand) ( | ||
147 | defer func() { | 147 | defer func() { |
148 | transactionContext.RollbackTransaction() | 148 | transactionContext.RollbackTransaction() |
149 | }() | 149 | }() |
150 | - // orderDao, _ := factory.CreateOrderDao(map[string]interface{}{"transactionContext": transactionContext}) | ||
151 | - // ok, err := orderDao.OrderCodeIsExist(command.OrderCode, 0) | ||
152 | - // if err != nil { | ||
153 | - // return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
154 | - // } | ||
155 | - // if ok { | ||
156 | - // return lib.ThrowError(lib.BUSINESS_ERROR, "订单编号已存在") | ||
157 | - // } | 150 | + |
158 | var PartnerInfoRepository domain.PartnerInfoRepository | 151 | var PartnerInfoRepository domain.PartnerInfoRepository |
159 | if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ | 152 | if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ |
160 | "transactionContext": transactionContext, | 153 | "transactionContext": transactionContext, |
@@ -290,14 +283,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) | @@ -290,14 +283,7 @@ func (service OrderInfoService) UpdateOrderData(cmd command.UpdateOrderCommand) | ||
290 | defer func() { | 283 | defer func() { |
291 | transactionContext.RollbackTransaction() | 284 | transactionContext.RollbackTransaction() |
292 | }() | 285 | }() |
293 | - // orderDao, _ := factory.CreateOrderDao(map[string]interface{}{"transactionContext": transactionContext}) | ||
294 | - // ok, err := orderDao.OrderCodeIsExist(command.OrderCode, 0) | ||
295 | - // if err != nil { | ||
296 | - // return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
297 | - // } | ||
298 | - // if ok { | ||
299 | - // return lib.ThrowError(lib.BUSINESS_ERROR, "订单编号已存在") | ||
300 | - // } | 286 | + |
301 | var PartnerInfoRepository domain.PartnerInfoRepository | 287 | var PartnerInfoRepository domain.PartnerInfoRepository |
302 | if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ | 288 | if PartnerInfoRepository, err = factory.CreatePartnerInfoRepository(map[string]interface{}{ |
303 | "transactionContext": transactionContext, | 289 | "transactionContext": transactionContext, |
@@ -109,7 +109,6 @@ func (order *OrderBase) Compute() error { | @@ -109,7 +109,6 @@ func (order *OrderBase) Compute() error { | ||
109 | planPartnerBonus = planPartnerBonus.Add(decimal.NewFromFloat(order.Goods[i].GoodCompute.PlanPartnerBonus)) | 109 | planPartnerBonus = planPartnerBonus.Add(decimal.NewFromFloat(order.Goods[i].GoodCompute.PlanPartnerBonus)) |
110 | planOrderAmount = planOrderAmount.Add(decimal.NewFromFloat(order.Goods[i].GoodCompute.PlanAmount)) | 110 | planOrderAmount = planOrderAmount.Add(decimal.NewFromFloat(order.Goods[i].GoodCompute.PlanAmount)) |
111 | planOrderCount += order.Goods[i].PlanGoodNumber | 111 | planOrderCount += order.Goods[i].PlanGoodNumber |
112 | - | ||
113 | goodUseAmount := decimal.NewFromFloat(order.Goods[i].GoodCompute.UseAmount) | 112 | goodUseAmount := decimal.NewFromFloat(order.Goods[i].GoodCompute.UseAmount) |
114 | if goodUseAmount.GreaterThanOrEqual(decimal.NewFromFloat(0)) { | 113 | if goodUseAmount.GreaterThanOrEqual(decimal.NewFromFloat(0)) { |
115 | //调整值非负值得情况 | 114 | //调整值非负值得情况 |
1 | +package controllers | ||
2 | + | ||
3 | +import ( | ||
4 | + "errors" | ||
5 | + | ||
6 | + "github.com/astaxie/beego/logs" | ||
7 | + orderQuery "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/query" | ||
8 | + orderService "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/service" | ||
9 | + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain" | ||
10 | +) | ||
11 | + | ||
12 | +//OrderDividendController 订单分红管理 | ||
13 | +type OrderDividendController struct { | ||
14 | + BaseController | ||
15 | +} | ||
16 | + | ||
17 | +//Prepare 重写 BaseController 的Prepare方法 | ||
18 | +func (c *OrderDividendController) Prepare() { | ||
19 | + c.BaseController.Prepare() | ||
20 | + return | ||
21 | + if ok := c.ValidJWTToken(); !ok { | ||
22 | + return | ||
23 | + } | ||
24 | + if ok := c.ValidAdminPermission(domain.PERMISSION_DIVIDEND); !ok { | ||
25 | + return | ||
26 | + } | ||
27 | +} | ||
28 | + | ||
29 | +//PageListOrderDividend 获取实发订单分红列表 | ||
30 | +func (c *OrderDividendController) PageListOrderDividend() { | ||
31 | + type Parameter struct { | ||
32 | + SearchText string `json:"searchText"` | ||
33 | + Partner int64 `json:"partner"` | ||
34 | + PageSize int `json:"pageSize"` | ||
35 | + PageNumber int `json:"pageNumber"` | ||
36 | + } | ||
37 | + var ( | ||
38 | + param Parameter | ||
39 | + err error | ||
40 | + ) | ||
41 | + if err = c.BindJsonData(¶m); err != nil { | ||
42 | + logs.Error(err) | ||
43 | + c.ResponseError(errors.New("json数据解析失败")) | ||
44 | + return | ||
45 | + } | ||
46 | + if param.PageNumber == 0 { | ||
47 | + param.PageNumber = 1 | ||
48 | + } | ||
49 | + if param.PageSize == 0 { | ||
50 | + param.PageSize = 20 | ||
51 | + } | ||
52 | + | ||
53 | + orderSrv := orderService.NewOrderInfoService(nil) | ||
54 | + orderinfos, cnt, err := orderSrv.PageListOrderBase(orderQuery.ListOrderBaseQuery{ | ||
55 | + PartnerId: param.Partner, | ||
56 | + DeliveryCode: param.SearchText, | ||
57 | + OrderType: domain.OrderReal, | ||
58 | + Limit: param.PageSize, | ||
59 | + Offset: (param.PageNumber - 1) * param.PageSize, | ||
60 | + }) | ||
61 | + if err != nil { | ||
62 | + c.ResponseError(err) | ||
63 | + return | ||
64 | + } | ||
65 | + rsp := []map[string]interface{}{} | ||
66 | + for i := range orderinfos { | ||
67 | + orderinfo := orderinfos[i] | ||
68 | + m := map[string]interface{}{ | ||
69 | + "updateTime": orderinfo.UpdateTime.Local().Format("2006-01-02 15:04:05"), | ||
70 | + "id": orderinfo.Id, | ||
71 | + "shipmentsId": orderinfo.DeliveryCode, | ||
72 | + "partner": orderinfo.PartnerInfo.PartnerName, | ||
73 | + "dividendsReceivable": orderinfo.OrderCompute.PlanPartnerBonus, | ||
74 | + "dividendSpending": orderinfo.OrderCompute.PartnerBonusExpense, | ||
75 | + "receiveDividends": orderinfo.OrderCompute.PartnerBonusHas, | ||
76 | + "uncollectedDividends": orderinfo.OrderCompute.PartnerBonusNot, | ||
77 | + } | ||
78 | + if orderinfo.OrderCompute.UsePartnerBonus >= 0 { | ||
79 | + m["dividendsReceivable"] = orderinfo.OrderCompute.UsePartnerBonus | ||
80 | + } | ||
81 | + rsp = append(rsp, m) | ||
82 | + } | ||
83 | + c.ResponsePageList(rsp, cnt, param.PageNumber) | ||
84 | + return | ||
85 | +} |
@@ -28,9 +28,10 @@ func init() { | @@ -28,9 +28,10 @@ func init() { | ||
28 | beego.NSRouter("/set-status", &controllers.PartnerInfoController{}, "POST:PartnerInfoSetState"), | 28 | beego.NSRouter("/set-status", &controllers.PartnerInfoController{}, "POST:PartnerInfoSetState"), |
29 | ), | 29 | ), |
30 | beego.NSNamespace("/dividends", | 30 | beego.NSNamespace("/dividends", |
31 | - beego.NSRouter("/edit", &controllers.DividendsController{}, "POST:Edit"), | ||
32 | - beego.NSRouter("/detail", &controllers.DividendsController{}, "POST:Detail"), | ||
33 | - beego.NSRouter("/list", &controllers.DividendsController{}, "POST:List"), | 31 | + beego.NSRouter("/list", &controllers.OrderDividendController{}, "POST:PageListOrderDividend"), |
32 | + // beego.NSRouter("/edit", &controllers.DividendsController{}, "POST:Edit"), | ||
33 | + // beego.NSRouter("/detail", &controllers.DividendsController{}, "POST:Detail"), | ||
34 | + // beego.NSRouter("/list", &controllers.DividendsController{}, "POST:List"), | ||
34 | ), | 35 | ), |
35 | beego.NSNamespace("/order", | 36 | beego.NSNamespace("/order", |
36 | beego.NSRouter("/purpose/list", &controllers.OrderInfoController{}, "POST:PageListOrderPurpose"), | 37 | beego.NSRouter("/purpose/list", &controllers.OrderInfoController{}, "POST:PageListOrderPurpose"), |
-
请 注册 或 登录 后发表评论