正在显示
4 个修改的文件
包含
69 行增加
和
29 行删除
@@ -2,7 +2,6 @@ package command | @@ -2,7 +2,6 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | 4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" |
5 | - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
6 | ) | 5 | ) |
7 | 6 | ||
8 | type CreateDividendsReturnedOrderCommand struct { | 7 | type CreateDividendsReturnedOrderCommand struct { |
@@ -11,9 +10,14 @@ type CreateDividendsReturnedOrderCommand struct { | @@ -11,9 +10,14 @@ type CreateDividendsReturnedOrderCommand struct { | ||
11 | DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户 | 10 | DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户 |
12 | DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 | 11 | DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 |
13 | OriginalOrderNum string `json:"originalOrderNum"` //源单号 | 12 | OriginalOrderNum string `json:"originalOrderNum"` //源单号 |
14 | - //货品 | ||
15 | - OrderGoods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"orderGoods"` | ||
16 | - | 13 | + OrderGoods []struct { |
14 | + OrderGoodId int64 `json:"orderGoodId,string"` // 订单产品id | ||
15 | + CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 | ||
16 | + // OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 | ||
17 | + OrderGoodName string `json:"orderGoodName"` //订单产品名称 | ||
18 | + OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 | ||
19 | + OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 | ||
20 | + } `json:"orderGoods"` //货品 | ||
17 | DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期 | 21 | DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期 |
18 | OrderDate int64 `json:"orderDate"` //订单日期 | 22 | OrderDate int64 `json:"orderDate"` //订单日期 |
19 | Remarks string `json:"remarks"` // | 23 | Remarks string `json:"remarks"` // |
@@ -2,7 +2,6 @@ package command | @@ -2,7 +2,6 @@ package command | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | 4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" |
5 | - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
6 | ) | 5 | ) |
7 | 6 | ||
8 | type UpdateDividendsReturnedOrderCommand struct { | 7 | type UpdateDividendsReturnedOrderCommand struct { |
@@ -12,9 +11,14 @@ type UpdateDividendsReturnedOrderCommand struct { | @@ -12,9 +11,14 @@ type UpdateDividendsReturnedOrderCommand struct { | ||
12 | DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户 | 11 | DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户 |
13 | DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 | 12 | DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 |
14 | OriginalOrderNum string `json:"originalOrderNum"` //源单号 | 13 | OriginalOrderNum string `json:"originalOrderNum"` //源单号 |
15 | - //货品 | ||
16 | - OrderGoods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"orderGoods"` | ||
17 | - | 14 | + OrderGoods []struct { |
15 | + OrderGoodId int64 `json:"orderGoodId,string"` // 订单产品id | ||
16 | + CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 | ||
17 | + // OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 | ||
18 | + OrderGoodName string `json:"orderGoodName"` //订单产品名称 | ||
19 | + OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 | ||
20 | + OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 | ||
21 | + } `json:"orderGoods"` //货品 | ||
18 | DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期 | 22 | DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期 |
19 | OrderDate int64 `json:"orderDate"` //订单日期 | 23 | OrderDate int64 `json:"orderDate"` //订单日期 |
20 | 24 |
@@ -20,11 +20,23 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide | @@ -20,11 +20,23 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide | ||
20 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsReturnedOrderCommand.Operator) | 20 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsReturnedOrderCommand.Operator) |
21 | dividendsReturnedDate := time.Unix(createDividendsReturnedOrderCommand.DividendsReturnedDate/1e3, 0) | 21 | dividendsReturnedDate := time.Unix(createDividendsReturnedOrderCommand.DividendsReturnedDate/1e3, 0) |
22 | orderDate := time.Unix(createDividendsReturnedOrderCommand.OrderDate/1e3, 0) | 22 | orderDate := time.Unix(createDividendsReturnedOrderCommand.OrderDate/1e3, 0) |
23 | + var orderGooods []allied_creation_cooperation.ReqDividendsReturnedOrderGood | ||
24 | + for _, v := range createDividendsReturnedOrderCommand.OrderGoods { | ||
25 | + good := allied_creation_cooperation.ReqDividendsReturnedOrderGood{ | ||
26 | + CooperationContractNumber: v.CooperationContractNumber, | ||
27 | + OrderGoodAmount: 0, | ||
28 | + OrderGoodName: v.OrderGoodName, | ||
29 | + OrderGoodPrice: v.OrderGoodPrice, | ||
30 | + OrderGoodQuantity: v.OrderGoodQuantity, | ||
31 | + } | ||
32 | + good.OrderGoodPrice = good.OrderGoodPrice * float64(good.OrderGoodQuantity) | ||
33 | + orderGooods = append(orderGooods, good) | ||
34 | + } | ||
23 | result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{ | 35 | result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{ |
24 | DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName, | 36 | DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName, |
25 | DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber, | 37 | DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber, |
26 | OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum, | 38 | OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum, |
27 | - OrderGoods: createDividendsReturnedOrderCommand.OrderGoods, | 39 | + OrderGoods: orderGooods, |
28 | DividendsReturnedDate: dividendsReturnedDate, | 40 | DividendsReturnedDate: dividendsReturnedDate, |
29 | OrderData: orderDate, | 41 | OrderData: orderDate, |
30 | OrgId: int(createDividendsReturnedOrderCommand.Operator.OrgId), | 42 | OrgId: int(createDividendsReturnedOrderCommand.Operator.OrgId), |
@@ -86,12 +98,24 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide | @@ -86,12 +98,24 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide | ||
86 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsReturnedOrderCommand.Operator) | 98 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsReturnedOrderCommand.Operator) |
87 | dividendsReturnedDate := time.Unix(updateDividendsReturnedOrderCommand.DividendsReturnedDate/1e3, 0) | 99 | dividendsReturnedDate := time.Unix(updateDividendsReturnedOrderCommand.DividendsReturnedDate/1e3, 0) |
88 | orderDate := time.Unix(updateDividendsReturnedOrderCommand.OrderDate/1e3, 0) | 100 | orderDate := time.Unix(updateDividendsReturnedOrderCommand.OrderDate/1e3, 0) |
101 | + var orderGooods []allied_creation_cooperation.ReqDividendsReturnedOrderGood | ||
102 | + for _, v := range updateDividendsReturnedOrderCommand.OrderGoods { | ||
103 | + good := allied_creation_cooperation.ReqDividendsReturnedOrderGood{ | ||
104 | + CooperationContractNumber: v.CooperationContractNumber, | ||
105 | + OrderGoodAmount: 0, | ||
106 | + OrderGoodName: v.OrderGoodName, | ||
107 | + OrderGoodPrice: v.OrderGoodPrice, | ||
108 | + OrderGoodQuantity: v.OrderGoodQuantity, | ||
109 | + } | ||
110 | + good.OrderGoodPrice = good.OrderGoodPrice * float64(good.OrderGoodQuantity) | ||
111 | + orderGooods = append(orderGooods, good) | ||
112 | + } | ||
89 | _, err := creationCooperationGateway.DividendsReturnedOrderUpdate(allied_creation_cooperation.ReqDividendsReturnedOrderUpdate{ | 113 | _, err := creationCooperationGateway.DividendsReturnedOrderUpdate(allied_creation_cooperation.ReqDividendsReturnedOrderUpdate{ |
90 | DividendsReturnedOrderID: updateDividendsReturnedOrderCommand.DividendsReturnedOrderID, | 114 | DividendsReturnedOrderID: updateDividendsReturnedOrderCommand.DividendsReturnedOrderID, |
91 | DividendsReturnedCustomerName: updateDividendsReturnedOrderCommand.DividendsReturnedCustomerName, | 115 | DividendsReturnedCustomerName: updateDividendsReturnedOrderCommand.DividendsReturnedCustomerName, |
92 | DividendsOrderNumber: updateDividendsReturnedOrderCommand.DividendsOrderNumber, | 116 | DividendsOrderNumber: updateDividendsReturnedOrderCommand.DividendsOrderNumber, |
93 | OriginalOrderNum: updateDividendsReturnedOrderCommand.OriginalOrderNum, | 117 | OriginalOrderNum: updateDividendsReturnedOrderCommand.OriginalOrderNum, |
94 | - OrderGoods: updateDividendsReturnedOrderCommand.OrderGoods, | 118 | + OrderGoods: orderGooods, |
95 | DividendsReturnedDate: dividendsReturnedDate, | 119 | DividendsReturnedDate: dividendsReturnedDate, |
96 | OrderData: orderDate, | 120 | OrderData: orderDate, |
97 | OrgId: int(updateDividendsReturnedOrderCommand.Operator.OrgId), | 121 | OrgId: int(updateDividendsReturnedOrderCommand.Operator.OrgId), |
@@ -46,16 +46,24 @@ type ( | @@ -46,16 +46,24 @@ type ( | ||
46 | Goods []DividendsReturnedOrderGoods `json:"goods"` //货品 | 46 | Goods []DividendsReturnedOrderGoods `json:"goods"` //货品 |
47 | } | 47 | } |
48 | 48 | ||
49 | + // | ||
50 | + ReqDividendsReturnedOrderGood struct { | ||
51 | + CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 | ||
52 | + OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 | ||
53 | + OrderGoodName string `json:"orderGoodName"` //订单产品名称 | ||
54 | + OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 | ||
55 | + OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 | ||
56 | + } | ||
49 | ReqDividendsReturnedOrderAdd struct { | 57 | ReqDividendsReturnedOrderAdd struct { |
50 | - DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` | ||
51 | - DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 | ||
52 | - OriginalOrderNum string `json:"originalOrderNum"` | ||
53 | - OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"` | ||
54 | - DividendsReturnedDate time.Time `json:"dividendsReturnedDate"` | ||
55 | - OrderData time.Time `json:"orderData"` | ||
56 | - OrgId int `json:"orgId"` | ||
57 | - Remarks string `json:"remarks"` | ||
58 | - RegionName string `json:"regionName"` | 58 | + DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` |
59 | + DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 | ||
60 | + OriginalOrderNum string `json:"originalOrderNum"` | ||
61 | + OrderGoods []ReqDividendsReturnedOrderGood `json:"orderGoods"` | ||
62 | + DividendsReturnedDate time.Time `json:"dividendsReturnedDate"` | ||
63 | + OrderData time.Time `json:"orderData"` | ||
64 | + OrgId int `json:"orgId"` | ||
65 | + Remarks string `json:"remarks"` | ||
66 | + RegionName string `json:"regionName"` | ||
59 | } | 67 | } |
60 | 68 | ||
61 | DataDividendsReturnedOrderAdd struct { | 69 | DataDividendsReturnedOrderAdd struct { |
@@ -66,16 +74,16 @@ type ( | @@ -66,16 +74,16 @@ type ( | ||
66 | //更新分红退货单 | 74 | //更新分红退货单 |
67 | type ( | 75 | type ( |
68 | ReqDividendsReturnedOrderUpdate struct { | 76 | ReqDividendsReturnedOrderUpdate struct { |
69 | - DividendsReturnedOrderID int `json:"dividendsReturnedOrderId,string"` //分红退货单记录id | ||
70 | - DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` | ||
71 | - DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 | ||
72 | - OriginalOrderNum string `json:"originalOrderNum"` | ||
73 | - OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"` | ||
74 | - DividendsReturnedDate time.Time `json:"dividendsReturnedDate"` | ||
75 | - OrderData time.Time `json:"orderData"` | ||
76 | - OrgId int `json:"orgId"` | ||
77 | - Remarks string `json:"remarks"` | ||
78 | - RegionName string `json:"regionName"` | 77 | + DividendsReturnedOrderID int `json:"dividendsReturnedOrderId,string"` //分红退货单记录id |
78 | + DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` | ||
79 | + DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 | ||
80 | + OriginalOrderNum string `json:"originalOrderNum"` | ||
81 | + OrderGoods []ReqDividendsReturnedOrderGood `json:"orderGoods"` | ||
82 | + DividendsReturnedDate time.Time `json:"dividendsReturnedDate"` | ||
83 | + OrderData time.Time `json:"orderData"` | ||
84 | + OrgId int `json:"orgId"` | ||
85 | + Remarks string `json:"remarks"` | ||
86 | + RegionName string `json:"regionName"` | ||
79 | } | 87 | } |
80 | 88 | ||
81 | DataDividendsReturnedOrderUpdate struct { | 89 | DataDividendsReturnedOrderUpdate struct { |
-
请 注册 或 登录 后发表评论