作者 tangxuhui

数据结构更新

1 package command 1 package command
2 2
3 import ( 3 import (
4 - "fmt"  
5 - "strconv"  
6 -  
7 - "github.com/beego/beego/v2/core/validation"  
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
9 ) 5 )
10 6
@@ -12,13 +8,13 @@ type CreateDividendsOrderCommand struct { @@ -12,13 +8,13 @@ type CreateDividendsOrderCommand struct {
12 //操作人 8 //操作人
13 Operator domain.Operator `json:"-"` 9 Operator domain.Operator `json:"-"`
14 //客户名称 10 //客户名称
15 - CustomerName string `json:"customerName" valid:"Required"` 11 + CustomerName string `json:"customerName"`
16 //分红订单原单号 12 //分红订单原单号
17 - DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"` 13 + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"`
18 //订单产生时间 时间戳 毫秒 14 //订单产生时间 时间戳 毫秒
19 - OrderTime int64 `json:"orderTime" valid:"Required"` 15 + OrderTime int64 `json:"orderTime"`
20 //备注 16 //备注
21 - Remarks string `json:"remarks" valid:"Required"` 17 + Remarks string `json:"remarks"`
22 //订单操作人uid 18 //订单操作人uid
23 OperatorUid string `json:"operatorUid"` 19 OperatorUid string `json:"operatorUid"`
24 //区域名称 20 //区域名称
@@ -35,25 +31,25 @@ type CreateDividendsOrderCommand struct { @@ -35,25 +31,25 @@ type CreateDividendsOrderCommand struct {
35 } `json:"orderGoods"` 31 } `json:"orderGoods"`
36 } 32 }
37 33
38 -func (createDividendsOrderCommand *CreateDividendsOrderCommand) Valid(validation *validation.Validation) {  
39 - // 162 92522 89000  
40 - orderTimeStr := strconv.Itoa(int(createDividendsOrderCommand.OrderTime))  
41 - orderTimeStrRune := []rune(orderTimeStr)  
42 - if len(orderTimeStrRune) != 13 {  
43 - validation.AddError("订单产生时间", "格式错误")  
44 - }  
45 -} 34 +// func (createDividendsOrderCommand *CreateDividendsOrderCommand) Valid(validation *validation.Validation) {
  35 +// // 162 92522 89000
  36 +// orderTimeStr := strconv.Itoa(int(createDividendsOrderCommand.OrderTime))
  37 +// orderTimeStrRune := []rune(orderTimeStr)
  38 +// if len(orderTimeStrRune) != 13 {
  39 +// validation.AddError("订单产生时间", "格式错误")
  40 +// }
  41 +// }
46 42
47 -func (createDividendsOrderCommand *CreateDividendsOrderCommand) ValidateCommand() error {  
48 - valid := validation.Validation{}  
49 - b, err := valid.Valid(createDividendsOrderCommand)  
50 - if err != nil {  
51 - return err  
52 - }  
53 - if !b {  
54 - for _, validErr := range valid.Errors {  
55 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
56 - }  
57 - }  
58 - return nil  
59 -} 43 +// func (createDividendsOrderCommand *CreateDividendsOrderCommand) ValidateCommand() error {
  44 +// valid := validation.Validation{}
  45 +// b, err := valid.Valid(createDividendsOrderCommand)
  46 +// if err != nil {
  47 +// return err
  48 +// }
  49 +// if !b {
  50 +// for _, validErr := range valid.Errors {
  51 +// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  52 +// }
  53 +// }
  54 +// return nil
  55 +// }
1 package command 1 package command
2 2
3 import ( 3 import (
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 5 )
9 6
@@ -11,23 +8,23 @@ type RemoveDividendsOrderCommand struct { @@ -11,23 +8,23 @@ type RemoveDividendsOrderCommand struct {
11 //操作人 8 //操作人
12 Operator domain.Operator `json:"-"` 9 Operator domain.Operator `json:"-"`
13 // 分红订单ID 10 // 分红订单ID
14 - DividendsOrderId []string `json:"dividendsOrderId" valid:"Required"` 11 + DividendsOrderId []string `json:"dividendsOrderId"`
15 } 12 }
16 13
17 -func (removeDividendsOrderCommand *RemoveDividendsOrderCommand) Valid(validation *validation.Validation) { 14 +// func (removeDividendsOrderCommand *RemoveDividendsOrderCommand) Valid(validation *validation.Validation) {
18 15
19 -} 16 +// }
20 17
21 -func (removeDividendsOrderCommand *RemoveDividendsOrderCommand) ValidateCommand() error {  
22 - valid := validation.Validation{}  
23 - b, err := valid.Valid(removeDividendsOrderCommand)  
24 - if err != nil {  
25 - return err  
26 - }  
27 - if !b {  
28 - for _, validErr := range valid.Errors {  
29 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
30 - }  
31 - }  
32 - return nil  
33 -} 18 +// func (removeDividendsOrderCommand *RemoveDividendsOrderCommand) ValidateCommand() error {
  19 +// valid := validation.Validation{}
  20 +// b, err := valid.Valid(removeDividendsOrderCommand)
  21 +// if err != nil {
  22 +// return err
  23 +// }
  24 +// if !b {
  25 +// for _, validErr := range valid.Errors {
  26 +// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  27 +// }
  28 +// }
  29 +// return nil
  30 +// }
1 package command 1 package command
2 2
3 import ( 3 import (
4 - "fmt"  
5 - "strconv"  
6 -  
7 - "github.com/beego/beego/v2/core/validation"  
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
9 ) 5 )
10 6
@@ -14,15 +10,15 @@ type UpdateDividendsOrderCommand struct { @@ -14,15 +10,15 @@ type UpdateDividendsOrderCommand struct {
14 //分红订单 10 //分红订单
15 DividendsOrderID int `json:"dividendsOrderId"` 11 DividendsOrderID int `json:"dividendsOrderId"`
16 //客户名称 12 //客户名称
17 - CustomerName string `json:"customerName" valid:"Required"` 13 + CustomerName string `json:"customerName"`
18 //分红订单金额 14 //分红订单金额
19 - DividendsOrderAmount float64 `json:"dividendsOrderAmount" valid:"Required"` 15 + DividendsOrderAmount float64 `json:"dividendsOrderAmount"`
20 //分红订单原单号 16 //分红订单原单号
21 - DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"` 17 + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"`
22 //订单产生时间 时间戳 毫秒 18 //订单产生时间 时间戳 毫秒
23 - OrderTime int64 `json:"orderTime" valid:"Required"` 19 + OrderTime int64 `json:"orderTime" `
24 //备注 20 //备注
25 - Remarks string `json:"remarks" valid:"Required"` 21 + Remarks string `json:"remarks"`
26 //区域名称 22 //区域名称
27 RegionName string `json:"regionName"` 23 RegionName string `json:"regionName"`
28 //订单产品列表 24 //订单产品列表
@@ -37,25 +33,25 @@ type UpdateDividendsOrderCommand struct { @@ -37,25 +33,25 @@ type UpdateDividendsOrderCommand struct {
37 } `json:"orderGoods"` 33 } `json:"orderGoods"`
38 } 34 }
39 35
40 -func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) {  
41 - // 162 92522 89000  
42 - orderTimeStr := strconv.Itoa(int(updateDividendsOrderCommand.OrderTime))  
43 - orderTimeStrRune := []rune(orderTimeStr)  
44 - if len(orderTimeStrRune) != 13 {  
45 - validation.AddError("订单产生时间", "格式错误")  
46 - }  
47 -} 36 +// func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) {
  37 +// // 162 92522 89000
  38 +// orderTimeStr := strconv.Itoa(int(updateDividendsOrderCommand.OrderTime))
  39 +// orderTimeStrRune := []rune(orderTimeStr)
  40 +// if len(orderTimeStrRune) != 13 {
  41 +// validation.AddError("订单产生时间", "格式错误")
  42 +// }
  43 +// }
48 44
49 -func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) ValidateCommand() error {  
50 - valid := validation.Validation{}  
51 - b, err := valid.Valid(updateDividendsOrderCommand)  
52 - if err != nil {  
53 - return err  
54 - }  
55 - if !b {  
56 - for _, validErr := range valid.Errors {  
57 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
58 - }  
59 - }  
60 - return nil  
61 -} 45 +// func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) ValidateCommand() error {
  46 +// valid := validation.Validation{}
  47 +// b, err := valid.Valid(updateDividendsOrderCommand)
  48 +// if err != nil {
  49 +// return err
  50 +// }
  51 +// if !b {
  52 +// for _, validErr := range valid.Errors {
  53 +// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  54 +// }
  55 +// }
  56 +// return nil
  57 +// }
1 package query 1 package query
2 2
3 import ( 3 import (
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 5 )
9 6
@@ -14,20 +11,20 @@ type GetDividendsOrderQuery struct { @@ -14,20 +11,20 @@ type GetDividendsOrderQuery struct {
14 DividendsOrderId int `json:"dividendsOrderId,string" valid:"Required"` 11 DividendsOrderId int `json:"dividendsOrderId,string" valid:"Required"`
15 } 12 }
16 13
17 -func (getDividendsOrderQuery *GetDividendsOrderQuery) Valid(validation *validation.Validation) { 14 +// func (getDividendsOrderQuery *GetDividendsOrderQuery) Valid(validation *validation.Validation) {
18 15
19 -} 16 +// }
20 17
21 -func (getDividendsOrderQuery *GetDividendsOrderQuery) ValidateQuery() error {  
22 - valid := validation.Validation{}  
23 - b, err := valid.Valid(getDividendsOrderQuery)  
24 - if err != nil {  
25 - return err  
26 - }  
27 - if !b {  
28 - for _, validErr := range valid.Errors {  
29 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
30 - }  
31 - }  
32 - return nil  
33 -} 18 +// func (getDividendsOrderQuery *GetDividendsOrderQuery) ValidateQuery() error {
  19 +// valid := validation.Validation{}
  20 +// b, err := valid.Valid(getDividendsOrderQuery)
  21 +// if err != nil {
  22 +// return err
  23 +// }
  24 +// if !b {
  25 +// for _, validErr := range valid.Errors {
  26 +// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  27 +// }
  28 +// }
  29 +// return nil
  30 +// }
1 package query 1 package query
2 2
3 -import (  
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 -)  
8 -  
9 type ListDividendsOrdersQuery struct { 3 type ListDividendsOrdersQuery struct {
10 // 页码 4 // 页码
11 PageNumber int `json:"pageNumber"` 5 PageNumber int `json:"pageNumber"`
@@ -13,20 +7,20 @@ type ListDividendsOrdersQuery struct { @@ -13,20 +7,20 @@ type ListDividendsOrdersQuery struct {
13 PageSize int `json:"pageSize"` 7 PageSize int `json:"pageSize"`
14 } 8 }
15 9
16 -func (listDividendsOrdersQuery *ListDividendsOrdersQuery) Valid(validation *validation.Validation) { 10 +// func (listDividendsOrdersQuery *ListDividendsOrdersQuery) Valid(validation *validation.Validation) {
17 11
18 -} 12 +// }
19 13
20 -func (listDividendsOrdersQuery *ListDividendsOrdersQuery) ValidateQuery() error {  
21 - valid := validation.Validation{}  
22 - b, err := valid.Valid(listDividendsOrdersQuery)  
23 - if err != nil {  
24 - return err  
25 - }  
26 - if !b {  
27 - for _, validErr := range valid.Errors {  
28 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
29 - }  
30 - }  
31 - return nil  
32 -} 14 +// func (listDividendsOrdersQuery *ListDividendsOrdersQuery) ValidateQuery() error {
  15 +// valid := validation.Validation{}
  16 +// b, err := valid.Valid(listDividendsOrdersQuery)
  17 +// if err != nil {
  18 +// return err
  19 +// }
  20 +// if !b {
  21 +// for _, validErr := range valid.Errors {
  22 +// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  23 +// }
  24 +// }
  25 +// return nil
  26 +// }
1 package query 1 package query
2 2
3 import ( 3 import (
4 - "fmt"  
5 -  
6 - "github.com/beego/beego/v2/core/validation"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 5 )
9 6
@@ -20,20 +17,20 @@ type SearchDividendsOrderQuery struct { @@ -20,20 +17,20 @@ type SearchDividendsOrderQuery struct {
20 PageSize int `json:"pageSize"` 17 PageSize int `json:"pageSize"`
21 } 18 }
22 19
23 -func (searchDividendsOrderQuery *SearchDividendsOrderQuery) Valid(validation *validation.Validation) { 20 +// func (searchDividendsOrderQuery *SearchDividendsOrderQuery) Valid(validation *validation.Validation) {
24 21
25 -} 22 +// }
26 23
27 -func (searchDividendsOrderQuery *SearchDividendsOrderQuery) ValidateQuery() error {  
28 - valid := validation.Validation{}  
29 - b, err := valid.Valid(searchDividendsOrderQuery)  
30 - if err != nil {  
31 - return err  
32 - }  
33 - if !b {  
34 - for _, validErr := range valid.Errors {  
35 - return fmt.Errorf("%s %s", validErr.Key, validErr.Message)  
36 - }  
37 - }  
38 - return nil  
39 -} 24 +// func (searchDividendsOrderQuery *SearchDividendsOrderQuery) ValidateQuery() error {
  25 +// valid := validation.Validation{}
  26 +// b, err := valid.Valid(searchDividendsOrderQuery)
  27 +// if err != nil {
  28 +// return err
  29 +// }
  30 +// if !b {
  31 +// for _, validErr := range valid.Errors {
  32 +// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  33 +// }
  34 +// }
  35 +// return nil
  36 +// }
@@ -16,9 +16,9 @@ type DividendsOrderService struct { @@ -16,9 +16,9 @@ type DividendsOrderService struct {
16 16
17 // 创建分红订单实体对象 17 // 创建分红订单实体对象
18 func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createDividendsOrderCommand *command.CreateDividendsOrderCommand) (interface{}, error) { 18 func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createDividendsOrderCommand *command.CreateDividendsOrderCommand) (interface{}, error) {
19 - if err := createDividendsOrderCommand.ValidateCommand(); err != nil {  
20 - return nil, application.ThrowError(application.ARG_ERROR, err.Error())  
21 - } 19 + // if err := createDividendsOrderCommand.ValidateCommand(); err != nil {
  20 + // return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  21 + // }
22 orderGoods := []allied_creation_cooperation.DividendsOrderGoodAdd{} 22 orderGoods := []allied_creation_cooperation.DividendsOrderGoodAdd{}
23 for _, v := range createDividendsOrderCommand.OrderGoods { 23 for _, v := range createDividendsOrderCommand.OrderGoods {
24 good := allied_creation_cooperation.DividendsOrderGoodAdd{ 24 good := allied_creation_cooperation.DividendsOrderGoodAdd{
@@ -53,9 +53,9 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD @@ -53,9 +53,9 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
53 53
54 // 返回分红订单实体对象 54 // 返回分红订单实体对象
55 func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividendsOrderQuery *query.GetDividendsOrderQuery) (interface{}, error) { 55 func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividendsOrderQuery *query.GetDividendsOrderQuery) (interface{}, error) {
56 - if err := getDividendsOrderQuery.ValidateQuery(); err != nil {  
57 - return nil, application.ThrowError(application.ARG_ERROR, err.Error())  
58 - } 56 + // if err := getDividendsOrderQuery.ValidateQuery(); err != nil {
  57 + // return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  58 + // }
59 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getDividendsOrderQuery.Operator) 59 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getDividendsOrderQuery.Operator)
60 result, err := creationCooperationGateway.DividendsOrderGet(allied_creation_cooperation.ReqDividendsOrderGet{ 60 result, err := creationCooperationGateway.DividendsOrderGet(allied_creation_cooperation.ReqDividendsOrderGet{
61 DividendsOrderId: getDividendsOrderQuery.DividendsOrderId, 61 DividendsOrderId: getDividendsOrderQuery.DividendsOrderId,
@@ -68,9 +68,9 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen @@ -68,9 +68,9 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen
68 68
69 // 移除分红订单实体对象 69 // 移除分红订单实体对象
70 func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeDividendsOrderCommand *command.RemoveDividendsOrderCommand) (interface{}, error) { 70 func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeDividendsOrderCommand *command.RemoveDividendsOrderCommand) (interface{}, error) {
71 - if err := removeDividendsOrderCommand.ValidateCommand(); err != nil {  
72 - return nil, application.ThrowError(application.ARG_ERROR, err.Error())  
73 - } 71 + // if err := removeDividendsOrderCommand.ValidateCommand(); err != nil {
  72 + // return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  73 + // }
74 74
75 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsOrderCommand.Operator) 75 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsOrderCommand.Operator)
76 _, err := creationCooperationGateway.DividendsOrderBatchRemove(allied_creation_cooperation.ReqDividendsOrderBatchRemove{ 76 _, err := creationCooperationGateway.DividendsOrderBatchRemove(allied_creation_cooperation.ReqDividendsOrderBatchRemove{
@@ -84,9 +84,9 @@ func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeD @@ -84,9 +84,9 @@ func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeD
84 84
85 // 查询分红订单方法 85 // 查询分红订单方法
86 func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchDividendsOrderQuery *query.SearchDividendsOrderQuery) (int, interface{}, error) { 86 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 - } 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) 90 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(searchDividendsOrderQuery.Operator)
91 result, err := creationCooperationGateway.DividendsOrderSearch(allied_creation_cooperation.ReqDividendsOrderSearch{ 91 result, err := creationCooperationGateway.DividendsOrderSearch(allied_creation_cooperation.ReqDividendsOrderSearch{
92 PageNumber: searchDividendsOrderQuery.PageNumber, 92 PageNumber: searchDividendsOrderQuery.PageNumber,
@@ -107,9 +107,9 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD @@ -107,9 +107,9 @@ func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchD
107 107
108 // 更新分红订单实体对象 108 // 更新分红订单实体对象
109 func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateDividendsOrderCommand *command.UpdateDividendsOrderCommand) (interface{}, error) { 109 func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateDividendsOrderCommand *command.UpdateDividendsOrderCommand) (interface{}, error) {
110 - if err := updateDividendsOrderCommand.ValidateCommand(); err != nil {  
111 - return nil, application.ThrowError(application.ARG_ERROR, err.Error())  
112 - } 110 + // if err := updateDividendsOrderCommand.ValidateCommand(); err != nil {
  111 + // return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  112 + // }
113 orderGoods := []allied_creation_cooperation.DividendsOrderGoods{} 113 orderGoods := []allied_creation_cooperation.DividendsOrderGoods{}
114 for _, v := range updateDividendsOrderCommand.OrderGoods { 114 for _, v := range updateDividendsOrderCommand.OrderGoods {
115 good := allied_creation_cooperation.DividendsOrderGoods{ 115 good := allied_creation_cooperation.DividendsOrderGoods{