正在显示
13 个修改的文件
包含
256 行增加
和
7 行删除
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/beego/beego/v2/core/validation" | ||
6 | + "reflect" | ||
7 | + "strings" | ||
8 | +) | ||
9 | + | ||
10 | +type BatchOperateCooperationContractCommand struct { | ||
11 | + // 公司ID,通过集成REST上下文获取 | ||
12 | + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | ||
13 | + // 组织机构ID | ||
14 | + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | ||
15 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
16 | + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` | ||
17 | + // 用户基础数据id | ||
18 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` | ||
19 | +} | ||
20 | + | ||
21 | +func (batchOperateCooperationContractCommand *BatchOperateCooperationContractCommand) Valid(validation *validation.Validation) { | ||
22 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
23 | +} | ||
24 | + | ||
25 | +func (batchOperateCooperationContractCommand *BatchOperateCooperationContractCommand) ValidateCommand() error { | ||
26 | + valid := validation.Validation{} | ||
27 | + b, err := valid.Valid(batchOperateCooperationContractCommand) | ||
28 | + if err != nil { | ||
29 | + return err | ||
30 | + } | ||
31 | + if !b { | ||
32 | + elem := reflect.TypeOf(batchOperateCooperationContractCommand).Elem() | ||
33 | + for _, validErr := range valid.Errors { | ||
34 | + field, isExist := elem.FieldByName(validErr.Field) | ||
35 | + if isExist { | ||
36 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
37 | + } else { | ||
38 | + return fmt.Errorf(validErr.Message) | ||
39 | + } | ||
40 | + } | ||
41 | + } | ||
42 | + return nil | ||
43 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/beego/beego/v2/core/validation" | ||
6 | + "reflect" | ||
7 | + "strings" | ||
8 | +) | ||
9 | + | ||
10 | +type BatchRemoveCooperationContractCommand struct { | ||
11 | + // 公司ID,通过集成REST上下文获取 | ||
12 | + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | ||
13 | + // 组织机构ID | ||
14 | + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | ||
15 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
16 | + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` | ||
17 | + // 用户基础数据id | ||
18 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` | ||
19 | +} | ||
20 | + | ||
21 | +func (batchRemoveCooperationContractCommand *BatchRemoveCooperationContractCommand) Valid(validation *validation.Validation) { | ||
22 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
23 | +} | ||
24 | + | ||
25 | +func (batchRemoveCooperationContractCommand *BatchRemoveCooperationContractCommand) ValidateCommand() error { | ||
26 | + valid := validation.Validation{} | ||
27 | + b, err := valid.Valid(batchRemoveCooperationContractCommand) | ||
28 | + if err != nil { | ||
29 | + return err | ||
30 | + } | ||
31 | + if !b { | ||
32 | + elem := reflect.TypeOf(batchRemoveCooperationContractCommand).Elem() | ||
33 | + for _, validErr := range valid.Errors { | ||
34 | + field, isExist := elem.FieldByName(validErr.Field) | ||
35 | + if isExist { | ||
36 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
37 | + } else { | ||
38 | + return fmt.Errorf(validErr.Message) | ||
39 | + } | ||
40 | + } | ||
41 | + } | ||
42 | + return nil | ||
43 | +} |
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/beego/beego/v2/core/validation" | ||
6 | + "reflect" | ||
7 | + "strings" | ||
8 | +) | ||
9 | + | ||
10 | +type OperateCooperationContractCommand struct { | ||
11 | + // 公司ID,通过集成REST上下文获取 | ||
12 | + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | ||
13 | + // 组织机构ID | ||
14 | + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | ||
15 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
16 | + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` | ||
17 | + // 用户基础数据id | ||
18 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` | ||
19 | +} | ||
20 | + | ||
21 | +func (operateCooperationContractCommand *OperateCooperationContractCommand) Valid(validation *validation.Validation) { | ||
22 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
23 | +} | ||
24 | + | ||
25 | +func (operateCooperationContractCommand *OperateCooperationContractCommand) ValidateCommand() error { | ||
26 | + valid := validation.Validation{} | ||
27 | + b, err := valid.Valid(operateCooperationContractCommand) | ||
28 | + if err != nil { | ||
29 | + return err | ||
30 | + } | ||
31 | + if !b { | ||
32 | + elem := reflect.TypeOf(operateCooperationContractCommand).Elem() | ||
33 | + for _, validErr := range valid.Errors { | ||
34 | + field, isExist := elem.FieldByName(validErr.Field) | ||
35 | + if isExist { | ||
36 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
37 | + } else { | ||
38 | + return fmt.Errorf(validErr.Message) | ||
39 | + } | ||
40 | + } | ||
41 | + } | ||
42 | + return nil | ||
43 | +} |
@@ -427,6 +427,69 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC | @@ -427,6 +427,69 @@ func (cooperationContractService *CooperationContractService) RemoveCooperationC | ||
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
430 | +// BatchRemoveCooperationContract TODO 批量移除共创合约 | ||
431 | +func (cooperationContractService *CooperationContractService) BatchRemoveCooperationContract(batchRemoveCooperationContractCommand *command.BatchRemoveCooperationContractCommand) (interface{}, error) { | ||
432 | + if err := batchRemoveCooperationContractCommand.ValidateCommand(); err != nil { | ||
433 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
434 | + } | ||
435 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
436 | + if err != nil { | ||
437 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
438 | + } | ||
439 | + if err := transactionContext.StartTransaction(); err != nil { | ||
440 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
441 | + } | ||
442 | + defer func() { | ||
443 | + _ = transactionContext.RollbackTransaction() | ||
444 | + }() | ||
445 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
446 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
447 | + } | ||
448 | + return nil, nil | ||
449 | +} | ||
450 | + | ||
451 | +// OperateRemoveCooperationContract TODO 暂停或恢复共创合约 | ||
452 | +func (cooperationContractService *CooperationContractService) OperateCooperationContract(operateCooperationContractCommand *command.OperateCooperationContractCommand) (interface{}, error) { | ||
453 | + if err := operateCooperationContractCommand.ValidateCommand(); err != nil { | ||
454 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
455 | + } | ||
456 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
457 | + if err != nil { | ||
458 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
459 | + } | ||
460 | + if err := transactionContext.StartTransaction(); err != nil { | ||
461 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
462 | + } | ||
463 | + defer func() { | ||
464 | + _ = transactionContext.RollbackTransaction() | ||
465 | + }() | ||
466 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
467 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
468 | + } | ||
469 | + return nil, nil | ||
470 | +} | ||
471 | + | ||
472 | +// BatchOperateCooperationContract TODO 批量暂停或恢复共创合约 | ||
473 | +func (cooperationContractService *CooperationContractService) BatchOperateCooperationContract(batchOperateCooperationContractCommand *command.BatchOperateCooperationContractCommand) (interface{}, error) { | ||
474 | + if err := batchOperateCooperationContractCommand.ValidateCommand(); err != nil { | ||
475 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
476 | + } | ||
477 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
478 | + if err != nil { | ||
479 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
480 | + } | ||
481 | + if err := transactionContext.StartTransaction(); err != nil { | ||
482 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
483 | + } | ||
484 | + defer func() { | ||
485 | + _ = transactionContext.RollbackTransaction() | ||
486 | + }() | ||
487 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
488 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
489 | + } | ||
490 | + return nil, nil | ||
491 | +} | ||
492 | + | ||
430 | // SearchCooperationContract 查询共创合约 | 493 | // SearchCooperationContract 查询共创合约 |
431 | func (cooperationContractService *CooperationContractService) SearchCooperationContract(searchCooperationContractQuery *query.SearchCooperationContractQuery) (interface{}, error) { | 494 | func (cooperationContractService *CooperationContractService) SearchCooperationContract(searchCooperationContractQuery *query.SearchCooperationContractQuery) (interface{}, error) { |
432 | if err := searchCooperationContractQuery.ValidateQuery(); err != nil { | 495 | if err := searchCooperationContractQuery.ValidateQuery(); err != nil { |
@@ -20,6 +20,8 @@ type DividendsIncentivesRule struct { | @@ -20,6 +20,8 @@ type DividendsIncentivesRule struct { | ||
20 | DividendsIncentivesStageEnd time.Time `json:"dividendsIncentivesStageEnd"` | 20 | DividendsIncentivesStageEnd time.Time `json:"dividendsIncentivesStageEnd"` |
21 | // 分红规则激励阶段开始 | 21 | // 分红规则激励阶段开始 |
22 | DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"` | 22 | DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"` |
23 | + // 分红激励规则说明 | ||
24 | + Remarks string `json:"remarks"` | ||
23 | // 数据所属组织机构 | 25 | // 数据所属组织机构 |
24 | Org *Org `json:"org"` | 26 | Org *Org `json:"org"` |
25 | // 公司 | 27 | // 公司 |
@@ -22,6 +22,8 @@ type MoneyIncentivesRule struct { | @@ -22,6 +22,8 @@ type MoneyIncentivesRule struct { | ||
22 | ReferrerPercentage float64 `json:"referrerPercentage"` | 22 | ReferrerPercentage float64 `json:"referrerPercentage"` |
23 | // 业务员抽成比例 | 23 | // 业务员抽成比例 |
24 | SalesmanPercentage float64 `json:"salesmanPercentage"` | 24 | SalesmanPercentage float64 `json:"salesmanPercentage"` |
25 | + // 分红激励规则说明 | ||
26 | + Remarks string `json:"remarks"` | ||
25 | // 数据所属组织机构 | 27 | // 数据所属组织机构 |
26 | Org *Org `json:"org"` | 28 | Org *Org `json:"org"` |
27 | // 公司 | 29 | // 公司 |
@@ -23,6 +23,8 @@ type DividendsIncentivesRule struct { | @@ -23,6 +23,8 @@ type DividendsIncentivesRule struct { | ||
23 | DividendsIncentivesStageEnd time.Time `comment:"分红规则激励阶段结束"` | 23 | DividendsIncentivesStageEnd time.Time `comment:"分红规则激励阶段结束"` |
24 | // 分红规则激励阶段开始 | 24 | // 分红规则激励阶段开始 |
25 | DividendsIncentivesStageStart time.Time `comment:"分红规则激励阶段开始"` | 25 | DividendsIncentivesStageStart time.Time `comment:"分红规则激励阶段开始"` |
26 | + // 分红激励规则说明 | ||
27 | + Remarks string `comment:"分红激励规则说明"` | ||
26 | // 数据所属组织机构 | 28 | // 数据所属组织机构 |
27 | Org *domain.Org `comment:"数据所属组织机构"` | 29 | Org *domain.Org `comment:"数据所属组织机构"` |
28 | // 公司 | 30 | // 公司 |
@@ -25,6 +25,8 @@ type MoneyIncentivesRule struct { | @@ -25,6 +25,8 @@ type MoneyIncentivesRule struct { | ||
25 | ReferrerPercentage float64 `comment:"推荐人抽成比例"` | 25 | ReferrerPercentage float64 `comment:"推荐人抽成比例"` |
26 | // 业务员抽成比例 | 26 | // 业务员抽成比例 |
27 | SalesmanPercentage float64 `comment:"业务员抽成比例"` | 27 | SalesmanPercentage float64 `comment:"业务员抽成比例"` |
28 | + // 分红激励规则说明 | ||
29 | + Remarks string `comment:"分红激励规则说明"` | ||
28 | // 数据所属组织机构 | 30 | // 数据所属组织机构 |
29 | Org *domain.Org `comment:"数据所属组织机构"` | 31 | Org *domain.Org `comment:"数据所属组织机构"` |
30 | // 公司 | 32 | // 公司 |
@@ -15,6 +15,7 @@ func TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentiv | @@ -15,6 +15,7 @@ func TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentiv | ||
15 | DividendsIncentivesStage: dividendsIncentivesRuleModel.DividendsIncentivesStage, | 15 | DividendsIncentivesStage: dividendsIncentivesRuleModel.DividendsIncentivesStage, |
16 | DividendsIncentivesStageEnd: dividendsIncentivesRuleModel.DividendsIncentivesStageEnd, | 16 | DividendsIncentivesStageEnd: dividendsIncentivesRuleModel.DividendsIncentivesStageEnd, |
17 | DividendsIncentivesStageStart: dividendsIncentivesRuleModel.DividendsIncentivesStageStart, | 17 | DividendsIncentivesStageStart: dividendsIncentivesRuleModel.DividendsIncentivesStageStart, |
18 | + Remarks: dividendsIncentivesRuleModel.Remarks, | ||
18 | Org: dividendsIncentivesRuleModel.Org, | 19 | Org: dividendsIncentivesRuleModel.Org, |
19 | Company: dividendsIncentivesRuleModel.Company, | 20 | Company: dividendsIncentivesRuleModel.Company, |
20 | UpdatedAt: dividendsIncentivesRuleModel.UpdatedAt, | 21 | UpdatedAt: dividendsIncentivesRuleModel.UpdatedAt, |
@@ -16,6 +16,7 @@ func TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleMo | @@ -16,6 +16,7 @@ func TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleMo | ||
16 | MoneyIncentivesTime: moneyIncentivesRuleModel.MoneyIncentivesTime, | 16 | MoneyIncentivesTime: moneyIncentivesRuleModel.MoneyIncentivesTime, |
17 | ReferrerPercentage: moneyIncentivesRuleModel.ReferrerPercentage, | 17 | ReferrerPercentage: moneyIncentivesRuleModel.ReferrerPercentage, |
18 | SalesmanPercentage: moneyIncentivesRuleModel.SalesmanPercentage, | 18 | SalesmanPercentage: moneyIncentivesRuleModel.SalesmanPercentage, |
19 | + Remarks: moneyIncentivesRuleModel.Remarks, | ||
19 | Org: moneyIncentivesRuleModel.Org, | 20 | Org: moneyIncentivesRuleModel.Org, |
20 | Company: moneyIncentivesRuleModel.Company, | 21 | Company: moneyIncentivesRuleModel.Company, |
21 | UpdatedAt: moneyIncentivesRuleModel.UpdatedAt, | 22 | UpdatedAt: moneyIncentivesRuleModel.UpdatedAt, |
@@ -34,6 +34,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -34,6 +34,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
34 | "dividends_incentives_stage", | 34 | "dividends_incentives_stage", |
35 | "dividends_incentives_stage_end", | 35 | "dividends_incentives_stage_end", |
36 | "dividends_incentives_stage_start", | 36 | "dividends_incentives_stage_start", |
37 | + "remarks", | ||
37 | "org", | 38 | "org", |
38 | "company", | 39 | "company", |
39 | "updated_at", | 40 | "updated_at", |
@@ -63,6 +64,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -63,6 +64,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
63 | ÷ndsIncentivesRule.DividendsIncentivesStage, | 64 | ÷ndsIncentivesRule.DividendsIncentivesStage, |
64 | ÷ndsIncentivesRule.DividendsIncentivesStageEnd, | 65 | ÷ndsIncentivesRule.DividendsIncentivesStageEnd, |
65 | ÷ndsIncentivesRule.DividendsIncentivesStageStart, | 66 | ÷ndsIncentivesRule.DividendsIncentivesStageStart, |
67 | + ÷ndsIncentivesRule.Remarks, | ||
66 | ÷ndsIncentivesRule.Org, | 68 | ÷ndsIncentivesRule.Org, |
67 | ÷ndsIncentivesRule.Company, | 69 | ÷ndsIncentivesRule.Company, |
68 | ÷ndsIncentivesRule.UpdatedAt, | 70 | ÷ndsIncentivesRule.UpdatedAt, |
@@ -78,6 +80,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -78,6 +80,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
78 | dividendsIncentivesRule.DividendsIncentivesStage, | 80 | dividendsIncentivesRule.DividendsIncentivesStage, |
79 | dividendsIncentivesRule.DividendsIncentivesStageEnd, | 81 | dividendsIncentivesRule.DividendsIncentivesStageEnd, |
80 | dividendsIncentivesRule.DividendsIncentivesStageStart, | 82 | dividendsIncentivesRule.DividendsIncentivesStageStart, |
83 | + dividendsIncentivesRule.Remarks, | ||
81 | dividendsIncentivesRule.Org, | 84 | dividendsIncentivesRule.Org, |
82 | dividendsIncentivesRule.Company, | 85 | dividendsIncentivesRule.Company, |
83 | dividendsIncentivesRule.UpdatedAt, | 86 | dividendsIncentivesRule.UpdatedAt, |
@@ -97,6 +100,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -97,6 +100,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
97 | ÷ndsIncentivesRule.DividendsIncentivesStage, | 100 | ÷ndsIncentivesRule.DividendsIncentivesStage, |
98 | ÷ndsIncentivesRule.DividendsIncentivesStageEnd, | 101 | ÷ndsIncentivesRule.DividendsIncentivesStageEnd, |
99 | ÷ndsIncentivesRule.DividendsIncentivesStageStart, | 102 | ÷ndsIncentivesRule.DividendsIncentivesStageStart, |
103 | + ÷ndsIncentivesRule.Remarks, | ||
100 | ÷ndsIncentivesRule.Org, | 104 | ÷ndsIncentivesRule.Org, |
101 | ÷ndsIncentivesRule.Company, | 105 | ÷ndsIncentivesRule.Company, |
102 | ÷ndsIncentivesRule.UpdatedAt, | 106 | ÷ndsIncentivesRule.UpdatedAt, |
@@ -112,6 +116,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -112,6 +116,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
112 | dividendsIncentivesRule.DividendsIncentivesStage, | 116 | dividendsIncentivesRule.DividendsIncentivesStage, |
113 | dividendsIncentivesRule.DividendsIncentivesStageEnd, | 117 | dividendsIncentivesRule.DividendsIncentivesStageEnd, |
114 | dividendsIncentivesRule.DividendsIncentivesStageStart, | 118 | dividendsIncentivesRule.DividendsIncentivesStageStart, |
119 | + dividendsIncentivesRule.Remarks, | ||
115 | dividendsIncentivesRule.Org, | 120 | dividendsIncentivesRule.Org, |
116 | dividendsIncentivesRule.Company, | 121 | dividendsIncentivesRule.Company, |
117 | dividendsIncentivesRule.UpdatedAt, | 122 | dividendsIncentivesRule.UpdatedAt, |
@@ -67,6 +67,45 @@ func (controller *CooperationContractController) RemoveCooperationContract() { | @@ -67,6 +67,45 @@ func (controller *CooperationContractController) RemoveCooperationContract() { | ||
67 | controller.Response(data, err) | 67 | controller.Response(data, err) |
68 | } | 68 | } |
69 | 69 | ||
70 | +func (controller *CooperationContractController) BatchRemoveCooperationContract() { | ||
71 | + cooperationContractService := service.NewCooperationContractService(nil) | ||
72 | + batchRemoveCooperationContractCommand := &command.BatchRemoveCooperationContractCommand{} | ||
73 | + _ = controller.Unmarshal(batchRemoveCooperationContractCommand) | ||
74 | + header := controller.GetRequestHeader(controller.Ctx) | ||
75 | + batchRemoveCooperationContractCommand.CompanyId = header.CompanyId | ||
76 | + batchRemoveCooperationContractCommand.OrgId = header.OrgId | ||
77 | + batchRemoveCooperationContractCommand.UserId = header.UserId | ||
78 | + batchRemoveCooperationContractCommand.UserBaseId = header.UserBaseId | ||
79 | + data, err := cooperationContractService.BatchRemoveCooperationContract(batchRemoveCooperationContractCommand) | ||
80 | + controller.Response(data, err) | ||
81 | +} | ||
82 | + | ||
83 | +func (controller *CooperationContractController) OperateCooperationContract() { | ||
84 | + cooperationContractService := service.NewCooperationContractService(nil) | ||
85 | + opreateCooperationContractCommand := &command.OperateCooperationContractCommand{} | ||
86 | + _ = controller.Unmarshal(opreateCooperationContractCommand) | ||
87 | + header := controller.GetRequestHeader(controller.Ctx) | ||
88 | + opreateCooperationContractCommand.CompanyId = header.CompanyId | ||
89 | + opreateCooperationContractCommand.OrgId = header.OrgId | ||
90 | + opreateCooperationContractCommand.UserId = header.UserId | ||
91 | + opreateCooperationContractCommand.UserBaseId = header.UserBaseId | ||
92 | + data, err := cooperationContractService.OperateCooperationContract(opreateCooperationContractCommand) | ||
93 | + controller.Response(data, err) | ||
94 | +} | ||
95 | + | ||
96 | +func (controller *CooperationContractController) BatchOperateCooperationContract() { | ||
97 | + cooperationContractService := service.NewCooperationContractService(nil) | ||
98 | + batchOperateCooperationContractCommand := &command.BatchOperateCooperationContractCommand{} | ||
99 | + _ = controller.Unmarshal(batchOperateCooperationContractCommand) | ||
100 | + header := controller.GetRequestHeader(controller.Ctx) | ||
101 | + batchOperateCooperationContractCommand.CompanyId = header.CompanyId | ||
102 | + batchOperateCooperationContractCommand.OrgId = header.OrgId | ||
103 | + batchOperateCooperationContractCommand.UserId = header.UserId | ||
104 | + batchOperateCooperationContractCommand.UserBaseId = header.UserBaseId | ||
105 | + data, err := cooperationContractService.BatchOperateCooperationContract(batchOperateCooperationContractCommand) | ||
106 | + controller.Response(data, err) | ||
107 | +} | ||
108 | + | ||
70 | func (controller *CooperationContractController) SearchCooperationContract() { | 109 | func (controller *CooperationContractController) SearchCooperationContract() { |
71 | cooperationContractService := service.NewCooperationContractService(nil) | 110 | cooperationContractService := service.NewCooperationContractService(nil) |
72 | searchCooperationContractQuery := &query.SearchCooperationContractQuery{} | 111 | searchCooperationContractQuery := &query.SearchCooperationContractQuery{} |
@@ -6,11 +6,14 @@ import ( | @@ -6,11 +6,14 @@ import ( | ||
6 | ) | 6 | ) |
7 | 7 | ||
8 | func init() { | 8 | func init() { |
9 | - web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Post:CreateCooperationContract") | ||
10 | - web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Put:UpdateCooperationContract") | ||
11 | - web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Get:GetCooperationContract") | ||
12 | - web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Delete:RemoveCooperationContract") | ||
13 | - web.Router("/cooperation-contracts/search", &controllers.CooperationContractController{}, "Post:SearchCooperationContract") | ||
14 | - web.Router("/cooperation-contracts/search-by-undertaker", &controllers.CooperationContractController{}, "Post:SearchCooperationContractByUndertaker") | ||
15 | - web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Get:ListCooperationContract") | 9 | + web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Post:CreateCooperationContract") // 新增共创合约 |
10 | + web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Put:UpdateCooperationContract") // 编辑共创合约 | ||
11 | + web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Get:GetCooperationContract") // 返回共创合约详情 | ||
12 | + web.Router("/cooperation-contracts/:cooperationContractId", &controllers.CooperationContractController{}, "Delete:RemoveCooperationContract") // 移除共创合约 | ||
13 | + web.Router("/cooperation-contracts/batch-remove", &controllers.CooperationContractController{}, "Post:BatchRemoveCooperationContract") // 批量移除共创合约 | ||
14 | + web.Router("/cooperation-contracts/operate", &controllers.CooperationContractController{}, "Post:OperateCooperationContract") // 暂停或恢复共创合约 | ||
15 | + web.Router("/cooperation-contracts/batch-operate", &controllers.CooperationContractController{}, "Post:BatchOperateCooperationContract") // 批量暂停或恢复共创合约 | ||
16 | + web.Router("/cooperation-contracts/search", &controllers.CooperationContractController{}, "Post:SearchCooperationContract") // 查询共创合约 | ||
17 | + web.Router("/cooperation-contracts/search-by-undertaker", &controllers.CooperationContractController{}, "Post:SearchCooperationContractByUndertaker") // 通过承接人查询共创合约 | ||
18 | + web.Router("/cooperation-contracts/", &controllers.CooperationContractController{}, "Get:ListCooperationContract") // 返回共创合约列表 | ||
16 | } | 19 | } |
-
请 注册 或 登录 后发表评论