1
|
-package allied_creation_cooperation
|
|
|
2
|
-
|
|
|
3
|
-import (
|
|
|
4
|
- "encoding/json"
|
|
|
5
|
- "fmt"
|
|
|
6
|
-
|
|
|
7
|
- "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
|
|
|
8
|
- "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
|
|
|
9
|
-)
|
|
|
10
|
-
|
|
|
11
|
-//ReqImportDividendsReturnedOrder 导入退货数据
|
|
|
12
|
-type (
|
|
|
13
|
- ImportDividendsReturnedOrderData 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
|
- //请求参数
|
|
|
25
|
- ReqImportDividendsReturnedOrder struct {
|
|
|
26
|
- // 分红退货单数据
|
|
|
27
|
- DividendsReturnedOrderData []ImportDividendsReturnedOrderData `json:"dividendsReturnedOrderData"` //分红退货单数据列表
|
|
|
28
|
- }
|
|
|
29
|
- //响应参数
|
|
|
30
|
- DataImportDividendsReturnedOrder 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
|
-// ImportDividendsReturnedOrder 导入退货数据
|
|
|
42
|
-func (gateway HttplibAlliedCreationCooperation) ImportDividendsReturnedOrder(param ReqImportDividendsReturnedOrder) (*DataImportDividendsReturnedOrder, error) {
|
|
|
43
|
-
|
|
|
44
|
- url := gateway.baseUrL + "/dividends-returned-orders/import"
|
|
|
45
|
- method := "POST"
|
|
|
46
|
- req := gateway.CreateRequest(url, method)
|
|
|
47
|
- // oneDemo
|
|
|
48
|
- log.Logger.Debug("向业务模块请求数据:导入退货数据。", map[string]interface{}{
|
|
|
49
|
- "api": method + ":" + url,
|
|
|
50
|
- })
|
|
|
51
|
- req, err := req.JSONBody(param)
|
|
|
52
|
- if err != nil {
|
|
|
53
|
- return nil, fmt.Errorf("请求导入退货数据失败:%w", err)
|
|
|
54
|
- }
|
|
|
55
|
-
|
|
|
56
|
- byteResult, err := req.Bytes()
|
|
|
57
|
- if err != nil {
|
|
|
58
|
- return nil, fmt.Errorf("获取导入退货数据失败:%w", err)
|
|
|
59
|
- }
|
|
|
60
|
- log.Logger.Debug("获取业务模块请求数据:导入退货数据。", map[string]interface{}{
|
|
|
61
|
- "result": string(byteResult),
|
|
|
62
|
- })
|
|
|
63
|
- var result service_gateway.GatewayResponse
|
|
|
64
|
- err = json.Unmarshal(byteResult, &result)
|
|
|
65
|
- if err != nil {
|
|
|
66
|
- return nil, fmt.Errorf("解析导入退货数据:%w", err)
|
|
|
67
|
- }
|
|
|
68
|
- var data DataImportDividendsReturnedOrder
|
|
|
69
|
- err = gateway.GetResponseData(result, &data)
|
|
|
70
|
- return &data, err
|
|
|
71
|
-} |
1
|
+package allied_creation_cooperation
|
|
|
2
|
+
|
|
|
3
|
+import (
|
|
|
4
|
+ "encoding/json"
|
|
|
5
|
+ "fmt"
|
|
|
6
|
+
|
|
|
7
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
|
|
|
8
|
+ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
|
|
|
9
|
+)
|
|
|
10
|
+
|
|
|
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 导入退货单数据
|
|
|
42
|
+type (
|
|
|
43
|
+ ImportDividendsReturnedOrderData struct {
|
|
|
44
|
+ DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户名称
|
|
|
45
|
+ OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
|
|
|
46
|
+ OrderGoodName string `json:"orderGoodName"` //订单产品名称
|
|
|
47
|
+ DividendsReturnedDate string `json:"dividendsReturnedDate"` //退货日期
|
|
|
48
|
+ RegionName string `json:"regionName"` //退货区域名称
|
|
|
49
|
+ OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
|
|
|
50
|
+ OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
|
|
|
51
|
+ CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
|
|
|
52
|
+ OrderTime string `json:"orderTime"` //订单日期
|
|
|
53
|
+ }
|
|
|
54
|
+ // ReqImportDividendsReturnedOrder 请求参数
|
|
|
55
|
+ ReqImportDividendsReturnedOrder struct {
|
|
|
56
|
+ // 分红退货单数据
|
|
|
57
|
+ DividendsReturnedOrderData []ImportDividendsReturnedOrderData `json:"dividendsReturnedOrderData"` //分红退货单数据列表
|
|
|
58
|
+ }
|
|
|
59
|
+ // DataImportDividendsReturnedOrder 响应参数
|
|
|
60
|
+ DataImportDividendsReturnedOrder struct {
|
|
|
61
|
+ SuccessCount int `json:"successCount"`
|
|
|
62
|
+ Fail struct {
|
|
|
63
|
+ Header struct {
|
|
|
64
|
+ } `json:"header"`
|
|
|
65
|
+ Body []struct {
|
|
|
66
|
+ } `json:"body"`
|
|
|
67
|
+ } `json:"fail"`
|
|
|
68
|
+ }
|
|
|
69
|
+)
|
|
|
70
|
+
|
|
|
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
|
+}
|
|
|
99
|
+
|
|
|
100
|
+// ImportDividendsReturnedOrder 导入退货单数据
|
|
|
101
|
+func (gateway HttplibAlliedCreationCooperation) ImportDividendsReturnedOrder(param ReqImportDividendsReturnedOrder) (*DataImportDividendsReturnedOrder, error) {
|
|
|
102
|
+ url := gateway.baseUrL + "/dividends-returned-orders/import"
|
|
|
103
|
+ method := "POST"
|
|
|
104
|
+ req := gateway.CreateRequest(url, method)
|
|
|
105
|
+ // oneDemo
|
|
|
106
|
+ log.Logger.Debug("向业务模块请求数据:导入退货单数据。", map[string]interface{}{
|
|
|
107
|
+ "api": method + ":" + url,
|
|
|
108
|
+ })
|
|
|
109
|
+ req, err := req.JSONBody(param)
|
|
|
110
|
+ if err != nil {
|
|
|
111
|
+ return nil, fmt.Errorf("请求导入退货数据失败:%w", err)
|
|
|
112
|
+ }
|
|
|
113
|
+
|
|
|
114
|
+ byteResult, err := req.Bytes()
|
|
|
115
|
+ if err != nil {
|
|
|
116
|
+ return nil, fmt.Errorf("获取导入退货数据失败:%w", err)
|
|
|
117
|
+ }
|
|
|
118
|
+ log.Logger.Debug("获取业务模块请求数据:导入退货数据。", map[string]interface{}{
|
|
|
119
|
+ "result": string(byteResult),
|
|
|
120
|
+ })
|
|
|
121
|
+ var result service_gateway.GatewayResponse
|
|
|
122
|
+ err = json.Unmarshal(byteResult, &result)
|
|
|
123
|
+ if err != nil {
|
|
|
124
|
+ return nil, fmt.Errorf("解析导入退货数据:%w", err)
|
|
|
125
|
+ }
|
|
|
126
|
+ var data DataImportDividendsReturnedOrder
|
|
|
127
|
+ err = gateway.GetResponseData(result, &data)
|
|
|
128
|
+ return &data, err
|
|
|
129
|
+} |