作者 tangxuhui

补充分红单路由

@@ -15,7 +15,7 @@ type DividendsOrder struct { @@ -15,7 +15,7 @@ type DividendsOrder struct {
15 DividendTime int64 `json:"dividendTime"` //分红订单分红时间 15 DividendTime int64 `json:"dividendTime"` //分红订单分红时间
16 DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额 16 DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
17 DividendsOrderID int `json:"dividendsOrderId"` //分红订单 17 DividendsOrderID int `json:"dividendsOrderId"` //分红订单
18 - DividendsOrderNumber int `json:"dividendsOrderNumber"` //分红订单号 18 + DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
19 DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号 19 DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
20 OrderSalesman struct { //订单业务员 20 OrderSalesman struct { //订单业务员
21 Department struct { 21 Department struct {
  1 +package query
  2 +
  3 +import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  4 +
  5 +type SelectorDividendsOrderQuery struct {
  6 + Operator domain.Operator `json:"-"`
  7 + DividendsOrderNumber string `json:"DividendsOrderNumber"`
  8 +}
@@ -84,6 +84,31 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide @@ -84,6 +84,31 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
84 return updateDividendsReturnedOrderCommand, nil 84 return updateDividendsReturnedOrderCommand, nil
85 } 85 }
86 86
  87 +// 更新分红退货单服务
  88 +func (dividendsReturnedOrderService *DividendsReturnedOrderService) SelectorDividendsOrder(selectorDividendsOrderQuery *query.SelectorDividendsOrderQuery) (
  89 + int, interface{}, error) {
  90 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(selectorDividendsOrderQuery.Operator)
  91 + result, err := creationCooperationGateway.DividendsOrderSearch(allied_creation_cooperation.ReqDividendsOrderSearch{
  92 + DividendsOrderNumber: selectorDividendsOrderQuery.DividendsOrderNumber,
  93 + PageNumber: 1,
  94 + PageSize: 999,
  95 + })
  96 + if err != nil {
  97 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  98 + }
  99 + listData := []map[string]interface{}{}
  100 + for _, v := range result.Gride.List {
  101 + m := map[string]interface{}{
  102 + "dividendsOrderNumber": v.DividendsOrderNumber,
  103 + "dividendsOriginalOrderNum": v.DividendsOriginalOrderNum,
  104 + "dividendsOrderId": strconv.Itoa(v.DividendsOrderID),
  105 + "dividendTime": v.DividendTime.Unix(),
  106 + }
  107 + listData = append(listData, m)
  108 + }
  109 + return result.Gride.Total, listData, nil
  110 +}
  111 +
87 func NewDividendsReturnedOrderService(options map[string]interface{}) *DividendsReturnedOrderService { 112 func NewDividendsReturnedOrderService(options map[string]interface{}) *DividendsReturnedOrderService {
88 newDividendsReturnedOrderService := &DividendsReturnedOrderService{} 113 newDividendsReturnedOrderService := &DividendsReturnedOrderService{}
89 return newDividendsReturnedOrderService 114 return newDividendsReturnedOrderService
@@ -15,7 +15,7 @@ type DividendsOrder struct { @@ -15,7 +15,7 @@ type DividendsOrder struct {
15 DividendTime time.Time `json:"dividendTime"` //分红订单分红时间 15 DividendTime time.Time `json:"dividendTime"` //分红订单分红时间
16 DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额 16 DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额
17 DividendsOrderID int `json:"dividendsOrderId"` //分红订单 17 DividendsOrderID int `json:"dividendsOrderId"` //分红订单
18 - DividendsOrderNumber int `json:"dividendsOrderNumber"` //分红订单号 18 + DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号
19 DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号 19 DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号
20 OrderSalesman struct { //订单业务员 20 OrderSalesman struct { //订单业务员
21 Department struct { 21 Department struct {
@@ -70,3 +70,15 @@ func (controller *DividendsReturnedOrderController) SearchDividendsReturnedOrder @@ -70,3 +70,15 @@ func (controller *DividendsReturnedOrderController) SearchDividendsReturnedOrder
70 cnt, data, err := dividendsReturnedOrderService.SearchDividendsReturnedOrder(searchDividendsReturnedOrderQuery) 70 cnt, data, err := dividendsReturnedOrderService.SearchDividendsReturnedOrder(searchDividendsReturnedOrderQuery)
71 controller.ReturnPageListData(int64(cnt), data, err, searchDividendsReturnedOrderQuery.PageNumber) 71 controller.ReturnPageListData(int64(cnt), data, err, searchDividendsReturnedOrderQuery.PageNumber)
72 } 72 }
  73 +
  74 +func (controller *DividendsReturnedOrderController) SelectorDividendsOrder() {
  75 + dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil)
  76 + selectorDividendsOrderQuery := &query.SelectorDividendsOrderQuery{}
  77 + err := controller.Unmarshal(selectorDividendsOrderQuery)
  78 + if err != nil {
  79 + log.Logger.Debug("json err:" + err.Error())
  80 + }
  81 + selectorDividendsOrderQuery.Operator = controller.GetOperator()
  82 + cnt, data, err := dividendsReturnedOrderService.SelectorDividendsOrder(selectorDividendsOrderQuery)
  83 + controller.ReturnPageListData(int64(cnt), data, err, 0)
  84 +}
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/v1/web/dividends-order/", &web_client.DividendsOrderController{}, "Post:CreateDividendsOrder")
  10 + web.Router("/v1/web/dividends-order/:orderId", &web_client.DividendsOrderController{}, "Put:UpdateDividendsOrder")
  11 + web.Router("/v1/web/dividends-order/remove", &web_client.DividendsOrderController{}, "Post:RemoveDividendsOrder")
  12 + web.Router("/v1/web/dividends-order/:orderId", &web_client.DividendsOrderController{}, "Get:GetDividendsOrder")
  13 + web.Router("/v1/web/dividends-order/search", &web_client.DividendsOrderController{}, "Post:SearchDividendsOrder")
  14 +}
@@ -11,4 +11,5 @@ func init() { @@ -11,4 +11,5 @@ func init() {
11 web.Router("/v1/web/dividends-returned-order/:projectId", &web_client.DividendsReturnedOrderController{}, "Delete:RemoveDividendsReturnedOrder") 11 web.Router("/v1/web/dividends-returned-order/:projectId", &web_client.DividendsReturnedOrderController{}, "Delete:RemoveDividendsReturnedOrder")
12 web.Router("/v1/web/dividends-returned-order/:projectId", &web_client.DividendsReturnedOrderController{}, "Get:GetDividendsReturnedOrder") 12 web.Router("/v1/web/dividends-returned-order/:projectId", &web_client.DividendsReturnedOrderController{}, "Get:GetDividendsReturnedOrder")
13 web.Router("/v1/web/dividends-returned-order/search", &web_client.DividendsReturnedOrderController{}, "Post:SearchDividendsReturnedOrder") 13 web.Router("/v1/web/dividends-returned-order/search", &web_client.DividendsReturnedOrderController{}, "Post:SearchDividendsReturnedOrder")
  14 + web.Router("/v1/web/dividends-returned-order/selector/dividends-order", &web_client.DividendsReturnedOrderController{}, "Post:SelectorDividendsOrder")
14 } 15 }