作者 tangxuhui

数据格式调整

@@ -21,13 +21,13 @@ type CreateDividendsOrderCommand struct { @@ -21,13 +21,13 @@ type CreateDividendsOrderCommand struct {
21 RegionName string `json:"regionName"` 21 RegionName string `json:"regionName"`
22 //订单产品列表 22 //订单产品列表
23 OrderGoods []struct { 23 OrderGoods []struct {
24 - CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号  
25 - DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号  
26 - OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额  
27 - OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用  
28 - OrderGoodName string `json:"orderGoodName"` //订单产品名称  
29 - OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价  
30 - OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 24 + CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
  25 + DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
  26 + // OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
  27 + OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
  28 + OrderGoodName string `json:"orderGoodName"` //订单产品名称
  29 + OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
  30 + OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
31 } `json:"orderGoods"` 31 } `json:"orderGoods"`
32 } 32 }
33 33
@@ -23,13 +23,13 @@ type UpdateDividendsOrderCommand struct { @@ -23,13 +23,13 @@ type UpdateDividendsOrderCommand struct {
23 RegionName string `json:"regionName"` 23 RegionName string `json:"regionName"`
24 //订单产品列表 24 //订单产品列表
25 OrderGoods []struct { 25 OrderGoods []struct {
26 - CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号  
27 - DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号  
28 - OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额  
29 - OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用  
30 - OrderGoodName string `json:"orderGoodName"` //订单产品名称  
31 - OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价  
32 - OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 26 + CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
  27 + DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
  28 + // OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
  29 + OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
  30 + OrderGoodName string `json:"orderGoodName"` //订单产品名称
  31 + OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
  32 + OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
33 } `json:"orderGoods"` 33 } `json:"orderGoods"`
34 } 34 }
35 35
@@ -26,12 +26,40 @@ type DividendsOrder struct { @@ -26,12 +26,40 @@ type DividendsOrder struct {
26 RegionName string `json:"regionName"` 26 RegionName string `json:"regionName"`
27 RegionNumber string `json:"regionNumber"` 27 RegionNumber string `json:"regionNumber"`
28 } `json:"region"` 28 } `json:"region"`
29 - Remarks string `json:"remarks"`  
30 - Goods []allied_creation_cooperation.DividendsOrderGoods `json:"goods"`  
31 - Returned bool `json:"returned"` 29 + Remarks string `json:"remarks"`
  30 + Goods []DividendsOrderGoods `json:"goods"`
  31 + Returned bool `json:"returned"`
  32 +}
  33 +
  34 +type DividendsOrderGoods struct {
  35 + // 订单产品
  36 + OrderGoodId int64 `json:"orderGoodId,string"`
  37 + CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
  38 + DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号
  39 + OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
  40 + OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用
  41 + OrderGoodName string `json:"orderGoodName"` //订单产品名称
  42 + OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
  43 + OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量
  44 + OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红
32 } 45 }
33 46
34 func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder { 47 func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder {
  48 + goods := []DividendsOrderGoods{}
  49 + for _, v := range param.Goods {
  50 + good := DividendsOrderGoods{
  51 + OrderGoodId: v.OrderGoodId,
  52 + CooperationContractNumber: v.CooperationContractNumber,
  53 + DividendsOrderNumber: v.DividendsOrderNumber,
  54 + OrderGoodAmount: v.OrderGoodAmount,
  55 + OrderGoodExpense: v.OrderGoodExpense,
  56 + OrderGoodName: v.OrderGoodName,
  57 + OrderGoodPrice: v.OrderGoodPrice,
  58 + OrderGoodQuantity: v.OrderGoodQuantity,
  59 + OrderGoodDividendsStatus: v.OrderGoodDividendsStatus,
  60 + }
  61 + goods = append(goods, good)
  62 + }
35 data := DividendsOrder{ 63 data := DividendsOrder{
36 Company: param.Company, 64 Company: param.Company,
37 CustomerName: param.CustomerName, 65 CustomerName: param.CustomerName,
@@ -45,8 +73,9 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide @@ -45,8 +73,9 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide
45 Org: param.Org, 73 Org: param.Org,
46 Region: param.Region, 74 Region: param.Region,
47 Remarks: param.Remarks, 75 Remarks: param.Remarks,
48 - Goods: param.Goods, 76 + Goods: goods,
49 Returned: param.Returned, 77 Returned: param.Returned,
50 } 78 }
  79 +
51 return &data 80 return &data
52 } 81 }
@@ -24,12 +24,14 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD @@ -24,12 +24,14 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
24 good := allied_creation_cooperation.DividendsOrderGoodAdd{ 24 good := allied_creation_cooperation.DividendsOrderGoodAdd{
25 CooperationContractNumber: v.CooperationContractNumber, 25 CooperationContractNumber: v.CooperationContractNumber,
26 DividendsOrderNumber: v.DividendsOrderNumber, 26 DividendsOrderNumber: v.DividendsOrderNumber,
27 - OrderGoodAmount: v.OrderGoodAmount, 27 + OrderGoodAmount: 0,
28 OrderGoodExpense: v.OrderGoodExpense, 28 OrderGoodExpense: v.OrderGoodExpense,
29 OrderGoodName: v.OrderGoodName, 29 OrderGoodName: v.OrderGoodName,
30 OrderGoodPrice: v.OrderGoodPrice, 30 OrderGoodPrice: v.OrderGoodPrice,
31 OrderGoodQuantity: v.OrderGoodQuantity, 31 OrderGoodQuantity: v.OrderGoodQuantity,
32 } 32 }
  33 + orderGoodAmount := v.OrderGoodPrice * float64(v.OrderGoodQuantity)
  34 + good.OrderGoodAmount = orderGoodAmount
33 orderGoods = append(orderGoods, good) 35 orderGoods = append(orderGoods, good)
34 } 36 }
35 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsOrderCommand.Operator) 37 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsOrderCommand.Operator)
@@ -84,9 +86,6 @@ func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeD @@ -84,9 +86,6 @@ func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeD
84 86
85 // 查询分红订单方法 87 // 查询分红订单方法
86 func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchDividendsOrderQuery *query.SearchDividendsOrderQuery) (int, interface{}, error) { 88 func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchDividendsOrderQuery *query.SearchDividendsOrderQuery) (int, interface{}, error) {
87 - // if err := searchDividendsOrderQuery.ValidateQuery(); err != nil {  
88 - // return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())  
89 - // }  
90 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(searchDividendsOrderQuery.Operator) 89 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(searchDividendsOrderQuery.Operator)
91 result, err := creationCooperationGateway.DividendsOrderSearch(allied_creation_cooperation.ReqDividendsOrderSearch{ 90 result, err := creationCooperationGateway.DividendsOrderSearch(allied_creation_cooperation.ReqDividendsOrderSearch{
92 PageNumber: searchDividendsOrderQuery.PageNumber, 91 PageNumber: searchDividendsOrderQuery.PageNumber,
@@ -115,12 +114,14 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD @@ -115,12 +114,14 @@ func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateD
115 good := allied_creation_cooperation.DividendsOrderGoods{ 114 good := allied_creation_cooperation.DividendsOrderGoods{
116 CooperationContractNumber: v.CooperationContractNumber, 115 CooperationContractNumber: v.CooperationContractNumber,
117 DividendsOrderNumber: v.DividendsOrderNumber, 116 DividendsOrderNumber: v.DividendsOrderNumber,
118 - OrderGoodAmount: v.OrderGoodAmount,  
119 OrderGoodExpense: v.OrderGoodExpense, 117 OrderGoodExpense: v.OrderGoodExpense,
  118 + OrderGoodAmount: 0,
120 OrderGoodName: v.OrderGoodName, 119 OrderGoodName: v.OrderGoodName,
121 OrderGoodPrice: v.OrderGoodPrice, 120 OrderGoodPrice: v.OrderGoodPrice,
122 OrderGoodQuantity: v.OrderGoodQuantity, 121 OrderGoodQuantity: v.OrderGoodQuantity,
123 } 122 }
  123 + orderGoodAmount := v.OrderGoodPrice * float64(v.OrderGoodQuantity)
  124 + good.OrderGoodAmount = orderGoodAmount
124 orderGoods = append(orderGoods, good) 125 orderGoods = append(orderGoods, good)
125 } 126 }
126 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsOrderCommand.Operator) 127 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsOrderCommand.Operator)
@@ -29,7 +29,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide @@ -29,7 +29,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
29 OrderGoodPrice: v.OrderGoodPrice, 29 OrderGoodPrice: v.OrderGoodPrice,
30 OrderGoodQuantity: v.OrderGoodQuantity, 30 OrderGoodQuantity: v.OrderGoodQuantity,
31 } 31 }
32 - good.OrderGoodPrice = good.OrderGoodPrice * float64(good.OrderGoodQuantity) 32 + good.OrderGoodAmount = good.OrderGoodPrice * float64(good.OrderGoodQuantity)
33 orderGooods = append(orderGooods, good) 33 orderGooods = append(orderGooods, good)
34 } 34 }
35 result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{ 35 result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{