Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway into dev
正在显示
29 个修改的文件
包含
1389 行增加
和
38 行删除
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/beego/beego/v2/core/validation" | ||
7 | +) | ||
8 | + | ||
9 | +type CreateCooperationContractCommand struct { | ||
10 | + CooperationContract struct { | ||
11 | + CooperationContractId int `json:"cooperationContractId,string"` | ||
12 | + // 共创合约描述 | ||
13 | + Description string `json:"Description"` | ||
14 | + // 共创合约编号 | ||
15 | + CooperationContractNumber string `json:"cooperationContractNumber"` | ||
16 | + // 共创项目编号, | ||
17 | + CooperationProjectNumber string `json:"cooperationProjectNumber"` | ||
18 | + // 共创合约发起部门编码 | ||
19 | + DepartmentId string `json:"departmentId"` | ||
20 | + // 共创合约承接对象,1员工,2共创用户,3公开 | ||
21 | + CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` | ||
22 | + // 共创合约名称 | ||
23 | + CooperationContractName string `json:"cooperationContractName"` | ||
24 | + // 共创模式编码,手动输入,唯一确定 | ||
25 | + CooperationModeNumber string `json:"cooperationModeNumber"` | ||
26 | + // 共创合约发起人uid | ||
27 | + SponsorUserId string `json:"sponsorUserId"` | ||
28 | + } `json:"cooperationContract"` | ||
29 | + | ||
30 | + // 业绩分红激励规则列表 | ||
31 | + DividendsIncentivesRules []struct { | ||
32 | + // 关联的项目合约编号 | ||
33 | + CooperationContractNumber string `json:"cooperationContractNumber"` | ||
34 | + // 推荐人抽成比例 | ||
35 | + ReferrerPercentage float64 `json:"referrerPercentage"` | ||
36 | + // 业务员抽成比例 | ||
37 | + SalesmanPercentage float64 `json:"salesmanPercentage"` | ||
38 | + // 分红规则激励百分点 | ||
39 | + DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"` | ||
40 | + // 分红规则激励阶段, | ||
41 | + DividendsIncentivesStage int64 `json:"dividendsIncentivesStage,string,"` | ||
42 | + // 分红规则激励阶段结束 | ||
43 | + DividendsIncentivesStageEnd int `json:"dividendsIncentivesStageEnd"` | ||
44 | + // 分红规则激励阶段开始 | ||
45 | + DividendsIncentivesStageStart int `json:"dividendsIncentivesStageStart"` | ||
46 | + } `json:"dividendsIncentivesRules"` | ||
47 | + // 金额激励规则列表 | ||
48 | + MoneyIncentivesRules []struct { | ||
49 | + // 金额激励规则ID | ||
50 | + MoneyIncentivesRuleId int64 `json:"moneyIncentivesRuleId,string,"` | ||
51 | + // 关联的共创合约编号 | ||
52 | + CooperationContractNumber string `json:"cooperationContractNumber"` | ||
53 | + // 激励金额 | ||
54 | + MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"` | ||
55 | + // 金额激励阶段, | ||
56 | + MoneyIncentivesStage int64 `json:"moneyIncentivesStage,string,"` | ||
57 | + // 金额激励规则时间 | ||
58 | + MoneyIncentivesTime int `json:"moneyIncentivesTime"` | ||
59 | + // 推荐人抽成比例 | ||
60 | + ReferrerPercentage float64 `json:"referrerPercentage"` | ||
61 | + // 业务员抽成比例 | ||
62 | + SalesmanPercentage float64 `json:"salesmanPercentage"` | ||
63 | + } `json:"moneyIncentivesRules"` | ||
64 | + | ||
65 | + // 关联用户id | ||
66 | + RelationUser []int `json:"relationUser"` | ||
67 | + //承接人列表 | ||
68 | + ContractUndertaker []struct { | ||
69 | + HasReferrer bool `json:"hasReferrer"` | ||
70 | + HasSalesman bool `json:"hasSalesman"` | ||
71 | + UsersId int `json:"usersId,string,"` | ||
72 | + ReferrerUser struct { | ||
73 | + UserId int `json:"userId,string,"` | ||
74 | + } `json:"referrerUser"` | ||
75 | + SalesmanUser struct { | ||
76 | + UserId int `json:"userId"` | ||
77 | + } `json:"salesmanUser"` | ||
78 | + Attachment []struct { | ||
79 | + Name string `json:"name"` | ||
80 | + Type string `json:"type"` | ||
81 | + Url string `json:"url"` | ||
82 | + FileSize int `json:"fileSize"` | ||
83 | + } `json:"attachment"` | ||
84 | + } `json:"contractUndertaker"` | ||
85 | +} | ||
86 | + | ||
87 | +func (createCooperationContractCommand *CreateCooperationContractCommand) Valid(validation *validation.Validation) { | ||
88 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
89 | +} | ||
90 | + | ||
91 | +func (createCooperationContractCommand *CreateCooperationContractCommand) ValidateCommand() error { | ||
92 | + valid := validation.Validation{} | ||
93 | + b, err := valid.Valid(createCooperationContractCommand) | ||
94 | + if err != nil { | ||
95 | + return err | ||
96 | + } | ||
97 | + if !b { | ||
98 | + for _, validErr := range valid.Errors { | ||
99 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
100 | + } | ||
101 | + } | ||
102 | + return nil | ||
103 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/beego/beego/v2/core/validation" | ||
7 | +) | ||
8 | + | ||
9 | +type EnableCooperationContractCommand struct { | ||
10 | + // 共创合约ID | ||
11 | + CooperationContractId []string `json:"cooperationContractId" valid:"Required"` | ||
12 | + // 暂停和恢复的状态 | ||
13 | + Status int `json:"status,omitempty"` | ||
14 | +} | ||
15 | + | ||
16 | +func (enableCooperationContractCommand *EnableCooperationContractCommand) Valid(validation *validation.Validation) { | ||
17 | + | ||
18 | +} | ||
19 | + | ||
20 | +func (enableCooperationContractCommand *EnableCooperationContractCommand) ValidateCommand() error { | ||
21 | + valid := validation.Validation{} | ||
22 | + b, err := valid.Valid(enableCooperationContractCommand) | ||
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 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "time" | ||
6 | + | ||
7 | + "github.com/beego/beego/v2/core/validation" | ||
8 | +) | ||
9 | + | ||
10 | +type UpdateCooperationContractCommand struct { | ||
11 | + CooperationContract struct { | ||
12 | + CooperationContractId int `json:"cooperationContractId,string"` | ||
13 | + // 共创合约描述 | ||
14 | + Description string `json:"Description"` | ||
15 | + // 共创合约编号 | ||
16 | + CooperationContractNumber string `json:"cooperationContractNumber"` | ||
17 | + // 共创项目编号, | ||
18 | + CooperationProjectNumber string `json:"cooperationProjectNumber"` | ||
19 | + // 共创合约发起部门编码 | ||
20 | + DepartmentId string `json:"departmentId"` | ||
21 | + // 共创合约承接对象,1员工,2共创用户,3公开 | ||
22 | + CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` | ||
23 | + // 共创合约名称 | ||
24 | + CooperationContractName string `json:"cooperationContractName"` | ||
25 | + // 共创模式编码,手动输入,唯一确定 | ||
26 | + CooperationModeNumber string `json:"cooperationModeNumber"` | ||
27 | + // 共创合约发起人uid | ||
28 | + SponsorUserId string `json:"sponsorUserId"` | ||
29 | + } `json:"cooperationContract"` | ||
30 | + | ||
31 | + // 业绩分红激励规则列表 | ||
32 | + DividendsIncentivesRules []struct { | ||
33 | + // 关联的项目合约编号 | ||
34 | + CooperationContractNumber string `json:"cooperationContractNumber"` | ||
35 | + // 推荐人抽成比例 | ||
36 | + ReferrerPercentage float64 `json:"referrerPercentage"` | ||
37 | + // 业务员抽成比例 | ||
38 | + SalesmanPercentage float64 `json:"salesmanPercentage"` | ||
39 | + // 分红规则激励百分点 | ||
40 | + DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"` | ||
41 | + // 分红规则激励阶段, | ||
42 | + DividendsIncentivesStage int64 `json:"dividendsIncentivesStage,string,"` | ||
43 | + // 分红规则激励阶段结束 | ||
44 | + DividendsIncentivesStageEnd time.Time `json:"dividendsIncentivesStageEnd"` | ||
45 | + // 分红规则激励阶段开始 | ||
46 | + DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"` | ||
47 | + } `json:"dividendsIncentivesRules"` | ||
48 | + // 金额激励规则列表 | ||
49 | + MoneyIncentivesRules []struct { | ||
50 | + // 金额激励规则ID | ||
51 | + MoneyIncentivesRuleId int64 `json:"moneyIncentivesRuleId,string,"` | ||
52 | + // 关联的共创合约编号 | ||
53 | + CooperationContractNumber string `json:"cooperationContractNumber"` | ||
54 | + // 激励金额 | ||
55 | + MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"` | ||
56 | + // 金额激励阶段, | ||
57 | + MoneyIncentivesStage int64 `json:"moneyIncentivesStage,string,"` | ||
58 | + // 金额激励规则时间 | ||
59 | + MoneyIncentivesTime time.Time `json:"moneyIncentivesTime"` | ||
60 | + // 推荐人抽成比例 | ||
61 | + ReferrerPercentage float64 `json:"referrerPercentage"` | ||
62 | + // 业务员抽成比例 | ||
63 | + SalesmanPercentage float64 `json:"salesmanPercentage"` | ||
64 | + } `json:"moneyIncentivesRules"` | ||
65 | + | ||
66 | + // 关联用户id | ||
67 | + RelationUser []int `json:"relationUser"` | ||
68 | + //承接人列表 | ||
69 | + ContractUndertaker []struct { | ||
70 | + HasReferrer bool `json:"hasReferrer"` | ||
71 | + HasSalesman bool `json:"hasSalesman"` | ||
72 | + UsersId int `json:"usersId,string,"` | ||
73 | + ReferrerUser struct { | ||
74 | + UserId int `json:"userId,string,"` | ||
75 | + } `json:"referrerUser"` | ||
76 | + SalesmanUser struct { | ||
77 | + UserId int `json:"userId"` | ||
78 | + } `json:"salesmanUser"` | ||
79 | + Attachment []struct { | ||
80 | + Name string `json:"name"` | ||
81 | + Type string `json:"type"` | ||
82 | + Url string `json:"url"` | ||
83 | + FileSize int `json:"fileSize"` | ||
84 | + } `json:"attachment"` | ||
85 | + } `json:"contractUndertaker"` | ||
86 | +} | ||
87 | + | ||
88 | +func (updateCooperationContractCommand *UpdateCooperationContractCommand) Valid(validation *validation.Validation) { | ||
89 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
90 | +} | ||
91 | + | ||
92 | +func (updateCooperationContractCommand *UpdateCooperationContractCommand) ValidateCommand() error { | ||
93 | + valid := validation.Validation{} | ||
94 | + b, err := valid.Valid(updateCooperationContractCommand) | ||
95 | + if err != nil { | ||
96 | + return err | ||
97 | + } | ||
98 | + if !b { | ||
99 | + for _, validErr := range valid.Errors { | ||
100 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
101 | + } | ||
102 | + } | ||
103 | + return nil | ||
104 | +} |
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/beego/beego/v2/core/validation" | ||
7 | +) | ||
8 | + | ||
9 | +type GetCooperationContractQuery struct { | ||
10 | + // 共创合约ID | ||
11 | + CooperationContractId int64 `json:"cooperationContractId" valid:"Required"` | ||
12 | +} | ||
13 | + | ||
14 | +func (getCooperationContractQuery *GetCooperationContractQuery) Valid(validation *validation.Validation) { | ||
15 | + | ||
16 | +} | ||
17 | + | ||
18 | +func (getCooperationContractQuery *GetCooperationContractQuery) ValidateQuery() error { | ||
19 | + valid := validation.Validation{} | ||
20 | + b, err := valid.Valid(getCooperationContractQuery) | ||
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 | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/beego/beego/v2/core/validation" | ||
7 | +) | ||
8 | + | ||
9 | +type ListCooperationContractQuery struct { | ||
10 | + // 查询偏离量 | ||
11 | + PageNumber int `json:"pageNumber"` | ||
12 | + // 查询限制 | ||
13 | + PageSize int `json:"pageSize" valid:"Required"` | ||
14 | +} | ||
15 | + | ||
16 | +func (listCooperationContractQuery *ListCooperationContractQuery) Valid(validation *validation.Validation) { | ||
17 | + | ||
18 | +} | ||
19 | + | ||
20 | +func (listCooperationContractQuery *ListCooperationContractQuery) ValidateQuery() error { | ||
21 | + valid := validation.Validation{} | ||
22 | + b, err := valid.Valid(listCooperationContractQuery) | ||
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 | +} |
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/cooperationContract/command" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/query" | ||
7 | +) | ||
8 | + | ||
9 | +// 共创合约管理 | ||
10 | +type CooperationContractService struct { | ||
11 | +} | ||
12 | + | ||
13 | +// 创建共创合约管理 | ||
14 | +func (cooperationContractService *CooperationContractService) CreateCooperationContract(createCooperationContractCommand *command.CreateCooperationContractCommand) (interface{}, error) { | ||
15 | + if err := createCooperationContractCommand.ValidateCommand(); err != nil { | ||
16 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
17 | + } | ||
18 | + return nil, nil | ||
19 | +} | ||
20 | + | ||
21 | +// 暂停恢复共创合约 | ||
22 | +func (cooperationContractService *CooperationContractService) EnableCooperationContract(enableCooperationContractCommand *command.EnableCooperationContractCommand) (interface{}, error) { | ||
23 | + if err := enableCooperationContractCommand.ValidateCommand(); err != nil { | ||
24 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
25 | + } | ||
26 | + | ||
27 | + return nil, nil | ||
28 | +} | ||
29 | + | ||
30 | +// 返回共创合约管理 | ||
31 | +func (cooperationContractService *CooperationContractService) GetCooperationContract(getCooperationContractQuery *query.GetCooperationContractQuery) (interface{}, error) { | ||
32 | + if err := getCooperationContractQuery.ValidateQuery(); err != nil { | ||
33 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
34 | + } | ||
35 | + return nil, nil | ||
36 | +} | ||
37 | + | ||
38 | +// 返回共创合约管理列表 | ||
39 | +func (cooperationContractService *CooperationContractService) ListCooperationContract(listCooperationContractQuery *query.ListCooperationContractQuery) (interface{}, error) { | ||
40 | + if err := listCooperationContractQuery.ValidateQuery(); err != nil { | ||
41 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
42 | + } | ||
43 | + return nil, nil | ||
44 | +} | ||
45 | + | ||
46 | +// 更新共创合约管理 | ||
47 | +func (cooperationContractService *CooperationContractService) UpdateCooperationContract(updateCooperationContractCommand *command.UpdateCooperationContractCommand) (interface{}, error) { | ||
48 | + if err := updateCooperationContractCommand.ValidateCommand(); err != nil { | ||
49 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
50 | + } | ||
51 | + return nil, nil | ||
52 | +} | ||
53 | + | ||
54 | +func NewCooperationContractService(options map[string]interface{}) *CooperationContractService { | ||
55 | + newCooperationContractService := &CooperationContractService{} | ||
56 | + return newCooperationContractService | ||
57 | +} |
@@ -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 { |
@@ -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 | // 返回共创项目管理列表 |
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 CreateDividendsOrderCommand struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | + //客户名称 | ||
14 | + CustomerName string `json:"customerName" valid:"Required"` | ||
15 | + //分红订单金额 | ||
16 | + DividendsOrderAmount float64 `json:"dividendsOrderAmount" valid:"Required"` | ||
17 | + //分红订单号 | ||
18 | + DividendsOrderNumber string `json:"dividendsOrderNumber" valid:"Required"` | ||
19 | + //分红订单原单号 | ||
20 | + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"` | ||
21 | + //订单产生时间 时间戳 秒 | ||
22 | + OrderTime int64 `json:"orderTime" valid:"Required"` | ||
23 | + //备注 | ||
24 | + Remarks string `json:"remarks" valid:"Required"` | ||
25 | + //订单业务员uid | ||
26 | + SalesmanUid string `json:"salesmanUid"` | ||
27 | + //订单操作人uid | ||
28 | + OperatorUid string `json:"operatorUid"` | ||
29 | + //区域名称 | ||
30 | + RegionName string `json:"regionName"` | ||
31 | + //订单产品列表 | ||
32 | + OrderGoods []struct { | ||
33 | + CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 | ||
34 | + DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号 | ||
35 | + OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 | ||
36 | + OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用 | ||
37 | + OrderGoodName string `json:"orderGoodName"` //订单产品名称 | ||
38 | + OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 | ||
39 | + OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 | ||
40 | + } `json:"orderGoods"` | ||
41 | +} | ||
42 | + | ||
43 | +func (createDividendsOrderCommand *CreateDividendsOrderCommand) Valid(validation *validation.Validation) { | ||
44 | + | ||
45 | +} | ||
46 | + | ||
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 | +} |
@@ -7,42 +7,20 @@ import ( | @@ -7,42 +7,20 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" |
8 | ) | 8 | ) |
9 | 9 | ||
10 | -type ReleaseCooperationProjectCommand struct { | 10 | +type RemoveDividendsOrderCommand struct { |
11 | //操作人 | 11 | //操作人 |
12 | Operator domain.Operator `json:"-"` | 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"` | 13 | + // 分红订单ID |
14 | + DividendsOrderId []string `json:"dividendsOrderId" valid:"Required"` | ||
37 | } | 15 | } |
38 | 16 | ||
39 | -func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) Valid(validation *validation.Validation) { | 17 | +func (removeDividendsOrderCommand *RemoveDividendsOrderCommand) Valid(validation *validation.Validation) { |
40 | validation.SetError("CustomValid", "未实现的自定义认证") | 18 | validation.SetError("CustomValid", "未实现的自定义认证") |
41 | } | 19 | } |
42 | 20 | ||
43 | -func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) ValidateCommand() error { | 21 | +func (removeDividendsOrderCommand *RemoveDividendsOrderCommand) ValidateCommand() error { |
44 | valid := validation.Validation{} | 22 | valid := validation.Validation{} |
45 | - b, err := valid.Valid(releaseCooperationProjectCommand) | 23 | + b, err := valid.Valid(removeDividendsOrderCommand) |
46 | if err != nil { | 24 | if err != nil { |
47 | return err | 25 | return err |
48 | } | 26 | } |
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 UpdateDividendsOrderCommand struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | + //分红订单 | ||
14 | + DividendsOrderID int `json:"dividendsOrderId"` | ||
15 | + //客户名称 | ||
16 | + CustomerName string `json:"customerName" valid:"Required"` | ||
17 | + //分红订单金额 | ||
18 | + DividendsOrderAmount float64 `json:"dividendsOrderAmount" valid:"Required"` | ||
19 | + //分红订单号 | ||
20 | + DividendsOrderNumber string `json:"dividendsOrderNumber" valid:"Required"` | ||
21 | + //分红订单原单号 | ||
22 | + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum" valid:"Required"` | ||
23 | + //订单产生时间 | ||
24 | + OrderTime int64 `json:"orderTime" valid:"Required"` | ||
25 | + //备注 | ||
26 | + Remarks string `json:"remarks" valid:"Required"` | ||
27 | + //订单业务员uid | ||
28 | + SalesmanUid string `json:"salesmanUid"` | ||
29 | + //订单操作人uid | ||
30 | + OperatorUid string `json:"operatorUid"` | ||
31 | + //区域名称 | ||
32 | + RegionName string `json:"regionName"` | ||
33 | + //订单产品列表 | ||
34 | + OrderGoods []struct { | ||
35 | + CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 | ||
36 | + DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号 | ||
37 | + OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 | ||
38 | + OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用 | ||
39 | + OrderGoodName string `json:"orderGoodName"` //订单产品名称 | ||
40 | + OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 | ||
41 | + OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 | ||
42 | + } `json:"orderGoods"` | ||
43 | +} | ||
44 | + | ||
45 | +func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) { | ||
46 | + | ||
47 | +} | ||
48 | + | ||
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 | +} |
1 | +package query | ||
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 GetDividendsOrderQuery struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | + // 分红订单ID | ||
14 | + DividendsOrderId int `json:"dividendsOrderId,string" valid:"Required"` | ||
15 | +} | ||
16 | + | ||
17 | +func (getDividendsOrderQuery *GetDividendsOrderQuery) Valid(validation *validation.Validation) { | ||
18 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
19 | +} | ||
20 | + | ||
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 | +} |
1 | +package query | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + | ||
6 | + "github.com/beego/beego/v2/core/validation" | ||
7 | +) | ||
8 | + | ||
9 | +type ListDividendsOrdersQuery struct { | ||
10 | + // 页码 | ||
11 | + PageNumber int `json:"pageNumber"` | ||
12 | + // 每页限制 | ||
13 | + PageSize int `json:"pageSize"` | ||
14 | +} | ||
15 | + | ||
16 | +func (listDividendsOrdersQuery *ListDividendsOrdersQuery) Valid(validation *validation.Validation) { | ||
17 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
18 | +} | ||
19 | + | ||
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 | +} |
1 | +package query | ||
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 SearchDividendsOrderQuery struct { | ||
11 | + //操作人 | ||
12 | + Operator domain.Operator `json:"-"` | ||
13 | + // 分红订单号 | ||
14 | + DividendsOrderNumber string `json:"dividendsOrderNumber,omitempty"` | ||
15 | + // 客户名称 | ||
16 | + CustomerName string `json:"customerName,omitempty"` | ||
17 | + // 页码 | ||
18 | + PageNumber int `json:"pageNumber"` | ||
19 | + // 每页限制 | ||
20 | + PageSize int `json:"pageSize"` | ||
21 | +} | ||
22 | + | ||
23 | +func (searchDividendsOrderQuery *SearchDividendsOrderQuery) Valid(validation *validation.Validation) { | ||
24 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
25 | +} | ||
26 | + | ||
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 | +} |
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "strconv" | ||
5 | + "time" | ||
6 | + | ||
7 | + "github.com/linmadan/egglib-go/core/application" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/command" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/query" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
11 | +) | ||
12 | + | ||
13 | +// 分红订单实体对象 | ||
14 | +type DividendsOrderService struct { | ||
15 | +} | ||
16 | + | ||
17 | +// 创建分红订单实体对象 | ||
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 | + } | ||
22 | + orderGoods := []allied_creation_cooperation.DividendsOrderGoods{} | ||
23 | + for _, v := range createDividendsOrderCommand.OrderGoods { | ||
24 | + good := allied_creation_cooperation.DividendsOrderGoods{ | ||
25 | + CooperationContractNumber: v.CooperationContractNumber, | ||
26 | + DividendsOrderNumber: v.DividendsOrderNumber, | ||
27 | + OrderGoodAmount: v.OrderGoodAmount, | ||
28 | + OrderGoodExpense: v.OrderGoodExpense, | ||
29 | + OrderGoodName: v.OrderGoodName, | ||
30 | + OrderGoodPrice: v.OrderGoodPrice, | ||
31 | + OrderGoodQuantity: v.OrderGoodQuantity, | ||
32 | + } | ||
33 | + orderGoods = append(orderGoods, good) | ||
34 | + } | ||
35 | + t := time.Unix(createDividendsOrderCommand.OrderTime, 0) | ||
36 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsOrderCommand.Operator) | ||
37 | + result, err := creationCooperationGateway.DividendsOrderAdd(allied_creation_cooperation.ReqDividendsOrderAdd{ | ||
38 | + CompanyId: int(createDividendsOrderCommand.Operator.CompanyId), | ||
39 | + CustomerName: createDividendsOrderCommand.CustomerName, | ||
40 | + DividendsOrderAmount: createDividendsOrderCommand.DividendsOrderAmount, | ||
41 | + DividendsOrderNumber: createDividendsOrderCommand.DividendsOrderNumber, | ||
42 | + DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum, | ||
43 | + OperatorUid: int(createDividendsOrderCommand.Operator.UserId), | ||
44 | + OrderTime: t, | ||
45 | + Remarks: createDividendsOrderCommand.Remarks, | ||
46 | + SalesmanUid: createDividendsOrderCommand.SalesmanUid, | ||
47 | + RegionName: createDividendsOrderCommand.RegionName, | ||
48 | + OrderGoods: orderGoods, | ||
49 | + }) | ||
50 | + if err != nil { | ||
51 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
52 | + } | ||
53 | + data := struct { | ||
54 | + DividendsOrderId int | ||
55 | + command.CreateDividendsOrderCommand | ||
56 | + }{ | ||
57 | + DividendsOrderId: result.DividendsOrderID, | ||
58 | + CreateDividendsOrderCommand: *createDividendsOrderCommand, | ||
59 | + } | ||
60 | + return data, nil | ||
61 | +} | ||
62 | + | ||
63 | +// 返回分红订单实体对象 | ||
64 | +func (dividendsOrderService *DividendsOrderService) GetDividendsOrder(getDividendsOrderQuery *query.GetDividendsOrderQuery) (interface{}, error) { | ||
65 | + if err := getDividendsOrderQuery.ValidateQuery(); err != nil { | ||
66 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
67 | + } | ||
68 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getDividendsOrderQuery.Operator) | ||
69 | + result, err := creationCooperationGateway.DividendsOrderGet(allied_creation_cooperation.ReqDividendsOrderGet{ | ||
70 | + DividendsOrderId: getDividendsOrderQuery.DividendsOrderId, | ||
71 | + }) | ||
72 | + if err != nil { | ||
73 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
74 | + } | ||
75 | + return result, nil | ||
76 | +} | ||
77 | + | ||
78 | +// 移除分红订单实体对象 | ||
79 | +func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeDividendsOrderCommand *command.RemoveDividendsOrderCommand) (interface{}, error) { | ||
80 | + if err := removeDividendsOrderCommand.ValidateCommand(); err != nil { | ||
81 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
82 | + } | ||
83 | + dividendsOrderId := []int{} | ||
84 | + for _, v := range removeDividendsOrderCommand.DividendsOrderId { | ||
85 | + id, _ := strconv.Atoi(v) | ||
86 | + dividendsOrderId = append(dividendsOrderId, id) | ||
87 | + } | ||
88 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsOrderCommand.Operator) | ||
89 | + creationCooperationGateway.DividendsOrderRemove(allied_creation_cooperation.ReqDividendsOrderRemove{ | ||
90 | + DividendsOrderId: 0, ///TODO 改换为批量删除 | ||
91 | + }) | ||
92 | + return nil, nil | ||
93 | +} | ||
94 | + | ||
95 | +// 查询分红订单方法 | ||
96 | +func (dividendsOrderService *DividendsOrderService) SearchDividendsOrder(searchDividendsOrderQuery *query.SearchDividendsOrderQuery) (int, interface{}, error) { | ||
97 | + if err := searchDividendsOrderQuery.ValidateQuery(); err != nil { | ||
98 | + return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
99 | + } | ||
100 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(searchDividendsOrderQuery.Operator) | ||
101 | + result, err := creationCooperationGateway.DividendsOrderSearch(allied_creation_cooperation.ReqDividendsOrderSearch{ | ||
102 | + PageNumber: searchDividendsOrderQuery.PageNumber, | ||
103 | + PageSize: searchDividendsOrderQuery.PageSize, | ||
104 | + CustomerName: searchDividendsOrderQuery.CustomerName, | ||
105 | + DividendsOrderNumber: searchDividendsOrderQuery.DividendsOrderNumber, | ||
106 | + }) | ||
107 | + if err != nil { | ||
108 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
109 | + } | ||
110 | + | ||
111 | + return result.Gride.Total, result.Gride.List, nil | ||
112 | +} | ||
113 | + | ||
114 | +// 更新分红订单实体对象 | ||
115 | +func (dividendsOrderService *DividendsOrderService) UpdateDividendsOrder(updateDividendsOrderCommand *command.UpdateDividendsOrderCommand) (interface{}, error) { | ||
116 | + if err := updateDividendsOrderCommand.ValidateCommand(); err != nil { | ||
117 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
118 | + } | ||
119 | + orderGoods := []allied_creation_cooperation.DividendsOrderGoods{} | ||
120 | + for _, v := range updateDividendsOrderCommand.OrderGoods { | ||
121 | + good := allied_creation_cooperation.DividendsOrderGoods{ | ||
122 | + CooperationContractNumber: v.CooperationContractNumber, | ||
123 | + DividendsOrderNumber: v.DividendsOrderNumber, | ||
124 | + OrderGoodAmount: v.OrderGoodAmount, | ||
125 | + OrderGoodExpense: v.OrderGoodExpense, | ||
126 | + OrderGoodName: v.OrderGoodName, | ||
127 | + OrderGoodPrice: v.OrderGoodPrice, | ||
128 | + OrderGoodQuantity: v.OrderGoodQuantity, | ||
129 | + } | ||
130 | + orderGoods = append(orderGoods, good) | ||
131 | + } | ||
132 | + t := time.Unix(updateDividendsOrderCommand.OrderTime, 0) | ||
133 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsOrderCommand.Operator) | ||
134 | + _, err := creationCooperationGateway.DividendsOrderUpdate(allied_creation_cooperation.ReqDividendsOrderUpdate{ | ||
135 | + DividendsOrderId: updateDividendsOrderCommand.DividendsOrderID, | ||
136 | + CompanyId: int(updateDividendsOrderCommand.Operator.CompanyId), | ||
137 | + CustomerName: updateDividendsOrderCommand.CustomerName, | ||
138 | + DividendsOrderAmount: updateDividendsOrderCommand.DividendsOrderAmount, | ||
139 | + DividendsOrderNumber: updateDividendsOrderCommand.DividendsOrderNumber, | ||
140 | + DividendsOriginalOrderNum: updateDividendsOrderCommand.DividendsOriginalOrderNum, | ||
141 | + OperatorUid: int(updateDividendsOrderCommand.Operator.UserId), | ||
142 | + OrderTime: t, | ||
143 | + Remarks: updateDividendsOrderCommand.Remarks, | ||
144 | + SalesmanUid: updateDividendsOrderCommand.SalesmanUid, | ||
145 | + RegionName: updateDividendsOrderCommand.RegionName, | ||
146 | + OrderGoods: orderGoods, | ||
147 | + }) | ||
148 | + if err != nil { | ||
149 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
150 | + } | ||
151 | + return updateDividendsOrderCommand, nil | ||
152 | +} | ||
153 | + | ||
154 | +func NewDividendsOrderService(options map[string]interface{}) *DividendsOrderService { | ||
155 | + newDividendsOrderService := &DividendsOrderService{} | ||
156 | + return newDividendsOrderService | ||
157 | +} |
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 | +} |
1 | package allied_creation_cooperation | 1 | package allied_creation_cooperation |
2 | 2 | ||
3 | +import "time" | ||
4 | + | ||
3 | //创建共创合约 | 5 | //创建共创合约 |
4 | type ( | 6 | type ( |
5 | ReqCooperationContractAdd struct { | 7 | ReqCooperationContractAdd struct { |
8 | + // 共创合约描述 | ||
9 | + CooperationContractDescription string ` json:"cooperationContractDescription"` | ||
10 | + // 共创合约编号 | ||
11 | + CooperationContractNumber string ` json:"cooperationContractNumber"` | ||
12 | + // 共创项目编号, | ||
13 | + CooperationProjectNumber string `json:"cooperationProjectNumber" ` | ||
14 | + // 共创合约发起部门编码 | ||
15 | + DepartmentNumber string `json:"departmentNumber"` | ||
16 | + // 共创合约承接对象,1员工,2共创用户,3公开 | ||
17 | + CooperationContractUndertakerType []int ` json:"cooperationContractUndertakerType"` | ||
18 | + // 共创合约名称 | ||
19 | + CooperationContractName string `json:"cooperationContractName"` | ||
20 | + // 共创模式编码,手动输入,唯一确定 | ||
21 | + CooperationModeNumber string ` json:"cooperationModeNumber"` | ||
22 | + // 共创合约发起人uid | ||
23 | + SponsorUid string `json:"sponsorUid,omitempty"` | ||
24 | + // 业绩分红激励规则列表 | ||
25 | + DividendsIncentivesRules []struct { | ||
26 | + // 关联的项目合约编号 | ||
27 | + CooperationContractNumber string `json:"cooperationContractNumber"` | ||
28 | + // 推荐人抽成比例 | ||
29 | + ReferrerPercentage float64 `json:"referrerPercentage"` | ||
30 | + // 业务员抽成比例 | ||
31 | + SalesmanPercentage float64 `json:"salesmanPercentage"` | ||
32 | + // 分红规则激励百分点 | ||
33 | + DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"` | ||
34 | + // 分红规则激励阶段,阶段返回时需要转换为中文数字 | ||
35 | + DividendsIncentivesStage int64 `json:"dividendsIncentivesStage,string"` | ||
36 | + // 分红规则激励阶段结束 | ||
37 | + DividendsIncentivesStageEnd time.Time `json:"dividendsIncentivesStageEnd"` | ||
38 | + // 分红规则激励阶段开始 | ||
39 | + DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"` | ||
40 | + } `json:"dividendsIncentivesRules"` | ||
41 | + // 金额激励规则列表 | ||
42 | + MoneyIncentivesRules []struct { | ||
43 | + // 金额激励规则ID | ||
44 | + MoneyIncentivesRuleId int64 `json:"moneyIncentivesRuleId,string"` | ||
45 | + // 关联的共创合约编号 | ||
46 | + CooperationContractNumber string `json:"cooperationContractNumber"` | ||
47 | + // 激励金额 | ||
48 | + MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"` | ||
49 | + // 金额激励阶段,阶段返回时需要转换为中文数字 | ||
50 | + MoneyIncentivesStage int64 `json:"moneyIncentivesStage,string"` | ||
51 | + // 金额激励阶段有效期结束 | ||
52 | + MoneyIncentivesStageEnd time.Time `json:"moneyIncentivesStageEnd"` | ||
53 | + // 金额激励阶段有效期开始 | ||
54 | + MoneyIncentivesStageStart time.Time `json:"moneyIncentivesStageStart"` | ||
55 | + // 金额激励规则时间 | ||
56 | + MoneyIncentivesTime time.Time `json:"moneyIncentivesTime"` | ||
57 | + // 推荐人抽成比例 | ||
58 | + ReferrerPercentage float64 `json:"referrerPercentage"` | ||
59 | + // 业务员抽成比例 | ||
60 | + SalesmanPercentage float64 `json:"salesmanPercentage"` | ||
61 | + } `json:"moneyIncentivesRules"` | ||
62 | + // 承接方列表 | ||
63 | + Undertakers []struct { | ||
64 | + UserId int64 `json:"userId,string"` | ||
65 | + // 用户基本id | ||
66 | + UserBaseId int64 `json:"userBaseId,string"` | ||
67 | + // 用户所属组织机构 | ||
68 | + Org struct { | ||
69 | + // 组织机构ID | ||
70 | + OrgId int64 `json:"orgId,string"` | ||
71 | + // 组织名称 | ||
72 | + OrgName string `json:"orgName"` | ||
73 | + } | ||
74 | + } `json:"undertakers"` | ||
6 | } | 75 | } |
7 | 76 | ||
8 | DataCooperationContractAdd struct { | 77 | DataCooperationContractAdd struct { |
@@ -178,8 +178,8 @@ type ( | @@ -178,8 +178,8 @@ type ( | ||
178 | //判断当前勾选的承接对象是否存在用户 | 178 | //判断当前勾选的承接对象是否存在用户 |
179 | type ( | 179 | type ( |
180 | ReqCooperationProjectsCheck struct { | 180 | ReqCooperationProjectsCheck struct { |
181 | - CooperationProjectId int | ||
182 | - CooperationProjectUndertakerTypes []int | 181 | + CooperationProjectId int `json:"cooperationProjectId"` |
182 | + CooperationProjectUndertakerTypes []int `json:"cooperationProjectUndertakerTypes"` | ||
183 | } | 183 | } |
184 | 184 | ||
185 | DataCooperationProjectsCheck struct { | 185 | DataCooperationProjectsCheck struct { |
1 | package allied_creation_cooperation | 1 | package allied_creation_cooperation |
2 | 2 | ||
3 | +import "time" | ||
4 | + | ||
3 | //创建分红订单 | 5 | //创建分红订单 |
6 | + | ||
7 | +type DividendsOrder struct { | ||
8 | + Company struct { | ||
9 | + CompanyID int `json:"companyId"` | ||
10 | + CompanyLogo string `json:"companyLogo"` | ||
11 | + CompanyName string `json:"companyName"` | ||
12 | + } `json:"company"` | ||
13 | + CustomerName string `json:"customerName"` //客户名字 | ||
14 | + DividendStatus int `json:"dividendStatus"` //分红订单分红状态,1待分红,2已分红,3部分分红 | ||
15 | + DividendTime string `json:"dividendTime"` //分红订单分红时间 | ||
16 | + DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额 | ||
17 | + DividendsOrderID int `json:"dividendsOrderId"` //分红订单 | ||
18 | + DividendsOrderNumber int `json:"dividendsOrderNumber"` //分红订单号 | ||
19 | + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号 | ||
20 | + OrderSalesman struct { //订单业务员 | ||
21 | + Department struct { | ||
22 | + DepartmentID int `json:"departmentId"` | ||
23 | + DepartmentName string `json:"departmentName"` | ||
24 | + DepartmentNumber string `json:"departmentNumber"` | ||
25 | + IsOrganization bool `json:"isOrganization"` | ||
26 | + } `json:"department"` | ||
27 | + Org struct { | ||
28 | + OrgID int `json:"orgId"` | ||
29 | + OrgName string `json:"orgName"` | ||
30 | + } `json:"org"` | ||
31 | + UserBaseID int `json:"userBaseId"` | ||
32 | + UserID int `json:"userId"` | ||
33 | + UserInfo struct { | ||
34 | + UserAccount string `json:"userAccount"` | ||
35 | + UserAvatar string `json:"userAvatar"` | ||
36 | + UserEmail string `json:"userEmail"` | ||
37 | + UserName string `json:"userName"` | ||
38 | + UserPhone string `json:"userPhone"` | ||
39 | + } `json:"userInfo"` | ||
40 | + UserType int `json:"userType"` | ||
41 | + } `json:"orderSalesman"` | ||
42 | + OrderTime string `json:"orderTime"` | ||
43 | + Org struct { | ||
44 | + OrgID int `json:"orgId"` | ||
45 | + OrgName string `json:"orgName"` | ||
46 | + } `json:"org"` | ||
47 | + Region struct { | ||
48 | + RegionName string `json:"regionName"` | ||
49 | + RegionNumber string `json:"regionNumber"` | ||
50 | + } | ||
51 | +} | ||
52 | + | ||
4 | type ( | 53 | type ( |
54 | + //订单产品 | ||
55 | + DividendsOrderGoods struct { | ||
56 | + CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 | ||
57 | + DividendsOrderNumber string `json:"dividendsOrderNumber"` //关联分红订单号 | ||
58 | + OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 | ||
59 | + OrderGoodExpense float64 `json:"orderGoodExpense"` //订单产品费用 | ||
60 | + OrderGoodName string `json:"orderGoodName"` //订单产品名称 | ||
61 | + OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 | ||
62 | + OrderGoodQuantity int `json:"orderGoodQuantity"` //订单产品数量 | ||
63 | + } | ||
5 | ReqDividendsOrderAdd struct { | 64 | ReqDividendsOrderAdd struct { |
65 | + CompanyId int `json:"companyId"` | ||
66 | + CustomerName string `json:"customerName"` //客户名称 | ||
67 | + DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额 | ||
68 | + DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号 | ||
69 | + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号 | ||
70 | + OperatorUid int `json:"operatorUid"` //订单操作人id | ||
71 | + OrderGoods []DividendsOrderGoods `json:"orderGoods"` //订单产品列表 | ||
72 | + OrderTime time.Time `json:"orderTime"` //订单产生时间 | ||
73 | + Remarks string `json:"remarks"` //备注 | ||
74 | + SalesmanUid string `json:"salesmanUid"` //订单业务员uid | ||
75 | + UserId int `json:"userId"` // | ||
76 | + RegionName string `json:"regionName"` //区域名称 | ||
6 | } | 77 | } |
7 | 78 | ||
8 | DataDividendsOrderAdd struct { | 79 | DataDividendsOrderAdd struct { |
9 | - DividendsOrderId int | 80 | + DividendsOrder |
10 | } | 81 | } |
11 | ) | 82 | ) |
12 | 83 | ||
13 | //更新分红订单 | 84 | //更新分红订单 |
14 | type ( | 85 | type ( |
15 | ReqDividendsOrderUpdate struct { | 86 | ReqDividendsOrderUpdate struct { |
16 | - DividendsOrderId int | 87 | + DividendsOrderId int `json:"dividendsOrderId"` |
88 | + CompanyId int `json:"companyId"` | ||
89 | + CustomerName string `json:"customerName"` //客户名称 | ||
90 | + DividendsOrderAmount float64 `json:"dividendsOrderAmount"` //分红订单金额 | ||
91 | + DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红订单号 | ||
92 | + DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"` //分红订单原单号 | ||
93 | + OperatorUid int `json:"operatorUid"` //订单操作人id | ||
94 | + OrderGoods []DividendsOrderGoods `json:"orderGoods"` //订单产品列表 | ||
95 | + OrderTime time.Time `json:"orderTime"` //订单产生时间 | ||
96 | + Remarks string `json:"remarks"` //备注 | ||
97 | + SalesmanUid string `json:"salesmanUid"` //订单业务员uid | ||
98 | + UserId int `json:"userId"` // | ||
99 | + RegionName string `json:"regionName"` //区域名称 | ||
17 | } | 100 | } |
18 | 101 | ||
19 | DataDividendsOrderUpdate struct { | 102 | DataDividendsOrderUpdate struct { |
103 | + DividendsOrder | ||
20 | } | 104 | } |
21 | ) | 105 | ) |
22 | 106 | ||
23 | //查询分红订单 | 107 | //查询分红订单 |
24 | type ( | 108 | type ( |
25 | ReqDividendsOrderSearch struct { | 109 | ReqDividendsOrderSearch struct { |
110 | + CompanyId int `json:"companyId"` | ||
111 | + CustomerName string `json:"customerName"` | ||
112 | + DividendsOrderNumber string `json:"dividendsOrderNumber"` | ||
113 | + OrgIds []int `json:"orgIds"` | ||
114 | + PageNumber int `json:"pageNumber"` | ||
115 | + PageSize int `json:"pageSize"` | ||
116 | + UserId int `json:"userId"` | ||
26 | } | 117 | } |
27 | 118 | ||
28 | DataDividendsOrderSearch struct { | 119 | DataDividendsOrderSearch struct { |
120 | + Gride struct { | ||
121 | + Total int `json:"total"` | ||
122 | + List []DividendsOrder `json:"list"` | ||
123 | + } `json:"gride"` | ||
29 | } | 124 | } |
30 | ) | 125 | ) |
31 | 126 | ||
@@ -60,9 +155,10 @@ type ( | @@ -60,9 +155,10 @@ type ( | ||
60 | //返回分红订单详情 | 155 | //返回分红订单详情 |
61 | type ( | 156 | type ( |
62 | ReqDividendsOrderGet struct { | 157 | ReqDividendsOrderGet struct { |
63 | - DividendsOrderId int | 158 | + DividendsOrderId int `json:"dividendsOrderId"` |
64 | } | 159 | } |
65 | 160 | ||
66 | DataDividendsOrderGet struct { | 161 | DataDividendsOrderGet struct { |
162 | + DividendsOrder | ||
67 | } | 163 | } |
68 | ) | 164 | ) |
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 | +) |
-
请 注册 或 登录 后发表评论