作者 tangxuhui

修改 修改退货单入参

... ... @@ -2,7 +2,6 @@ package command
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
type CreateDividendsReturnedOrderCommand struct {
... ... @@ -11,9 +10,14 @@ type CreateDividendsReturnedOrderCommand struct {
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
OriginalOrderNum string `json:"originalOrderNum"` //源单号
//货品
OrderGoods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"orderGoods"`
OrderGoods []struct {
OrderGoodId int64 `json:"orderGoodId,string"` // 订单产品id
CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
// OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
} `json:"orderGoods"` //货品
DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期
OrderDate int64 `json:"orderDate"` //订单日期
Remarks string `json:"remarks"` //
... ...
... ... @@ -2,7 +2,6 @@ package command
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
type UpdateDividendsReturnedOrderCommand struct {
... ... @@ -12,9 +11,14 @@ type UpdateDividendsReturnedOrderCommand struct {
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
OriginalOrderNum string `json:"originalOrderNum"` //源单号
//货品
OrderGoods []allied_creation_cooperation.DividendsReturnedOrderGoods `json:"orderGoods"`
OrderGoods []struct {
OrderGoodId int64 `json:"orderGoodId,string"` // 订单产品id
CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
// OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
} `json:"orderGoods"` //货品
DividendsReturnedDate int64 `json:"dividendsReturnedDate"` //退货日期
OrderDate int64 `json:"orderDate"` //订单日期
... ...
... ... @@ -20,11 +20,23 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsReturnedOrderCommand.Operator)
dividendsReturnedDate := time.Unix(createDividendsReturnedOrderCommand.DividendsReturnedDate/1e3, 0)
orderDate := time.Unix(createDividendsReturnedOrderCommand.OrderDate/1e3, 0)
var orderGooods []allied_creation_cooperation.ReqDividendsReturnedOrderGood
for _, v := range createDividendsReturnedOrderCommand.OrderGoods {
good := allied_creation_cooperation.ReqDividendsReturnedOrderGood{
CooperationContractNumber: v.CooperationContractNumber,
OrderGoodAmount: 0,
OrderGoodName: v.OrderGoodName,
OrderGoodPrice: v.OrderGoodPrice,
OrderGoodQuantity: v.OrderGoodQuantity,
}
good.OrderGoodPrice = good.OrderGoodPrice * float64(good.OrderGoodQuantity)
orderGooods = append(orderGooods, good)
}
result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{
DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName,
DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber,
OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum,
OrderGoods: createDividendsReturnedOrderCommand.OrderGoods,
OrderGoods: orderGooods,
DividendsReturnedDate: dividendsReturnedDate,
OrderData: orderDate,
OrgId: int(createDividendsReturnedOrderCommand.Operator.OrgId),
... ... @@ -86,12 +98,24 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsReturnedOrderCommand.Operator)
dividendsReturnedDate := time.Unix(updateDividendsReturnedOrderCommand.DividendsReturnedDate/1e3, 0)
orderDate := time.Unix(updateDividendsReturnedOrderCommand.OrderDate/1e3, 0)
var orderGooods []allied_creation_cooperation.ReqDividendsReturnedOrderGood
for _, v := range updateDividendsReturnedOrderCommand.OrderGoods {
good := allied_creation_cooperation.ReqDividendsReturnedOrderGood{
CooperationContractNumber: v.CooperationContractNumber,
OrderGoodAmount: 0,
OrderGoodName: v.OrderGoodName,
OrderGoodPrice: v.OrderGoodPrice,
OrderGoodQuantity: v.OrderGoodQuantity,
}
good.OrderGoodPrice = good.OrderGoodPrice * float64(good.OrderGoodQuantity)
orderGooods = append(orderGooods, good)
}
_, err := creationCooperationGateway.DividendsReturnedOrderUpdate(allied_creation_cooperation.ReqDividendsReturnedOrderUpdate{
DividendsReturnedOrderID: updateDividendsReturnedOrderCommand.DividendsReturnedOrderID,
DividendsReturnedCustomerName: updateDividendsReturnedOrderCommand.DividendsReturnedCustomerName,
DividendsOrderNumber: updateDividendsReturnedOrderCommand.DividendsOrderNumber,
OriginalOrderNum: updateDividendsReturnedOrderCommand.OriginalOrderNum,
OrderGoods: updateDividendsReturnedOrderCommand.OrderGoods,
OrderGoods: orderGooods,
DividendsReturnedDate: dividendsReturnedDate,
OrderData: orderDate,
OrgId: int(updateDividendsReturnedOrderCommand.Operator.OrgId),
... ...
... ... @@ -46,11 +46,19 @@ type (
Goods []DividendsReturnedOrderGoods `json:"goods"` //货品
}
//
ReqDividendsReturnedOrderGood struct {
CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
}
ReqDividendsReturnedOrderAdd struct {
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"`
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
OriginalOrderNum string `json:"originalOrderNum"`
OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"`
OrderGoods []ReqDividendsReturnedOrderGood `json:"orderGoods"`
DividendsReturnedDate time.Time `json:"dividendsReturnedDate"`
OrderData time.Time `json:"orderData"`
OrgId int `json:"orgId"`
... ... @@ -70,7 +78,7 @@ type (
DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"`
DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号
OriginalOrderNum string `json:"originalOrderNum"`
OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"`
OrderGoods []ReqDividendsReturnedOrderGood `json:"orderGoods"`
DividendsReturnedDate time.Time `json:"dividendsReturnedDate"`
OrderData time.Time `json:"orderData"`
OrgId int `json:"orgId"`
... ...