正在显示
14 个修改的文件
包含
474 行增加
和
69 行删除
@@ -15,7 +15,7 @@ type EndCooperationProjectCommand struct { | @@ -15,7 +15,7 @@ type EndCooperationProjectCommand struct { | ||
15 | } | 15 | } |
16 | 16 | ||
17 | func (endCooperationProjectCommand *EndCooperationProjectCommand) Valid(validation *validation.Validation) { | 17 | func (endCooperationProjectCommand *EndCooperationProjectCommand) Valid(validation *validation.Validation) { |
18 | - validation.SetError("CustomValid", "未实现的自定义认证") | 18 | + |
19 | } | 19 | } |
20 | 20 | ||
21 | func (endCooperationProjectCommand *EndCooperationProjectCommand) ValidateCommand() error { | 21 | func (endCooperationProjectCommand *EndCooperationProjectCommand) ValidateCommand() error { |
1 | -package command | ||
2 | - | ||
3 | -import ( | ||
4 | - "fmt" | ||
5 | - | ||
6 | - "github.com/beego/beego/v2/core/validation" | ||
7 | - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
8 | -) | ||
9 | - | ||
10 | -type ReleaseCooperationProjectCommand struct { | ||
11 | - //操作人 | ||
12 | - Operator domain.Operator `json:"-"` | ||
13 | - // 共创项目名称 | ||
14 | - CooperationProjectName string `json:"cooperationProjectName" valid:"Required"` | ||
15 | - // 共创模式ID | ||
16 | - CooperationModeId int64 `json:"cooperationModeId" valid:"Required"` | ||
17 | - // 手机号码 | ||
18 | - Phone string `json:"phone" valid:"Required"` | ||
19 | - // 共创模式状态,1启用,2禁用 | ||
20 | - Status int32 `json:"status" valid:"Required"` | ||
21 | - // 用户编号 | ||
22 | - UsersCode string `json:"usersCode" valid:"Required"` | ||
23 | - // 用户编号 | ||
24 | - UsersId int64 `json:"usersId" valid:"Required"` | ||
25 | - // 用户姓名 | ||
26 | - UsersName string `json:"usersName" valid:"Required"` | ||
27 | - // 邮箱 | ||
28 | - Email string `json:"email" valid:"Required"` | ||
29 | - // 共创公司 | ||
30 | - CooperationCompany string `json:"cooperationCompany" valid:"Required"` | ||
31 | - // 共创公司到期时间 | ||
32 | - CooperationDeadline string `json:"cooperationDeadline" valid:"Required"` | ||
33 | - // 共创项目承接对象,1员工,2共创用户,3公开,可以多选 | ||
34 | - CooperationProjectUndertakerType []int32 `json:"cooperationProjectUndertakerType" valid:"Required"` | ||
35 | - // 共创项目描述 | ||
36 | - CooperationProjectDescription string `json:"cooperationProjectDescription" valid:"Required"` | ||
37 | -} | ||
38 | - | ||
39 | -func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) Valid(validation *validation.Validation) { | ||
40 | - validation.SetError("CustomValid", "未实现的自定义认证") | ||
41 | -} | ||
42 | - | ||
43 | -func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) ValidateCommand() error { | ||
44 | - valid := validation.Validation{} | ||
45 | - b, err := valid.Valid(releaseCooperationProjectCommand) | ||
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 | -} |
@@ -15,7 +15,7 @@ type RemoveCooperationProjectCommand struct { | @@ -15,7 +15,7 @@ type RemoveCooperationProjectCommand struct { | ||
15 | } | 15 | } |
16 | 16 | ||
17 | func (removeCooperationProjectCommand *RemoveCooperationProjectCommand) Valid(validation *validation.Validation) { | 17 | func (removeCooperationProjectCommand *RemoveCooperationProjectCommand) Valid(validation *validation.Validation) { |
18 | - validation.SetError("CustomValid", "未实现的自定义认证") | 18 | + |
19 | } | 19 | } |
20 | 20 | ||
21 | func (removeCooperationProjectCommand *RemoveCooperationProjectCommand) ValidateCommand() error { | 21 | func (removeCooperationProjectCommand *RemoveCooperationProjectCommand) ValidateCommand() error { |
@@ -29,7 +29,7 @@ type UpdateCooperationProjectCommand struct { | @@ -29,7 +29,7 @@ type UpdateCooperationProjectCommand struct { | ||
29 | } | 29 | } |
30 | 30 | ||
31 | func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) Valid(validation *validation.Validation) { | 31 | func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) Valid(validation *validation.Validation) { |
32 | - validation.SetError("CustomValid", "未实现的自定义认证") | 32 | + |
33 | } | 33 | } |
34 | 34 | ||
35 | func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) ValidateCommand() error { | 35 | func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) ValidateCommand() error { |
@@ -47,7 +47,7 @@ func (cooperationProjectService *CooperationProjectService) EndCooperationProjec | @@ -47,7 +47,7 @@ func (cooperationProjectService *CooperationProjectService) EndCooperationProjec | ||
47 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 47 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
48 | } | 48 | } |
49 | //creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(endCooperationProjectCommand.Operator) | 49 | //creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(endCooperationProjectCommand.Operator) |
50 | - //TODO | 50 | + //TODO 等待接口 |
51 | return nil, nil | 51 | return nil, nil |
52 | } | 52 | } |
53 | 53 | ||
@@ -64,7 +64,6 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec | @@ -64,7 +64,6 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec | ||
64 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 64 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
65 | } | 65 | } |
66 | return result, nil | 66 | return result, nil |
67 | - | ||
68 | } | 67 | } |
69 | 68 | ||
70 | // 返回共创项目管理列表 | 69 | // 返回共创项目管理列表 |
@@ -75,15 +75,6 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen | @@ -75,15 +75,6 @@ func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividen | ||
75 | return result, nil | 75 | return result, nil |
76 | } | 76 | } |
77 | 77 | ||
78 | -// 返回分红订单实体对象列表 | ||
79 | -// func (dividendsOrderService *DividendsOrderService) ListDividendsOrders(listDividendsOrdersQuery *query.ListDividendsOrdersQuery) (int, interface{}, error) { | ||
80 | -// if err := listDividendsOrdersQuery.ValidateQuery(); err != nil { | ||
81 | -// return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
82 | -// } | ||
83 | - | ||
84 | -// return 0, nil, nil | ||
85 | -// } | ||
86 | - | ||
87 | // 移除分红订单实体对象 | 78 | // 移除分红订单实体对象 |
88 | func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeDividendsOrderCommand *command.RemoveDividendsOrderCommand) (interface{}, error) { | 79 | func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeDividendsOrderCommand *command.RemoveDividendsOrderCommand) (interface{}, error) { |
89 | if err := removeDividendsOrderCommand.ValidateCommand(); err != nil { | 80 | if err := removeDividendsOrderCommand.ValidateCommand(); err != nil { |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
6 | +) | ||
7 | + | ||
8 | +type CreateDividendsReturnedOrderCommand struct { | ||
9 | + //操作人 | ||
10 | + Operator domain.Operator `json:"-"` | ||
11 | + allied_creation_cooperation.ReqDividendsReturnedOrderAdd | ||
12 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
6 | +) | ||
7 | + | ||
8 | +type RemoveDividendsReturnedOrderCommand struct { | ||
9 | + //操作人 | ||
10 | + Operator domain.Operator `json:"-"` | ||
11 | + allied_creation_cooperation.ReqDividendsReturnedOrderRemove | ||
12 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
6 | +) | ||
7 | + | ||
8 | +type UpdateDividendsReturnedOrderCommand struct { | ||
9 | + //操作人 | ||
10 | + Operator domain.Operator `json:"-"` | ||
11 | + allied_creation_cooperation.ReqDividendsReturnedOrderUpdate | ||
12 | +} |
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
5 | +) | ||
6 | + | ||
7 | +type GetDividendsReturnedOrderQuery struct { | ||
8 | + //操作人 | ||
9 | + Operator domain.Operator `json:"-"` | ||
10 | + DividendsReturnedOrderID int `json:"dividendsReturnedOrderId"` //分红退货单记录id | ||
11 | +} |
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
5 | +) | ||
6 | + | ||
7 | +type SearchDividendsReturnedOrderQuery struct { | ||
8 | + //操作人 | ||
9 | + Operator domain.Operator `json:"-"` | ||
10 | + // 退货客户姓名 | ||
11 | + DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName,omitempty"` | ||
12 | + // 分红退货单号 | ||
13 | + DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber,omitempty"` | ||
14 | + // 查询偏离量 | ||
15 | + PageNumber int `json:"pageNumber"` | ||
16 | + // 每页 | ||
17 | + PageSize int `json:"pageSize"` | ||
18 | +} |
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/linmadan/egglib-go/core/application" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/command" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/query" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
8 | +) | ||
9 | + | ||
10 | +// 分红退货单服务 | ||
11 | +type DividendsReturnedOrderService struct { | ||
12 | +} | ||
13 | + | ||
14 | +// 创建分红退货单服务 | ||
15 | +func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDividendsReturnedOrder(createDividendsReturnedOrderCommand *command.CreateDividendsReturnedOrderCommand) (interface{}, error) { | ||
16 | + | ||
17 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsReturnedOrderCommand.Operator) | ||
18 | + _, err := creationCooperationGateway.DividendsReturnedOrderAdd(createDividendsReturnedOrderCommand.ReqDividendsReturnedOrderAdd) | ||
19 | + if err != nil { | ||
20 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
21 | + } | ||
22 | + return createDividendsReturnedOrderCommand, nil | ||
23 | +} | ||
24 | + | ||
25 | +// 返回分红退货单服务 | ||
26 | +func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividendsReturnedOrder(getDividendsReturnedOrderQuery *query.GetDividendsReturnedOrderQuery) (interface{}, error) { | ||
27 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getDividendsReturnedOrderQuery.Operator) | ||
28 | + result, err := creationCooperationGateway.DividendsReturnedOrderGet(allied_creation_cooperation.ReqDividendsReturnedOrderGet{ | ||
29 | + DividendsReturnedOrderId: getDividendsReturnedOrderQuery.DividendsReturnedOrderID, | ||
30 | + }) | ||
31 | + if err != nil { | ||
32 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
33 | + } | ||
34 | + return result, nil | ||
35 | +} | ||
36 | + | ||
37 | +// 移除分红退货单服务 | ||
38 | +func (dividendsReturnedOrderService *DividendsReturnedOrderService) RemoveDividendsReturnedOrder(removeDividendsReturnedOrderCommand *command.RemoveDividendsReturnedOrderCommand) (interface{}, error) { | ||
39 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsReturnedOrderCommand.Operator) | ||
40 | + _, err := creationCooperationGateway.DividendsReturnedOrderRemove(removeDividendsReturnedOrderCommand.ReqDividendsReturnedOrderRemove) | ||
41 | + if err != nil { | ||
42 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
43 | + } | ||
44 | + return removeDividendsReturnedOrderCommand, nil | ||
45 | +} | ||
46 | + | ||
47 | +// 查找分红退货单 | ||
48 | +func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDividendsReturnedOrder(searchDividendsReturnedOrderQuery *query.SearchDividendsReturnedOrderQuery) (int, interface{}, error) { | ||
49 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(searchDividendsReturnedOrderQuery.Operator) | ||
50 | + result, err := creationCooperationGateway.DividendsReturnedOrderSearch(allied_creation_cooperation.ReqDividendsReturnedOrderSearch{ | ||
51 | + PageNumber: searchDividendsReturnedOrderQuery.PageNumber, | ||
52 | + PageSize: searchDividendsReturnedOrderQuery.PageSize, | ||
53 | + DividendsReturnedOrderNumber: searchDividendsReturnedOrderQuery.DividendsReturnedOrderNumber, | ||
54 | + DividendsReturnedCustomerName: searchDividendsReturnedOrderQuery.DividendsReturnedCustomerName, | ||
55 | + }) | ||
56 | + if err != nil { | ||
57 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
58 | + } | ||
59 | + return result.Total, result.List, nil | ||
60 | +} | ||
61 | + | ||
62 | +// 更新分红退货单服务 | ||
63 | +func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDividendsReturnedOrder(updateDividendsReturnedOrderCommand *command.UpdateDividendsReturnedOrderCommand) (interface{}, error) { | ||
64 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsReturnedOrderCommand.Operator) | ||
65 | + _, err := creationCooperationGateway.DividendsReturnedOrderUpdate(updateDividendsReturnedOrderCommand.ReqDividendsReturnedOrderUpdate) | ||
66 | + if err != nil { | ||
67 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
68 | + } | ||
69 | + return updateDividendsReturnedOrderCommand, nil | ||
70 | + | ||
71 | +} | ||
72 | + | ||
73 | +func NewDividendsReturnedOrderService(options map[string]interface{}) *DividendsReturnedOrderService { | ||
74 | + newDividendsReturnedOrderService := &DividendsReturnedOrderService{} | ||
75 | + return newDividendsReturnedOrderService | ||
76 | +} |
pkg/infrastructure/service_gateway/allied_creation_cooperation/module_dividends_returned_order.go
0 → 100644
1 | +package allied_creation_cooperation | ||
2 | + | ||
3 | +import ( | ||
4 | + "encoding/json" | ||
5 | + "fmt" | ||
6 | + "strconv" | ||
7 | + | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" | ||
10 | +) | ||
11 | + | ||
12 | +//DividendsReturnedOrderAdd 创建分红退货单 | ||
13 | +func (gateway HttplibAlliedCreationCooperation) DividendsReturnedOrderAdd(param ReqDividendsReturnedOrderAdd) (*DataDividendsReturnedOrderAdd, error) { | ||
14 | + url := gateway.baseUrL + "/dividends-returned-orders" | ||
15 | + method := "POST" | ||
16 | + req := gateway.CreateRequest(url, method) | ||
17 | + log.Logger.Debug("向业务模块请求数据:创建分红退货单。", map[string]interface{}{ | ||
18 | + "api": method + ":" + url, | ||
19 | + "param": param, | ||
20 | + }) | ||
21 | + req, err := req.JSONBody(param) | ||
22 | + if err != nil { | ||
23 | + return nil, fmt.Errorf("请求创建分红退货单失败:%w", err) | ||
24 | + } | ||
25 | + | ||
26 | + byteResult, err := req.Bytes() | ||
27 | + if err != nil { | ||
28 | + return nil, fmt.Errorf("获取创建分红退货单失败:%w", err) | ||
29 | + } | ||
30 | + log.Logger.Debug("获取业务模块请求数据:创建分红退货单。", map[string]interface{}{ | ||
31 | + "result": string(byteResult), | ||
32 | + }) | ||
33 | + var result service_gateway.GatewayResponse | ||
34 | + err = json.Unmarshal(byteResult, &result) | ||
35 | + if err != nil { | ||
36 | + return nil, fmt.Errorf("解析创建分红退货单:%w", err) | ||
37 | + } | ||
38 | + var data DataDividendsReturnedOrderAdd | ||
39 | + err = gateway.GetResponseData(result, &data) | ||
40 | + return &data, err | ||
41 | +} | ||
42 | + | ||
43 | +// DividendsReturnedOrderUpdate 更新分红退货单 | ||
44 | +func (gateway HttplibAlliedCreationCooperation) DividendsReturnedOrderUpdate(param ReqDividendsReturnedOrderUpdate) ( | ||
45 | + *DataDividendsReturnedOrderUpdate, error) { | ||
46 | + url := gateway.baseUrL + "/dividends-returned-orders/" + strconv.Itoa(param.DividendsReturnedOrderID) | ||
47 | + method := "PUT" | ||
48 | + req := gateway.CreateRequest(url, method) | ||
49 | + log.Logger.Debug("向业务模块请求数据:更新分红退货单。", map[string]interface{}{ | ||
50 | + "api": method + ":" + url, | ||
51 | + "param": param, | ||
52 | + }) | ||
53 | + req, err := req.JSONBody(param) | ||
54 | + if err != nil { | ||
55 | + return nil, fmt.Errorf("请求更新分红退货单失败:%w", err) | ||
56 | + } | ||
57 | + | ||
58 | + byteResult, err := req.Bytes() | ||
59 | + if err != nil { | ||
60 | + return nil, fmt.Errorf("获取更新分红退货单失败:%w", err) | ||
61 | + } | ||
62 | + log.Logger.Debug("获取业务模块请求数据:更新分红退货单。", map[string]interface{}{ | ||
63 | + "result": string(byteResult), | ||
64 | + }) | ||
65 | + var result service_gateway.GatewayResponse | ||
66 | + err = json.Unmarshal(byteResult, &result) | ||
67 | + if err != nil { | ||
68 | + return nil, fmt.Errorf("解析更新分红退货单:%w", err) | ||
69 | + } | ||
70 | + var data DataDividendsReturnedOrderUpdate | ||
71 | + err = gateway.GetResponseData(result, &data) | ||
72 | + return &data, err | ||
73 | +} | ||
74 | + | ||
75 | +// DividendsReturnedOrderSearch 查找分红退货单 | ||
76 | +func (gateway HttplibAlliedCreationCooperation) DividendsReturnedOrderSearch(param ReqDividendsReturnedOrderSearch) (*DataDividendsReturnedOrderSearch, error) { | ||
77 | + url := gateway.baseUrL + "/dividends-returned-orders/search" | ||
78 | + method := "POST" | ||
79 | + req := gateway.CreateRequest(url, method) | ||
80 | + log.Logger.Debug("向业务模块请求数据:查找分红退货单。", map[string]interface{}{ | ||
81 | + "api": method + ":" + url, | ||
82 | + "param": param, | ||
83 | + }) | ||
84 | + req, err := req.JSONBody(param) | ||
85 | + if err != nil { | ||
86 | + return nil, fmt.Errorf("请求查找分红退货单失败:%w", err) | ||
87 | + } | ||
88 | + | ||
89 | + byteResult, err := req.Bytes() | ||
90 | + if err != nil { | ||
91 | + return nil, fmt.Errorf("获取查找分红退货单失败:%w", err) | ||
92 | + } | ||
93 | + log.Logger.Debug("获取业务模块请求数据:查找分红退货单。", map[string]interface{}{ | ||
94 | + "result": string(byteResult), | ||
95 | + }) | ||
96 | + var result service_gateway.GatewayResponse | ||
97 | + err = json.Unmarshal(byteResult, &result) | ||
98 | + if err != nil { | ||
99 | + return nil, fmt.Errorf("解析查找分红退货单:%w", err) | ||
100 | + } | ||
101 | + var data DataDividendsReturnedOrderSearch | ||
102 | + err = gateway.GetResponseData(result, &data) | ||
103 | + return &data, err | ||
104 | +} | ||
105 | + | ||
106 | +// DividendsReturnedOrderRemove 移除分红退货单 | ||
107 | +func (gateway HttplibAlliedCreationCooperation) DividendsReturnedOrderRemove(param ReqDividendsReturnedOrderRemove) ( | ||
108 | + *DataDividendsReturnedOrderRemove, error) { | ||
109 | + url := gateway.baseUrL + "/dividends-returned-orders/" + strconv.Itoa(param.DividendsReturnedOrderID) | ||
110 | + method := "DELETE" | ||
111 | + req := gateway.CreateRequest(url, method) | ||
112 | + log.Logger.Debug("向业务模块请求数据:移除分红退货单。", map[string]interface{}{ | ||
113 | + "api": method + ":" + url, | ||
114 | + "param": param, | ||
115 | + }) | ||
116 | + req, err := req.JSONBody(param) | ||
117 | + if err != nil { | ||
118 | + return nil, fmt.Errorf("请求移除分红退货单失败:%w", err) | ||
119 | + } | ||
120 | + | ||
121 | + byteResult, err := req.Bytes() | ||
122 | + if err != nil { | ||
123 | + return nil, fmt.Errorf("获取移除分红退货单失败:%w", err) | ||
124 | + } | ||
125 | + log.Logger.Debug("获取业务模块请求数据:移除分红退货单。", map[string]interface{}{ | ||
126 | + "result": string(byteResult), | ||
127 | + }) | ||
128 | + var result service_gateway.GatewayResponse | ||
129 | + err = json.Unmarshal(byteResult, &result) | ||
130 | + if err != nil { | ||
131 | + return nil, fmt.Errorf("解析移除分红退货单:%w", err) | ||
132 | + } | ||
133 | + var data DataDividendsReturnedOrderRemove | ||
134 | + err = gateway.GetResponseData(result, &data) | ||
135 | + return &data, err | ||
136 | +} | ||
137 | + | ||
138 | +// DividendsReturnedOrders 返回分红退货单列表 | ||
139 | +func (gateway HttplibAlliedCreationCooperation) DividendsReturnedOrderList(param ReqDividendsReturnedOrderList) (*DataDividendsReturnedOrderList, error) { | ||
140 | + url := gateway.baseUrL + "/dividends-returned-orders" | ||
141 | + method := "GET" | ||
142 | + req := gateway.CreateRequest(url, method) | ||
143 | + log.Logger.Debug("向业务模块请求数据:返回分红退货单列表。", map[string]interface{}{ | ||
144 | + "api": method + ":" + url, | ||
145 | + "param": param, | ||
146 | + }) | ||
147 | + req, err := req.JSONBody(param) | ||
148 | + if err != nil { | ||
149 | + return nil, fmt.Errorf("请求返回分红退货单列表失败:%w", err) | ||
150 | + } | ||
151 | + | ||
152 | + byteResult, err := req.Bytes() | ||
153 | + if err != nil { | ||
154 | + return nil, fmt.Errorf("获取返回分红退货单列表失败:%w", err) | ||
155 | + } | ||
156 | + log.Logger.Debug("获取业务模块请求数据:返回分红退货单列表。", map[string]interface{}{ | ||
157 | + "result": string(byteResult), | ||
158 | + }) | ||
159 | + var result service_gateway.GatewayResponse | ||
160 | + err = json.Unmarshal(byteResult, &result) | ||
161 | + if err != nil { | ||
162 | + return nil, fmt.Errorf("解析返回分红退货单列表:%w", err) | ||
163 | + } | ||
164 | + var data DataDividendsReturnedOrderList | ||
165 | + err = gateway.GetResponseData(result, &data) | ||
166 | + return &data, err | ||
167 | +} | ||
168 | + | ||
169 | +// DividendsReturnedOrderGet 返回分红退货单详情 | ||
170 | +func (gateway HttplibAlliedCreationCooperation) DividendsReturnedOrderGet(param ReqDividendsReturnedOrderGet) (*DataDividendsReturnedOrderGet, error) { | ||
171 | + url := gateway.baseUrL + "/dividends-returned-orders" + strconv.Itoa(param.DividendsReturnedOrderId) | ||
172 | + method := "GET" | ||
173 | + req := gateway.CreateRequest(url, method) | ||
174 | + log.Logger.Debug("向业务模块请求数据:返回分红退货单详情。", map[string]interface{}{ | ||
175 | + "api": method + ":" + url, | ||
176 | + "param": param, | ||
177 | + }) | ||
178 | + req, err := req.JSONBody(param) | ||
179 | + if err != nil { | ||
180 | + return nil, fmt.Errorf("请求返回分红退货单详情失败:%w", err) | ||
181 | + } | ||
182 | + | ||
183 | + byteResult, err := req.Bytes() | ||
184 | + if err != nil { | ||
185 | + return nil, fmt.Errorf("获取返回分红退货单详情失败:%w", err) | ||
186 | + } | ||
187 | + log.Logger.Debug("获取业务模块请求数据:返回分红退货单详情。", map[string]interface{}{ | ||
188 | + "result": string(byteResult), | ||
189 | + }) | ||
190 | + var result service_gateway.GatewayResponse | ||
191 | + err = json.Unmarshal(byteResult, &result) | ||
192 | + if err != nil { | ||
193 | + return nil, fmt.Errorf("解析返回分红退货单详情:%w", err) | ||
194 | + } | ||
195 | + var data DataDividendsReturnedOrderGet | ||
196 | + err = gateway.GetResponseData(result, &data) | ||
197 | + return &data, err | ||
198 | +} |
pkg/infrastructure/service_gateway/allied_creation_cooperation/param_dividends_returned_order.go
0 → 100644
1 | +package allied_creation_cooperation | ||
2 | + | ||
3 | +import "time" | ||
4 | + | ||
5 | +//创建分红退货单 | ||
6 | +type ( | ||
7 | + DividendsReturnedOrderGoods struct { | ||
8 | + CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 | ||
9 | + OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 | ||
10 | + OrderGoodName string `json:"orderGoodName"` //订单产品名称 | ||
11 | + OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 | ||
12 | + OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 | ||
13 | + } | ||
14 | + | ||
15 | + DividendsReturnedOrder struct { | ||
16 | + // 公司 | ||
17 | + Company struct { | ||
18 | + CompanyID int `json:"companyId"` | ||
19 | + CompanyLogo string `json:"companyLogo"` | ||
20 | + CompanyName string `json:"companyName"` | ||
21 | + } `json:"company"` | ||
22 | + CreatedAt time.Time `json:"createdAt"` | ||
23 | + DividendStatus int `json:"dividendStatus"` // 分红订单分红状态,1待分红,2已分红,3部分分红 | ||
24 | + DividendTime time.Time `json:"dividendTime"` //分红订单分红时间 | ||
25 | + DividendsOrderNumber int `json:"dividendsOrderNumber"` //关联分红订单号 | ||
26 | + DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户姓名 | ||
27 | + DividendsReturnedDate time.Time `json:"dividendsReturnedDate"` //退货日期 | ||
28 | + DividendsReturnedOrderID string `json:"dividendsReturnedOrderId"` //分红退货单记录id | ||
29 | + DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"` //分红退货单号 | ||
30 | + DividendsReturnedOrderRefund float64 `json:"dividendsReturnedOrderRefund"` //退货金额 | ||
31 | + OperateTime string `json:"operateTime"` //操作时间 | ||
32 | + OriginalOrderNum string `json:"originalOrderNum"` //源单号(原始订单号) | ||
33 | + Remarks string `json:"remarks"` //备注 | ||
34 | + UpdatedAt string `json:"updatedAt"` | ||
35 | + //更新时间 | ||
36 | + Org struct { | ||
37 | + OrgID int `json:"orgId"` // | ||
38 | + OrgName string `json:"orgName"` // | ||
39 | + } `json:"org"` //归属组织机构 | ||
40 | + | ||
41 | + Region struct { | ||
42 | + RegionName string `json:"regionName"` | ||
43 | + RegionNumber string `json:"regionNumber"` //区域编码 | ||
44 | + } `json:"region"` //区域信息 | ||
45 | + Goods []DividendsReturnedOrderGoods `json:"goods"` //货品 | ||
46 | + } | ||
47 | + | ||
48 | + ReqDividendsReturnedOrderAdd struct { | ||
49 | + CustomerName string `json:"customerName"` | ||
50 | + DividendsOrderAmount string `json:"dividendsOrderAmount"` | ||
51 | + DividendsOrderNumber string `json:"dividendsOrderNumber"` | ||
52 | + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` | ||
53 | + OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"` | ||
54 | + OrderTime time.Time `json:"orderTime"` | ||
55 | + OrgId int `json:"orgId"` | ||
56 | + Remarks string `json:"remarks"` | ||
57 | + SalesmanUid string `json:"salesmanUid"` | ||
58 | + RegionName string `json:"regionName"` | ||
59 | + } | ||
60 | + | ||
61 | + DataDividendsReturnedOrderAdd struct { | ||
62 | + } | ||
63 | +) | ||
64 | + | ||
65 | +//更新分红退货单 | ||
66 | +type ( | ||
67 | + ReqDividendsReturnedOrderUpdate struct { | ||
68 | + DividendsReturnedOrderID int `json:"dividendsReturnedOrderId"` //分红退货单记录id | ||
69 | + CustomerName string `json:"customerName"` | ||
70 | + DividendsOrderAmount string `json:"dividendsOrderAmount"` | ||
71 | + DividendsOrderNumber string `json:"dividendsOrderNumber"` | ||
72 | + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` | ||
73 | + OrderGoods []DividendsReturnedOrderGoods `json:"orderGoods"` | ||
74 | + OrderTime time.Time `json:"orderTime"` | ||
75 | + OrgId int `json:"orgId"` | ||
76 | + Remarks string `json:"remarks"` | ||
77 | + SalesmanUid string `json:"salesmanUid"` | ||
78 | + RegionName string `json:"regionName"` | ||
79 | + } | ||
80 | + | ||
81 | + DataDividendsReturnedOrderUpdate struct { | ||
82 | + } | ||
83 | +) | ||
84 | + | ||
85 | +//查找分红退货单 | ||
86 | +type ( | ||
87 | + ReqDividendsReturnedOrderSearch struct { | ||
88 | + CompanyId int `json:"companyId"` | ||
89 | + OrgId int `json:"orgId"` | ||
90 | + PageNumber int `json:"pageNumber"` | ||
91 | + PageSize int `json:"pageSize"` | ||
92 | + DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"` | ||
93 | + DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` | ||
94 | + UserId int `json:"userId"` | ||
95 | + } | ||
96 | + | ||
97 | + DataDividendsReturnedOrderSearch struct { | ||
98 | + Total int `json:"total"` | ||
99 | + List []DividendsReturnedOrder `json:"list"` | ||
100 | + } | ||
101 | +) | ||
102 | + | ||
103 | +//移除分红退货单 | ||
104 | +type ( | ||
105 | + ReqDividendsReturnedOrderRemove struct { | ||
106 | + DividendsReturnedOrderID int `json:"dividendsReturnedOrderId"` //分红退货单记录id | ||
107 | + } | ||
108 | + | ||
109 | + DataDividendsReturnedOrderRemove struct { | ||
110 | + } | ||
111 | +) | ||
112 | + | ||
113 | +//返回分红退货单列表 | ||
114 | +type ( | ||
115 | + ReqDividendsReturnedOrderList struct { | ||
116 | + } | ||
117 | + | ||
118 | + DataDividendsReturnedOrderList struct { | ||
119 | + } | ||
120 | +) | ||
121 | + | ||
122 | +//返回分红退货单详情 | ||
123 | +type ( | ||
124 | + ReqDividendsReturnedOrderGet struct { | ||
125 | + DividendsReturnedOrderId int `json:"dividendsReturnedOrderId"` | ||
126 | + } | ||
127 | + | ||
128 | + DataDividendsReturnedOrderGet struct { | ||
129 | + DividendsReturnedOrder | ||
130 | + } | ||
131 | +) |
-
请 注册 或 登录 后发表评论