|
|
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
|
|
|
} |
|
|
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"
|
|
|
)
|
|
|
|
|
|
// ReqImportDividendsOrder 导入订单数据
|
|
|
type (
|
|
|
ImportDividendsOrderData 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"` //订单日期
|
|
|
}
|
|
|
// ReqImportDividendsOrder 请求参数
|
|
|
ReqImportDividendsOrder struct {
|
|
|
// 分红退货单数据
|
|
|
DividendsOrderData []ImportDividendsOrderData `json:"dividendsOrderData"` //分红订单数据列表
|
|
|
}
|
|
|
// DataImportDividendsOrder 响应参数
|
|
|
DataImportDividendsOrder struct {
|
|
|
SuccessCount int `json:"successCount"`
|
|
|
Fail struct {
|
|
|
Header struct {
|
|
|
} `json:"header"`
|
|
|
Body []struct {
|
|
|
} `json:"body"`
|
|
|
} `json:"fail"`
|
|
|
}
|
|
|
)
|
|
|
|
|
|
//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 请求参数
|
|
|
ReqImportDividendsReturnedOrder struct {
|
|
|
// 分红退货单数据
|
|
|
DividendsReturnedOrderData []ImportDividendsReturnedOrderData `json:"dividendsReturnedOrderData"` //分红退货单数据列表
|
|
|
}
|
|
|
// DataImportDividendsReturnedOrder 响应参数
|
|
|
DataImportDividendsReturnedOrder struct {
|
|
|
SuccessCount int `json:"successCount"`
|
|
|
Fail struct {
|
|
|
Header struct {
|
|
|
} `json:"header"`
|
|
|
Body []struct {
|
|
|
} `json:"body"`
|
|
|
} `json:"fail"`
|
|
|
}
|
|
|
)
|
|
|
|
|
|
func (gateway HttplibAlliedCreationCooperation) ImportDividendsOrder(param ReqImportDividendsOrder) (*DataImportDividendsOrder, error) {
|
|
|
url := gateway.baseUrL + "/dividends-orders/import"
|
|
|
method := "POST"
|
|
|
req := gateway.CreateRequest(url, method)
|
|
|
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 DataImportDividendsOrder
|
|
|
err = gateway.GetResponseData(result, &data)
|
|
|
return &data, err
|
|
|
}
|
|
|
|
|
|
// 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
|
|
|
} |
...
|
...
|
|