作者 tangxuhui

数据格式调整

... ... @@ -23,7 +23,7 @@ type CreateDividendsOrderCommand struct {
OrderGoods []struct {
CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
// OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
... ...
... ... @@ -25,7 +25,7 @@ type UpdateDividendsOrderCommand struct {
OrderGoods []struct {
CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
// OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
... ...
... ... @@ -27,11 +27,39 @@ type DividendsOrder struct {
RegionNumber string `json:"regionNumber"`
} `json:"region"`
Remarks string `json:"remarks"`
Goods []allied_creation_cooperation.DividendsOrderGoods `json:"goods"`
Goods []DividendsOrderGoods `json:"goods"`
Returned bool `json:"returned"`
}
type DividendsOrderGoods struct {
// 订单产品
OrderGoodId int64 `json:"orderGoodId,string"`
CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
OrderGoodName string `json:"orderGoodName"` //订单产品名称
OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
}
func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder {
goods := []DividendsOrderGoods{}
for _, v := range param.Goods {
good := DividendsOrderGoods{
OrderGoodId: v.OrderGoodId,
CooperationContractNumber: v.CooperationContractNumber,
DividendsOrderNumber: v.DividendsOrderNumber,
OrderGoodAmount: v.OrderGoodAmount,
OrderGoodExpense: v.OrderGoodExpense,
OrderGoodName: v.OrderGoodName,
OrderGoodPrice: v.OrderGoodPrice,
OrderGoodQuantity: v.OrderGoodQuantity,
OrderGoodDividendsStatus: v.OrderGoodDividendsStatus,
}
goods = append(goods, good)
}
data := DividendsOrder{
Company: param.Company,
CustomerName: param.CustomerName,
... ... @@ -45,8 +73,9 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide
Org: param.Org,
Region: param.Region,
Remarks: param.Remarks,
Goods: param.Goods,
Goods: goods,
Returned: param.Returned,
}
return &data
}
... ...
... ... @@ -24,12 +24,14 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
good := allied_creation_cooperation.DividendsOrderGoodAdd{
CooperationContractNumber: v.CooperationContractNumber,
DividendsOrderNumber: v.DividendsOrderNumber,
OrderGoodAmount: v.OrderGoodAmount,
OrderGoodAmount: 0,
OrderGoodExpense: v.OrderGoodExpense,
OrderGoodName: v.OrderGoodName,
OrderGoodPrice: v.OrderGoodPrice,
OrderGoodQuantity: v.OrderGoodQuantity,
}
orderGoodAmount := v.OrderGoodPrice * float64(v.OrderGoodQuantity)
good.OrderGoodAmount = orderGoodAmount
orderGoods = append(orderGoods, good)
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsOrderCommand.Operator)
... ... @@ -84,9 +86,6 @@ func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeD
// 查询分红订单方法
func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchDividendsOrderQuery *query.SearchDividendsOrderQuery) (int, interface{}, error) {
// if err := searchDividendsOrderQuery.ValidateQuery(); err != nil {
// return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
// }
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(searchDividendsOrderQuery.Operator)
result, err := creationCooperationGateway.DividendsOrderSearch(allied_creation_cooperation.ReqDividendsOrderSearch{
PageNumber: searchDividendsOrderQuery.PageNumber,
... ... @@ -115,12 +114,14 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
good := allied_creation_cooperation.DividendsOrderGoods{
CooperationContractNumber: v.CooperationContractNumber,
DividendsOrderNumber: v.DividendsOrderNumber,
OrderGoodAmount: v.OrderGoodAmount,
OrderGoodExpense: v.OrderGoodExpense,
OrderGoodAmount: 0,
OrderGoodName: v.OrderGoodName,
OrderGoodPrice: v.OrderGoodPrice,
OrderGoodQuantity: v.OrderGoodQuantity,
}
orderGoodAmount := v.OrderGoodPrice * float64(v.OrderGoodQuantity)
good.OrderGoodAmount = orderGoodAmount
orderGoods = append(orderGoods, good)
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsOrderCommand.Operator)
... ...
... ... @@ -29,7 +29,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
OrderGoodPrice: v.OrderGoodPrice,
OrderGoodQuantity: v.OrderGoodQuantity,
}
good.OrderGoodPrice = good.OrderGoodPrice * float64(good.OrderGoodQuantity)
good.OrderGoodAmount = good.OrderGoodPrice * float64(good.OrderGoodQuantity)
orderGooods = append(orderGooods, good)
}
result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{
... ...