module_excel_data.go
2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package allied_creation_cooperation
import (
"encoding/json"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
//ReqImportDividendsReturnedOrder 导入退货数据
type (
ImportDividendsReturnedOrderData struct {
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户名称
OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号
OrderGoodName string `json:"orderGoodName"` //订单产品名称
DividendsReturnedDate string `json:"dividendsReturnedDate"` //退货日期
RegionName string `json:"regionName"` //退货区域名称
OrderGoodPrice string `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity string `json:"orderGoodQuantity"` //订单产品数量
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
OrderTime string `json:"orderTime"` //订单日期
}
//请求参数
ReqImportDividendsReturnedOrder struct {
// 分红退货单数据
DividendsReturnedOrderData []ImportDividendsReturnedOrderData `json:"dividendsReturnedOrderData"` //分红退货单数据列表
}
//响应参数
DataImportDividendsReturnedOrder struct {
SuccessCount int `json:"successCount"`
Fail struct {
Header struct {
} `json:"header"`
Body []struct {
} `json:"body"`
} `json:"fail"`
}
)
// ImportDividendsReturnedOrder 导入退货数据
func (gateway HttplibAlliedCreationCooperation) ImportDividendsReturnedOrder(param ReqImportDividendsReturnedOrder) (*DataImportDividendsReturnedOrder, error) {
url := gateway.baseUrL + "/dividends-returned-orders/import"
method := "POST"
req := gateway.CreateRequest(url, method)
// oneDemo
log.Logger.Debug("向业务模块请求数据:导入退货数据。", map[string]interface{}{
"api": method + ":" + url,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求导入退货数据失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取导入退货数据失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:导入退货数据。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析导入退货数据:%w", err)
}
var data DataImportDividendsReturnedOrder
err = gateway.GetResponseData(result, &data)
return &data, err
}