|
@@ -8,7 +8,37 @@ import ( |
|
@@ -8,7 +8,37 @@ import ( |
8
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
|
8
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
|
9
|
)
|
9
|
)
|
10
|
|
10
|
|
11
|
-//ReqImportDividendsReturnedOrder 导入退货数据
|
11
|
+// ReqImportDividendsOrder 导入订单数据
|
|
|
12
|
+type (
|
|
|
13
|
+ ImportDividendsOrderData struct {
|
|
|
14
|
+ DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户名称
|
|
|
15
|
+ OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
|
|
|
16
|
+ OrderGoodName string `json:"orderGoodName"` //订单产品名称
|
|
|
17
|
+ DividendsReturnedDate string `json:"dividendsReturnedDate"` //退货日期
|
|
|
18
|
+ RegionName string `json:"regionName"` //退货区域名称
|
|
|
19
|
+ OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
|
|
|
20
|
+ OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
|
|
|
21
|
+ CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
|
|
|
22
|
+ OrderTime string `json:"orderTime"` //订单日期
|
|
|
23
|
+ }
|
|
|
24
|
+ // ReqImportDividendsOrder 请求参数
|
|
|
25
|
+ ReqImportDividendsOrder struct {
|
|
|
26
|
+ // 分红退货单数据
|
|
|
27
|
+ DividendsOrderData []ImportDividendsOrderData `json:"dividendsOrderData"` //分红订单数据列表
|
|
|
28
|
+ }
|
|
|
29
|
+ // DataImportDividendsOrder 响应参数
|
|
|
30
|
+ DataImportDividendsOrder struct {
|
|
|
31
|
+ SuccessCount int `json:"successCount"`
|
|
|
32
|
+ Fail struct {
|
|
|
33
|
+ Header struct {
|
|
|
34
|
+ } `json:"header"`
|
|
|
35
|
+ Body []struct {
|
|
|
36
|
+ } `json:"body"`
|
|
|
37
|
+ } `json:"fail"`
|
|
|
38
|
+ }
|
|
|
39
|
+)
|
|
|
40
|
+
|
|
|
41
|
+//ReqImportDividendsReturnedOrder 导入退货单数据
|
12
|
type (
|
42
|
type (
|
13
|
ImportDividendsReturnedOrderData struct {
|
43
|
ImportDividendsReturnedOrderData struct {
|
14
|
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户名称
|
44
|
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户名称
|
|
@@ -21,12 +51,12 @@ type ( |
|
@@ -21,12 +51,12 @@ type ( |
21
|
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
|
51
|
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
|
22
|
OrderTime string `json:"orderTime"` //订单日期
|
52
|
OrderTime string `json:"orderTime"` //订单日期
|
23
|
}
|
53
|
}
|
24
|
- //请求参数
|
54
|
+ // ReqImportDividendsReturnedOrder 请求参数
|
25
|
ReqImportDividendsReturnedOrder struct {
|
55
|
ReqImportDividendsReturnedOrder struct {
|
26
|
// 分红退货单数据
|
56
|
// 分红退货单数据
|
27
|
DividendsReturnedOrderData []ImportDividendsReturnedOrderData `json:"dividendsReturnedOrderData"` //分红退货单数据列表
|
57
|
DividendsReturnedOrderData []ImportDividendsReturnedOrderData `json:"dividendsReturnedOrderData"` //分红退货单数据列表
|
28
|
}
|
58
|
}
|
29
|
- //响应参数
|
59
|
+ // DataImportDividendsReturnedOrder 响应参数
|
30
|
DataImportDividendsReturnedOrder struct {
|
60
|
DataImportDividendsReturnedOrder struct {
|
31
|
SuccessCount int `json:"successCount"`
|
61
|
SuccessCount int `json:"successCount"`
|
32
|
Fail struct {
|
62
|
Fail struct {
|
|
@@ -38,14 +68,42 @@ type ( |
|
@@ -38,14 +68,42 @@ type ( |
38
|
}
|
68
|
}
|
39
|
)
|
69
|
)
|
40
|
|
70
|
|
41
|
-// ImportDividendsReturnedOrder 导入退货数据
|
|
|
42
|
-func (gateway HttplibAlliedCreationCooperation) ImportDividendsReturnedOrder(param ReqImportDividendsReturnedOrder) (*DataImportDividendsReturnedOrder, error) {
|
71
|
+func (gateway HttplibAlliedCreationCooperation) ImportDividendsOrder(param ReqImportDividendsOrder) (*DataImportDividendsOrder, error) {
|
|
|
72
|
+ url := gateway.baseUrL + "/dividends-orders/import"
|
|
|
73
|
+ method := "POST"
|
|
|
74
|
+ req := gateway.CreateRequest(url, method)
|
|
|
75
|
+ log.Logger.Debug("向业务模块请求数据:导入订单数据", map[string]interface{}{
|
|
|
76
|
+ "api": method + ":" + url,
|
|
|
77
|
+ })
|
|
|
78
|
+ req, err := req.JSONBody(param)
|
|
|
79
|
+ if err != nil {
|
|
|
80
|
+ return nil, fmt.Errorf("请求导入订单数据失败:%w", err)
|
|
|
81
|
+ }
|
|
|
82
|
+
|
|
|
83
|
+ byteResult, err := req.Bytes()
|
|
|
84
|
+ if err != nil {
|
|
|
85
|
+ return nil, fmt.Errorf("获取导入订单数据失败:%w", err)
|
|
|
86
|
+ }
|
|
|
87
|
+ log.Logger.Debug("获取业务耐磨块请求数据:导入订单数据", map[string]interface{}{
|
|
|
88
|
+ "result": string(byteResult),
|
|
|
89
|
+ })
|
|
|
90
|
+ var result service_gateway.GatewayResponse
|
|
|
91
|
+ err = json.Unmarshal(byteResult, &result)
|
|
|
92
|
+ if err != nil {
|
|
|
93
|
+ return nil, fmt.Errorf("解析导入订单数据:%w", err)
|
|
|
94
|
+ }
|
|
|
95
|
+ var data DataImportDividendsOrder
|
|
|
96
|
+ err = gateway.GetResponseData(result, &data)
|
|
|
97
|
+ return &data, err
|
|
|
98
|
+}
|
43
|
|
99
|
|
|
|
100
|
+// ImportDividendsReturnedOrder 导入退货单数据
|
|
|
101
|
+func (gateway HttplibAlliedCreationCooperation) ImportDividendsReturnedOrder(param ReqImportDividendsReturnedOrder) (*DataImportDividendsReturnedOrder, error) {
|
44
|
url := gateway.baseUrL + "/dividends-returned-orders/import"
|
102
|
url := gateway.baseUrL + "/dividends-returned-orders/import"
|
45
|
method := "POST"
|
103
|
method := "POST"
|
46
|
req := gateway.CreateRequest(url, method)
|
104
|
req := gateway.CreateRequest(url, method)
|
47
|
// oneDemo
|
105
|
// oneDemo
|
48
|
- log.Logger.Debug("向业务模块请求数据:导入退货数据。", map[string]interface{}{
|
106
|
+ log.Logger.Debug("向业务模块请求数据:导入退货单数据。", map[string]interface{}{
|
49
|
"api": method + ":" + url,
|
107
|
"api": method + ":" + url,
|
50
|
})
|
108
|
})
|
51
|
req, err := req.JSONBody(param)
|
109
|
req, err := req.JSONBody(param)
|