Merge branch 'dev-chenzhiying' into dev
正在显示
18 个修改的文件
包含
296 行增加
和
133 行删除
1 | +package command | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/beego/beego/v2/core/validation" | ||
6 | + "reflect" | ||
7 | + "strings" | ||
8 | +) | ||
9 | + | ||
10 | +// BatchCancelDividendsEstimateCommand 批量取消分红预算 | ||
11 | +type BatchCancelDividendsEstimateCommand struct { | ||
12 | + // 承接人分红预算记录ID | ||
13 | + DividendsEstimateIds []string `cname:"承接人分红预算记录ID列表" json:"dividendsEstimateIds,omitempty"` | ||
14 | + // 公司ID,通过集成REST上下文获取 | ||
15 | + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` | ||
16 | + // 组织机构ID | ||
17 | + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | ||
18 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
19 | + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` | ||
20 | + // 用户基础数据id | ||
21 | + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` | ||
22 | +} | ||
23 | + | ||
24 | +func (batchCancelDividendsEstimateCommand *BatchCancelDividendsEstimateCommand) Valid(validation *validation.Validation) { | ||
25 | + //validation.SetError("CustomValid", "未实现的自定义认证") | ||
26 | +} | ||
27 | + | ||
28 | +func (batchCancelDividendsEstimateCommand *BatchCancelDividendsEstimateCommand) ValidateCommand() error { | ||
29 | + valid := validation.Validation{} | ||
30 | + b, err := valid.Valid(batchCancelDividendsEstimateCommand) | ||
31 | + if err != nil { | ||
32 | + return err | ||
33 | + } | ||
34 | + if !b { | ||
35 | + elem := reflect.TypeOf(batchCancelDividendsEstimateCommand).Elem() | ||
36 | + for _, validErr := range valid.Errors { | ||
37 | + field, isExist := elem.FieldByName(validErr.Field) | ||
38 | + if isExist { | ||
39 | + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1)) | ||
40 | + } else { | ||
41 | + return fmt.Errorf(validErr.Message) | ||
42 | + } | ||
43 | + } | ||
44 | + } | ||
45 | + return nil | ||
46 | +} |
@@ -17,7 +17,7 @@ import ( | @@ -17,7 +17,7 @@ import ( | ||
17 | type DividendsEstimateService struct { | 17 | type DividendsEstimateService struct { |
18 | } | 18 | } |
19 | 19 | ||
20 | -// CancelDividendsEstimate 取消分红预算 | 20 | +// CancelDividendsEstimate 取消分红预算单 |
21 | func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimate(cancelDividendsEstimateCommand *command.CancelDividendsEstimateCommand) (interface{}, error) { | 21 | func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimate(cancelDividendsEstimateCommand *command.CancelDividendsEstimateCommand) (interface{}, error) { |
22 | if err := cancelDividendsEstimateCommand.ValidateCommand(); err != nil { | 22 | if err := cancelDividendsEstimateCommand.ValidateCommand(); err != nil { |
23 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 23 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
@@ -38,7 +38,28 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat | @@ -38,7 +38,28 @@ func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimat | ||
38 | return nil, nil | 38 | return nil, nil |
39 | } | 39 | } |
40 | 40 | ||
41 | -// CreateDividendsEstimate 创建分红预算服务 | 41 | +// BatchCancelDividendsEstimate 批量取消分红预算单 |
42 | +func (dividendsEstimateService *DividendsEstimateService) BatchCancelDividendsEstimate(batchCancelEstimateCommand *command.BatchCancelDividendsEstimateCommand) (interface{}, error) { | ||
43 | + if err := batchCancelEstimateCommand.ValidateCommand(); err != nil { | ||
44 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
45 | + } | ||
46 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
47 | + if err != nil { | ||
48 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
49 | + } | ||
50 | + if err := transactionContext.StartTransaction(); err != nil { | ||
51 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
52 | + } | ||
53 | + defer func() { | ||
54 | + _ = transactionContext.RollbackTransaction() | ||
55 | + }() | ||
56 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
57 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
58 | + } | ||
59 | + return nil, nil | ||
60 | +} | ||
61 | + | ||
62 | +// CreateDividendsEstimate 创建分红预算单 (预留) | ||
42 | func (dividendsEstimateService *DividendsEstimateService) CreateDividendsEstimate(createDividendsEstimateCommand *command.CreateDividendsEstimateCommand) (interface{}, error) { | 63 | func (dividendsEstimateService *DividendsEstimateService) CreateDividendsEstimate(createDividendsEstimateCommand *command.CreateDividendsEstimateCommand) (interface{}, error) { |
43 | if err := createDividendsEstimateCommand.ValidateCommand(); err != nil { | 64 | if err := createDividendsEstimateCommand.ValidateCommand(); err != nil { |
44 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 65 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
@@ -140,9 +161,9 @@ func (dividendsEstimateService *DividendsEstimateService) CreateDividendsEstimat | @@ -140,9 +161,9 @@ func (dividendsEstimateService *DividendsEstimateService) CreateDividendsEstimat | ||
140 | } | 161 | } |
141 | } | 162 | } |
142 | 163 | ||
143 | -// EstimateDividendsIncentives 确定预算分红激励 | ||
144 | -func (dividendsEstimateService *DividendsEstimateService) EstimateDividendsIncentives(estimateDividendsIncentivesCommand *command.ConfirmDividendsIncentivesEstimateCommand) (interface{}, error) { | ||
145 | - if err := estimateDividendsIncentivesCommand.ValidateCommand(); err != nil { | 164 | +// ConfirmDividendsIncentivesEstimate 确定业绩激励分红预算 |
165 | +func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncentivesEstimate(confirmDividendsIncentivesEstimateCommand *command.ConfirmDividendsIncentivesEstimateCommand) (interface{}, error) { | ||
166 | + if err := confirmDividendsIncentivesEstimateCommand.ValidateCommand(); err != nil { | ||
146 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 167 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
147 | } | 168 | } |
148 | transactionContext, err := factory.CreateTransactionContext(nil) | 169 | transactionContext, err := factory.CreateTransactionContext(nil) |
@@ -161,9 +182,9 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateDividendsIncen | @@ -161,9 +182,9 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateDividendsIncen | ||
161 | return nil, nil | 182 | return nil, nil |
162 | } | 183 | } |
163 | 184 | ||
164 | -// EstimateMoneyIncentives 确定预算金额激励分红 | ||
165 | -func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentives(estimateMoneyIncentivesCommand *command.ConfirmMoneyIncentivesEstimateCommand) (interface{}, error) { | ||
166 | - if err := estimateMoneyIncentivesCommand.ValidateCommand(); err != nil { | 185 | +// ConfirmMoneyIncentivesEstimate 确定金额激励分红预算 |
186 | +func (dividendsEstimateService *DividendsEstimateService) ConfirmMoneyIncentivesEstimate(confirmMoneyIncentivesEstimateCommand *command.ConfirmMoneyIncentivesEstimateCommand) (interface{}, error) { | ||
187 | + if err := confirmMoneyIncentivesEstimateCommand.ValidateCommand(); err != nil { | ||
167 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 188 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
168 | } | 189 | } |
169 | transactionContext, err := factory.CreateTransactionContext(nil) | 190 | transactionContext, err := factory.CreateTransactionContext(nil) |
@@ -182,7 +203,7 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentive | @@ -182,7 +203,7 @@ func (dividendsEstimateService *DividendsEstimateService) EstimateMoneyIncentive | ||
182 | return nil, nil | 203 | return nil, nil |
183 | } | 204 | } |
184 | 205 | ||
185 | -// GetDividendsEstimate 返回分红预算服务 | 206 | +// GetDividendsEstimate 返回分红预算单详情 |
186 | func (dividendsEstimateService *DividendsEstimateService) GetDividendsEstimate(getDividendsEstimateQuery *query.GetDividendsEstimateQuery) (interface{}, error) { | 207 | func (dividendsEstimateService *DividendsEstimateService) GetDividendsEstimate(getDividendsEstimateQuery *query.GetDividendsEstimateQuery) (interface{}, error) { |
187 | if err := getDividendsEstimateQuery.ValidateQuery(); err != nil { | 208 | if err := getDividendsEstimateQuery.ValidateQuery(); err != nil { |
188 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 209 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
@@ -219,7 +240,7 @@ func (dividendsEstimateService *DividendsEstimateService) GetDividendsEstimate(g | @@ -219,7 +240,7 @@ func (dividendsEstimateService *DividendsEstimateService) GetDividendsEstimate(g | ||
219 | } | 240 | } |
220 | } | 241 | } |
221 | 242 | ||
222 | -// ListDividendsEstimate 返回分红预算服务列表 | 243 | +// ListDividendsEstimate 返回分红预算单列表 |
223 | func (dividendsEstimateService *DividendsEstimateService) ListDividendsEstimate(listDividendsEstimateQuery *query.ListDividendsEstimateQuery) (interface{}, error) { | 244 | func (dividendsEstimateService *DividendsEstimateService) ListDividendsEstimate(listDividendsEstimateQuery *query.ListDividendsEstimateQuery) (interface{}, error) { |
224 | if err := listDividendsEstimateQuery.ValidateQuery(); err != nil { | 245 | if err := listDividendsEstimateQuery.ValidateQuery(); err != nil { |
225 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 246 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
@@ -257,9 +278,9 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsEstimate( | @@ -257,9 +278,9 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsEstimate( | ||
257 | } | 278 | } |
258 | } | 279 | } |
259 | 280 | ||
260 | -// ListDividendsIncentives 返回业绩激励分红 | ||
261 | -func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentives(listDividendsIncentivesQuery *query.ListDividendsIncentivesEstimateQuery) (interface{}, error) { | ||
262 | - if err := listDividendsIncentivesQuery.ValidateQuery(); err != nil { | 281 | +// ListDividendsIncentivesEstimate 返回业绩激励分红预算列表 |
282 | +func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentivesEstimate(listDividendsIncentivesEstimateQuery *query.ListDividendsIncentivesEstimateQuery) (interface{}, error) { | ||
283 | + if err := listDividendsIncentivesEstimateQuery.ValidateQuery(); err != nil { | ||
263 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 284 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
264 | } | 285 | } |
265 | transactionContext, err := factory.CreateTransactionContext(nil) | 286 | transactionContext, err := factory.CreateTransactionContext(nil) |
@@ -278,9 +299,9 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentive | @@ -278,9 +299,9 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentive | ||
278 | return nil, nil | 299 | return nil, nil |
279 | } | 300 | } |
280 | 301 | ||
281 | -// ListMoneyIncentives 返回金额激励分红 | ||
282 | -func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentives(listMoneyIncentivesQuery *query.ListMoneyIncentivesEstimateQuery) (interface{}, error) { | ||
283 | - if err := listMoneyIncentivesQuery.ValidateQuery(); err != nil { | 302 | +// ListMoneyIncentivesEstimate 返回金额激励分红预算列表 |
303 | +func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentivesEstimate(listMoneyIncentivesEstimateQuery *query.ListMoneyIncentivesEstimateQuery) (interface{}, error) { | ||
304 | + if err := listMoneyIncentivesEstimateQuery.ValidateQuery(); err != nil { | ||
284 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 305 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
285 | } | 306 | } |
286 | transactionContext, err := factory.CreateTransactionContext(nil) | 307 | transactionContext, err := factory.CreateTransactionContext(nil) |
@@ -299,7 +320,7 @@ func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentives(li | @@ -299,7 +320,7 @@ func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentives(li | ||
299 | return nil, nil | 320 | return nil, nil |
300 | } | 321 | } |
301 | 322 | ||
302 | -// RemoveDividendsEstimate 移除分红预算服务 | 323 | +// RemoveDividendsEstimate 移除分红预算单(预留) |
303 | func (dividendsEstimateService *DividendsEstimateService) RemoveDividendsEstimate(removeDividendsEstimateCommand *command.RemoveDividendsEstimateCommand) (interface{}, error) { | 324 | func (dividendsEstimateService *DividendsEstimateService) RemoveDividendsEstimate(removeDividendsEstimateCommand *command.RemoveDividendsEstimateCommand) (interface{}, error) { |
304 | if err := removeDividendsEstimateCommand.ValidateCommand(); err != nil { | 325 | if err := removeDividendsEstimateCommand.ValidateCommand(); err != nil { |
305 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 326 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
@@ -360,9 +381,9 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat | @@ -360,9 +381,9 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat | ||
360 | return nil, nil | 381 | return nil, nil |
361 | } | 382 | } |
362 | 383 | ||
363 | -// SearchDividendsIncentives 查询业绩分红 | ||
364 | -func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncentives(searchDividendsIncentivesQuery *query.SearchDividendsIncentivesEstimateQuery) (interface{}, error) { | ||
365 | - if err := searchDividendsIncentivesQuery.ValidateQuery(); err != nil { | 384 | +// SearchDividendsIncentivesEstimate 查询业绩激励分红预算 |
385 | +func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncentivesEstimate(searchDividendsIncentivesEstimateQuery *query.SearchDividendsIncentivesEstimateQuery) (interface{}, error) { | ||
386 | + if err := searchDividendsIncentivesEstimateQuery.ValidateQuery(); err != nil { | ||
366 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 387 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
367 | } | 388 | } |
368 | transactionContext, err := factory.CreateTransactionContext(nil) | 389 | transactionContext, err := factory.CreateTransactionContext(nil) |
@@ -381,9 +402,9 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti | @@ -381,9 +402,9 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti | ||
381 | return nil, nil | 402 | return nil, nil |
382 | } | 403 | } |
383 | 404 | ||
384 | -// SearchMoneyIncentives 查询金额激励分红 | ||
385 | -func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentives(searchMoneyIncentivesQuery *query.SearchMoneyIncentivesEstimateQuery) (interface{}, error) { | ||
386 | - if err := searchMoneyIncentivesQuery.ValidateQuery(); err != nil { | 405 | +// SearchMoneyIncentivesEstimate 查询金额激励分红预算 |
406 | +func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesEstimate(searchMoneyIncentivesEstimateQuery *query.SearchMoneyIncentivesEstimateQuery) (interface{}, error) { | ||
407 | + if err := searchMoneyIncentivesEstimateQuery.ValidateQuery(); err != nil { | ||
387 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 408 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
388 | } | 409 | } |
389 | transactionContext, err := factory.CreateTransactionContext(nil) | 410 | transactionContext, err := factory.CreateTransactionContext(nil) |
@@ -402,7 +423,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentives( | @@ -402,7 +423,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentives( | ||
402 | return nil, nil | 423 | return nil, nil |
403 | } | 424 | } |
404 | 425 | ||
405 | -// UpdateDividendsEstimate 更新分红预算服务 | 426 | +// UpdateDividendsEstimate 更新分红预算单(预留) |
406 | func (dividendsEstimateService *DividendsEstimateService) UpdateDividendsEstimate(updateDividendsEstimateCommand *command.UpdateDividendsEstimateCommand) (interface{}, error) { | 427 | func (dividendsEstimateService *DividendsEstimateService) UpdateDividendsEstimate(updateDividendsEstimateCommand *command.UpdateDividendsEstimateCommand) (interface{}, error) { |
407 | if err := updateDividendsEstimateCommand.ValidateCommand(); err != nil { | 428 | if err := updateDividendsEstimateCommand.ValidateCommand(); err != nil { |
408 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 429 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
1 | package factory | 1 | package factory |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | ||
4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" | 5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain/service" |
5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/domain_service" | 6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/domain_service" |
6 | ) | 7 | ) |
@@ -20,3 +21,11 @@ func CreateDepartmentService(options map[string]interface{}) (service.Department | @@ -20,3 +21,11 @@ func CreateDepartmentService(options map[string]interface{}) (service.Department | ||
20 | func CreateOrganizationService(options map[string]interface{}) (service.OrgService, error) { | 21 | func CreateOrganizationService(options map[string]interface{}) (service.OrgService, error) { |
21 | return domain_service.NewOrganizationService() | 22 | return domain_service.NewOrganizationService() |
22 | } | 23 | } |
24 | + | ||
25 | +func CreateCancelDividendsEstimateService(options map[string]interface{}) (service.CancelDividendsEstimate, error) { | ||
26 | + var transactionContext *pgTransaction.TransactionContext | ||
27 | + if value, ok := options["transactionContext"]; ok { | ||
28 | + transactionContext = value.(*pgTransaction.TransactionContext) | ||
29 | + } | ||
30 | + return domain_service.NewCancelDividendsEstimateService(transactionContext) | ||
31 | +} |
@@ -2,6 +2,18 @@ package domain | @@ -2,6 +2,18 @@ package domain | ||
2 | 2 | ||
3 | import "time" | 3 | import "time" |
4 | 4 | ||
5 | +const ( | ||
6 | + UNDERTAKER = iota + 1 // 承接人 | ||
7 | + REFERRER // 推荐人 | ||
8 | + SALESMAN // 业务员 | ||
9 | +) | ||
10 | + | ||
11 | +const ( | ||
12 | + ORDER_DIVIDENDS = iota + 1 // 订单分红 | ||
13 | + RETURN_WRITE_OFF // 退货冲销 | ||
14 | + MONEY_INCENTIVES // 金额激励 | ||
15 | +) | ||
16 | + | ||
5 | // DividendsEstimate 分红预算实体 | 17 | // DividendsEstimate 分红预算实体 |
6 | type DividendsEstimate struct { | 18 | type DividendsEstimate struct { |
7 | // 承接人分红预算记录ID | 19 | // 承接人分红预算记录ID |
@@ -22,8 +34,10 @@ type DividendsEstimate struct { | @@ -22,8 +34,10 @@ type DividendsEstimate struct { | ||
22 | OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` | 34 | OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` |
23 | // 共创项目合约编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001 | 35 | // 共创项目合约编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001 |
24 | CooperationContractNumber string `json:"cooperationContractNumber"` | 36 | CooperationContractNumber string `json:"cooperationContractNumber"` |
25 | - // 分红用户 | 37 | + // 分红用户(共创参与) |
26 | DividendsUser *User `json:"dividendsUser"` | 38 | DividendsUser *User `json:"dividendsUser"` |
39 | + // 分红阶段 | ||
40 | + DividendsStage int32 `json:"dividendsStage"` | ||
27 | // 数据所属组织机构 | 41 | // 数据所属组织机构 |
28 | Org *Org `json:"org"` | 42 | Org *Org `json:"org"` |
29 | // 公司 | 43 | // 公司 |
@@ -42,6 +56,7 @@ type DividendsEstimate struct { | @@ -42,6 +56,7 @@ type DividendsEstimate struct { | ||
42 | 56 | ||
43 | type DividendsEstimateRepository interface { | 57 | type DividendsEstimateRepository interface { |
44 | Save(dividendsEstimate *DividendsEstimate) (*DividendsEstimate, error) | 58 | Save(dividendsEstimate *DividendsEstimate) (*DividendsEstimate, error) |
59 | + UpdateMany(dividendsEstimates []*DividendsEstimate) ([]*DividendsEstimate, error) | ||
45 | Remove(dividendsEstimate *DividendsEstimate) (*DividendsEstimate, error) | 60 | Remove(dividendsEstimate *DividendsEstimate) (*DividendsEstimate, error) |
46 | FindOne(queryOptions map[string]interface{}) (*DividendsEstimate, error) | 61 | FindOne(queryOptions map[string]interface{}) (*DividendsEstimate, error) |
47 | Find(queryOptions map[string]interface{}) (int64, []*DividendsEstimate, error) | 62 | Find(queryOptions map[string]interface{}) (int64, []*DividendsEstimate, error) |
@@ -55,9 +70,6 @@ func (dividendsEstimate *DividendsEstimate) Identify() interface{} { | @@ -55,9 +70,6 @@ func (dividendsEstimate *DividendsEstimate) Identify() interface{} { | ||
55 | } | 70 | } |
56 | 71 | ||
57 | func (dividendsEstimate *DividendsEstimate) Update(data map[string]interface{}) error { | 72 | func (dividendsEstimate *DividendsEstimate) Update(data map[string]interface{}) error { |
58 | - if dividendsEstimateId, ok := data["dividendsEstimateId"]; ok { | ||
59 | - dividendsEstimate.DividendsEstimateId = dividendsEstimateId.(int64) | ||
60 | - } | ||
61 | if dividendsAccountStatus, ok := data["dividendsAccountStatus"]; ok { | 73 | if dividendsAccountStatus, ok := data["dividendsAccountStatus"]; ok { |
62 | dividendsEstimate.DividendsAccountStatus = dividendsAccountStatus.(int32) | 74 | dividendsEstimate.DividendsAccountStatus = dividendsAccountStatus.(int32) |
63 | } | 75 | } |
@@ -82,62 +94,5 @@ func (dividendsEstimate *DividendsEstimate) Update(data map[string]interface{}) | @@ -82,62 +94,5 @@ func (dividendsEstimate *DividendsEstimate) Update(data map[string]interface{}) | ||
82 | if cooperationProjectNumber, ok := data["cooperationProjectNumber"]; ok { | 94 | if cooperationProjectNumber, ok := data["cooperationProjectNumber"]; ok { |
83 | dividendsEstimate.CooperationContractNumber = cooperationProjectNumber.(string) | 95 | dividendsEstimate.CooperationContractNumber = cooperationProjectNumber.(string) |
84 | } | 96 | } |
85 | - if userId, ok := data["userId"]; ok { | ||
86 | - dividendsEstimate.DividendsUser.UserId = userId.(int64) | ||
87 | - } | ||
88 | - if userBaseId, ok := data["userBaseId"]; ok { | ||
89 | - dividendsEstimate.DividendsUser.UserBaseId = userBaseId.(int64) | ||
90 | - } | ||
91 | - if orgId, ok := data["orgId"]; ok { | ||
92 | - dividendsEstimate.DividendsUser.Org.OrgId = orgId.(int64) | ||
93 | - } | ||
94 | - if orgName, ok := data["orgName"]; ok { | ||
95 | - dividendsEstimate.DividendsUser.Org.OrgName = orgName.(string) | ||
96 | - } | ||
97 | - if companyId, ok := data["companyId"]; ok { | ||
98 | - dividendsEstimate.DividendsUser.Org.Company.CompanyId = companyId.(int64) | ||
99 | - } | ||
100 | - if companyLogo, ok := data["companyLogo"]; ok { | ||
101 | - dividendsEstimate.DividendsUser.Org.Company.CompanyLogo = companyLogo.(string) | ||
102 | - } | ||
103 | - if companyName, ok := data["companyName"]; ok { | ||
104 | - dividendsEstimate.DividendsUser.Org.Company.CompanyName = companyName.(string) | ||
105 | - } | ||
106 | - if orgs, ok := data["orgs"]; ok { | ||
107 | - dividendsEstimate.DividendsUser.Orgs = orgs.([]*Org) | ||
108 | - } | ||
109 | - if departmentId, ok := data["departmentId"]; ok { | ||
110 | - dividendsEstimate.DividendsUser.Department.DepartmentId = departmentId.(int64) | ||
111 | - } | ||
112 | - if departmentName, ok := data["departmentName"]; ok { | ||
113 | - dividendsEstimate.DividendsUser.Department.DepartmentName = departmentName.(string) | ||
114 | - } | ||
115 | - if departmentNumber, ok := data["departmentNumber"]; ok { | ||
116 | - dividendsEstimate.DividendsUser.Department.DepartmentNumber = departmentNumber.(string) | ||
117 | - } | ||
118 | - if isOrganization, ok := data["isOrganization"]; ok { | ||
119 | - dividendsEstimate.DividendsUser.Department.IsOrganization = isOrganization.(bool) | ||
120 | - } | ||
121 | - if userAvatar, ok := data["userAvatar"]; ok { | ||
122 | - dividendsEstimate.DividendsUser.UserInfo.UserAvatar = userAvatar.(string) | ||
123 | - } | ||
124 | - if userEmail, ok := data["userEmail"]; ok { | ||
125 | - dividendsEstimate.DividendsUser.UserInfo.UserEmail = userEmail.(string) | ||
126 | - } | ||
127 | - if userName, ok := data["userName"]; ok { | ||
128 | - dividendsEstimate.DividendsUser.UserInfo.UserName = userName.(string) | ||
129 | - } | ||
130 | - if userPhone, ok := data["userPhone"]; ok { | ||
131 | - dividendsEstimate.DividendsUser.UserInfo.UserPhone = userPhone.(string) | ||
132 | - } | ||
133 | - if userAccount, ok := data["userAccount"]; ok { | ||
134 | - dividendsEstimate.DividendsUser.UserInfo.UserAccount = userAccount.(string) | ||
135 | - } | ||
136 | - if userType, ok := data["userType"]; ok { | ||
137 | - dividendsEstimate.DividendsUser.UserType = userType.(int32) | ||
138 | - } | ||
139 | - if status, ok := data["status"]; ok { | ||
140 | - dividendsEstimate.DividendsUser.Status = status.(int32) | ||
141 | - } | ||
142 | return nil | 97 | return nil |
143 | } | 98 | } |
@@ -2,6 +2,11 @@ package domain | @@ -2,6 +2,11 @@ package domain | ||
2 | 2 | ||
3 | import "time" | 3 | import "time" |
4 | 4 | ||
5 | +const ( | ||
6 | + TO_BE_DIVIDENDED = iota + 1 // 待分红 | ||
7 | + DIVIDENDED // 已分红 | ||
8 | +) | ||
9 | + | ||
5 | // OrderGood 订单产品领域实体(包括分红订单、分红退货单) | 10 | // OrderGood 订单产品领域实体(包括分红订单、分红退货单) |
6 | type OrderGood struct { | 11 | type OrderGood struct { |
7 | // 订单产品 | 12 | // 订单产品 |
@@ -20,8 +25,10 @@ type OrderGood struct { | @@ -20,8 +25,10 @@ type OrderGood struct { | ||
20 | DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"` | 25 | DividendsReturnedOrderNumber string `json:"dividendsReturnedOrderNumber"` |
21 | // 关联的共创合约编号 | 26 | // 关联的共创合约编号 |
22 | CooperationContractNumber string `json:"cooperationContractNumber"` | 27 | CooperationContractNumber string `json:"cooperationContractNumber"` |
23 | - // 订单产品费用 | 28 | + // 订单产品支出费用 |
24 | OrderGoodExpense float64 `json:"orderGoodExpense"` | 29 | OrderGoodExpense float64 `json:"orderGoodExpense"` |
30 | + // 订单产品分红状态, 1待分红,2已分红 | ||
31 | + OrderGoodDividendsStatus int32 `json:"OrderGoodDividendsStatus"` | ||
25 | // 组织机构ID | 32 | // 组织机构ID |
26 | OrgId int64 `json:"orgId"` | 33 | OrgId int64 `json:"orgId"` |
27 | // 公司ID | 34 | // 公司ID |
@@ -67,8 +74,5 @@ func (orderGood *OrderGood) Update(data map[string]interface{}) error { | @@ -67,8 +74,5 @@ func (orderGood *OrderGood) Update(data map[string]interface{}) error { | ||
67 | if orderGoodExpense, ok := data["orderGoodExpense"]; ok { | 74 | if orderGoodExpense, ok := data["orderGoodExpense"]; ok { |
68 | orderGood.OrderGoodExpense = orderGoodExpense.(float64) | 75 | orderGood.OrderGoodExpense = orderGoodExpense.(float64) |
69 | } | 76 | } |
70 | - if updatedAt, ok := data["updatedAt"]; ok { | ||
71 | - orderGood.UpdatedAt = updatedAt.(time.Time) | ||
72 | - } | ||
73 | return nil | 77 | return nil |
74 | } | 78 | } |
1 | +package domain_service | ||
2 | + | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + coreDomain "github.com/linmadan/egglib-go/core/domain" | ||
6 | + pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | ||
7 | +) | ||
8 | + | ||
9 | +type CancelDividendsEstimateService struct { | ||
10 | + coreDomain.BaseEventPublisher | ||
11 | + transactionContext *pgTransaction.TransactionContext | ||
12 | +} | ||
13 | + | ||
14 | +func (c *CancelDividendsEstimateService) CancelEstimate() { | ||
15 | + panic("implement me") | ||
16 | +} | ||
17 | + | ||
18 | +func NewCancelDividendsEstimateService(transactionContext *pgTransaction.TransactionContext) (*CancelDividendsEstimateService, error) { | ||
19 | + if transactionContext == nil { | ||
20 | + return nil, fmt.Errorf("transactionContext参数不能为nil") | ||
21 | + } else { | ||
22 | + return &CancelDividendsEstimateService{ | ||
23 | + transactionContext: transactionContext, | ||
24 | + }, nil | ||
25 | + } | ||
26 | +} |
@@ -27,6 +27,8 @@ type DividendsEstimate struct { | @@ -27,6 +27,8 @@ type DividendsEstimate struct { | ||
27 | CooperationContractNumber string `comment:"共创项目合约编号"` | 27 | CooperationContractNumber string `comment:"共创项目合约编号"` |
28 | // 分红用户 | 28 | // 分红用户 |
29 | DividendsUser *domain.User `comment:"分红用户"` | 29 | DividendsUser *domain.User `comment:"分红用户"` |
30 | + // 分红阶段 | ||
31 | + DividendsStage int32 `comment:"分红阶段"` | ||
30 | // 数据所属组织机构 | 32 | // 数据所属组织机构 |
31 | Org *domain.Org `comment:"数据所属组织机构"` | 33 | Org *domain.Org `comment:"数据所属组织机构"` |
32 | // 公司 | 34 | // 公司 |
@@ -24,8 +24,10 @@ type OrderGood struct { | @@ -24,8 +24,10 @@ type OrderGood struct { | ||
24 | OrgId int64 `comment:"组织机构ID"` | 24 | OrgId int64 `comment:"组织机构ID"` |
25 | // 公司ID | 25 | // 公司ID |
26 | CompanyId int64 `comment:"公司ID"` | 26 | CompanyId int64 `comment:"公司ID"` |
27 | - // 订单产品费用 | ||
28 | - OrderGoodExpense float64 `comment:"订单产品费用"` | 27 | + // 订单产品支出费用 |
28 | + OrderGoodExpense float64 `comment:"订单产品支出费用"` | ||
29 | + // 订单产品分红状态, 1待分红,2已分红 | ||
30 | + OrderGoodDividendsStatus int32 `comment:"订单产品分红状态"` | ||
29 | // 创建时间 | 31 | // 创建时间 |
30 | CreatedAt time.Time `comment:"创建时间"` | 32 | CreatedAt time.Time `comment:"创建时间"` |
31 | // 删除时间 | 33 | // 删除时间 |
@@ -17,6 +17,7 @@ func TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel | @@ -17,6 +17,7 @@ func TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel | ||
17 | OrderOrReturnedOrderNum: dividendsEstimateModel.OrderOrReturnedOrderNum, | 17 | OrderOrReturnedOrderNum: dividendsEstimateModel.OrderOrReturnedOrderNum, |
18 | CooperationContractNumber: dividendsEstimateModel.CooperationContractNumber, | 18 | CooperationContractNumber: dividendsEstimateModel.CooperationContractNumber, |
19 | DividendsUser: dividendsEstimateModel.DividendsUser, | 19 | DividendsUser: dividendsEstimateModel.DividendsUser, |
20 | + DividendsStage: dividendsEstimateModel.DividendsStage, | ||
20 | Org: dividendsEstimateModel.Org, | 21 | Org: dividendsEstimateModel.Org, |
21 | Company: dividendsEstimateModel.Company, | 22 | Company: dividendsEstimateModel.Company, |
22 | Operator: dividendsEstimateModel.Operator, | 23 | Operator: dividendsEstimateModel.Operator, |
@@ -15,6 +15,7 @@ func TransformToOrderGoodDomainModelFromPgModels(orderGoodModel *models.OrderGoo | @@ -15,6 +15,7 @@ func TransformToOrderGoodDomainModelFromPgModels(orderGoodModel *models.OrderGoo | ||
15 | DividendsOrderNumber: orderGoodModel.DividendsOrderNumber, | 15 | DividendsOrderNumber: orderGoodModel.DividendsOrderNumber, |
16 | CooperationContractNumber: orderGoodModel.CooperationContractNumber, | 16 | CooperationContractNumber: orderGoodModel.CooperationContractNumber, |
17 | OrderGoodExpense: orderGoodModel.OrderGoodExpense, | 17 | OrderGoodExpense: orderGoodModel.OrderGoodExpense, |
18 | + OrderGoodDividendsStatus: orderGoodModel.OrderGoodDividendsStatus, | ||
18 | OrgId: orderGoodModel.OrgId, | 19 | OrgId: orderGoodModel.OrgId, |
19 | CompanyId: orderGoodModel.CompanyId, | 20 | CompanyId: orderGoodModel.CompanyId, |
20 | CreatedAt: orderGoodModel.CreatedAt, | 21 | CreatedAt: orderGoodModel.CreatedAt, |
@@ -117,9 +117,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -117,9 +117,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
117 | CreatedAt: time.Time{}, | 117 | CreatedAt: time.Time{}, |
118 | }) | 118 | }) |
119 | } | 119 | } |
120 | + if len(relevantPeopleModel) > 0 { | ||
120 | if _, err := tx.Model(&relevantPeopleModel).Insert(); err != nil { | 121 | if _, err := tx.Model(&relevantPeopleModel).Insert(); err != nil { |
121 | return nil, err | 122 | return nil, err |
122 | } | 123 | } |
124 | + } | ||
123 | 125 | ||
124 | // 新增承接人 | 126 | // 新增承接人 |
125 | var undertakersModel []*models.CooperationContractUndertaker | 127 | var undertakersModel []*models.CooperationContractUndertaker |
@@ -144,9 +146,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -144,9 +146,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
144 | DeletedAt: time.Now(), | 146 | DeletedAt: time.Now(), |
145 | }) | 147 | }) |
146 | } | 148 | } |
149 | + if len(undertakersModel) > 0 { | ||
147 | if _, err := tx.Model(&undertakersModel).Insert(); err != nil { | 150 | if _, err := tx.Model(&undertakersModel).Insert(); err != nil { |
148 | return nil, err | 151 | return nil, err |
149 | } | 152 | } |
153 | + } | ||
150 | 154 | ||
151 | // 新增分红激励规则 | 155 | // 新增分红激励规则 |
152 | var dividendsIncentivesRulesModel []*models.DividendsIncentivesRule | 156 | var dividendsIncentivesRulesModel []*models.DividendsIncentivesRule |
@@ -166,9 +170,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -166,9 +170,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
166 | CreatedAt: time.Now(), | 170 | CreatedAt: time.Now(), |
167 | }) | 171 | }) |
168 | } | 172 | } |
173 | + if len(dividendsIncentivesRulesModel) > 0 { | ||
169 | if _, err := tx.Model(÷ndsIncentivesRulesModel).Insert(); err != nil { | 174 | if _, err := tx.Model(÷ndsIncentivesRulesModel).Insert(); err != nil { |
170 | return nil, err | 175 | return nil, err |
171 | } | 176 | } |
177 | + } | ||
172 | 178 | ||
173 | // 新增金额激励规则 | 179 | // 新增金额激励规则 |
174 | var moneyIncentivesRulesModel []*models.MoneyIncentivesRule | 180 | var moneyIncentivesRulesModel []*models.MoneyIncentivesRule |
@@ -189,9 +195,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | @@ -189,9 +195,11 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai | ||
189 | CreatedAt: time.Now(), | 195 | CreatedAt: time.Now(), |
190 | }) | 196 | }) |
191 | } | 197 | } |
198 | + if len(moneyIncentivesRulesModel) > 0 { | ||
192 | if _, err := tx.Model(&moneyIncentivesRulesModel).Insert(); err != nil { | 199 | if _, err := tx.Model(&moneyIncentivesRulesModel).Insert(); err != nil { |
193 | return nil, err | 200 | return nil, err |
194 | } | 201 | } |
202 | + } | ||
195 | } else { | 203 | } else { |
196 | if _, err := tx.QueryOne( | 204 | if _, err := tx.QueryOne( |
197 | pg.Scan( | 205 | pg.Scan( |
@@ -24,6 +24,7 @@ func (repository *DividendsEstimateRepository) nextIdentify() (int64, error) { | @@ -24,6 +24,7 @@ func (repository *DividendsEstimateRepository) nextIdentify() (int64, error) { | ||
24 | id, err := IdWorker.NextId() | 24 | id, err := IdWorker.NextId() |
25 | return id, err | 25 | return id, err |
26 | } | 26 | } |
27 | + | ||
27 | func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.DividendsEstimate) (*domain.DividendsEstimate, error) { | 28 | func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.DividendsEstimate) (*domain.DividendsEstimate, error) { |
28 | sqlBuildFields := []string{ | 29 | sqlBuildFields := []string{ |
29 | "dividends_estimate_id", | 30 | "dividends_estimate_id", |
@@ -36,6 +37,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -36,6 +37,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
36 | "order_or_returned_order_num", | 37 | "order_or_returned_order_num", |
37 | "cooperation_contract_number", | 38 | "cooperation_contract_number", |
38 | "dividends_user", | 39 | "dividends_user", |
40 | + "dividends_stage", | ||
39 | "org", | 41 | "org", |
40 | "company", | 42 | "company", |
41 | "operator", | 43 | "operator", |
@@ -69,6 +71,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -69,6 +71,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
69 | ÷ndsEstimate.OrderOrReturnedOrderNum, | 71 | ÷ndsEstimate.OrderOrReturnedOrderNum, |
70 | ÷ndsEstimate.CooperationContractNumber, | 72 | ÷ndsEstimate.CooperationContractNumber, |
71 | ÷ndsEstimate.DividendsUser, | 73 | ÷ndsEstimate.DividendsUser, |
74 | + ÷ndsEstimate.DividendsStage, | ||
72 | ÷ndsEstimate.Org, | 75 | ÷ndsEstimate.Org, |
73 | ÷ndsEstimate.Company, | 76 | ÷ndsEstimate.Company, |
74 | ÷ndsEstimate.Operator, | 77 | ÷ndsEstimate.Operator, |
@@ -88,6 +91,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -88,6 +91,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
88 | dividendsEstimate.OrderOrReturnedOrderNum, | 91 | dividendsEstimate.OrderOrReturnedOrderNum, |
89 | dividendsEstimate.CooperationContractNumber, | 92 | dividendsEstimate.CooperationContractNumber, |
90 | dividendsEstimate.DividendsUser, | 93 | dividendsEstimate.DividendsUser, |
94 | + dividendsEstimate.DividendsStage, | ||
91 | dividendsEstimate.Org, | 95 | dividendsEstimate.Org, |
92 | dividendsEstimate.Company, | 96 | dividendsEstimate.Company, |
93 | dividendsEstimate.Operator, | 97 | dividendsEstimate.Operator, |
@@ -111,6 +115,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -111,6 +115,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
111 | ÷ndsEstimate.OrderOrReturnedOrderNum, | 115 | ÷ndsEstimate.OrderOrReturnedOrderNum, |
112 | ÷ndsEstimate.CooperationContractNumber, | 116 | ÷ndsEstimate.CooperationContractNumber, |
113 | ÷ndsEstimate.DividendsUser, | 117 | ÷ndsEstimate.DividendsUser, |
118 | + ÷ndsEstimate.DividendsStage, | ||
114 | ÷ndsEstimate.Org, | 119 | ÷ndsEstimate.Org, |
115 | ÷ndsEstimate.Company, | 120 | ÷ndsEstimate.Company, |
116 | ÷ndsEstimate.Operator, | 121 | ÷ndsEstimate.Operator, |
@@ -130,6 +135,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -130,6 +135,7 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
130 | dividendsEstimate.OrderOrReturnedOrderNum, | 135 | dividendsEstimate.OrderOrReturnedOrderNum, |
131 | dividendsEstimate.CooperationContractNumber, | 136 | dividendsEstimate.CooperationContractNumber, |
132 | dividendsEstimate.DividendsUser, | 137 | dividendsEstimate.DividendsUser, |
138 | + dividendsEstimate.DividendsStage, | ||
133 | dividendsEstimate.Org, | 139 | dividendsEstimate.Org, |
134 | dividendsEstimate.Company, | 140 | dividendsEstimate.Company, |
135 | dividendsEstimate.Operator, | 141 | dividendsEstimate.Operator, |
@@ -144,6 +150,11 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -144,6 +150,11 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
144 | } | 150 | } |
145 | return dividendsEstimate, nil | 151 | return dividendsEstimate, nil |
146 | } | 152 | } |
153 | + | ||
154 | +func (repository *DividendsEstimateRepository) UpdateMany(dividendsEstimates []*domain.DividendsEstimate) ([]*domain.DividendsEstimate, error) { | ||
155 | + panic("implement me") | ||
156 | +} | ||
157 | + | ||
147 | func (repository *DividendsEstimateRepository) Remove(dividendsEstimate *domain.DividendsEstimate) (*domain.DividendsEstimate, error) { | 158 | func (repository *DividendsEstimateRepository) Remove(dividendsEstimate *domain.DividendsEstimate) (*domain.DividendsEstimate, error) { |
148 | tx := repository.transactionContext.PgTx | 159 | tx := repository.transactionContext.PgTx |
149 | dividendsEstimateModel := new(models.DividendsEstimate) | 160 | dividendsEstimateModel := new(models.DividendsEstimate) |
@@ -153,6 +164,7 @@ func (repository *DividendsEstimateRepository) Remove(dividendsEstimate *domain. | @@ -153,6 +164,7 @@ func (repository *DividendsEstimateRepository) Remove(dividendsEstimate *domain. | ||
153 | } | 164 | } |
154 | return dividendsEstimate, nil | 165 | return dividendsEstimate, nil |
155 | } | 166 | } |
167 | + | ||
156 | func (repository *DividendsEstimateRepository) FindOne(queryOptions map[string]interface{}) (*domain.DividendsEstimate, error) { | 168 | func (repository *DividendsEstimateRepository) FindOne(queryOptions map[string]interface{}) (*domain.DividendsEstimate, error) { |
157 | tx := repository.transactionContext.PgTx | 169 | tx := repository.transactionContext.PgTx |
158 | dividendsEstimateModel := new(models.DividendsEstimate) | 170 | dividendsEstimateModel := new(models.DividendsEstimate) |
@@ -171,6 +183,7 @@ func (repository *DividendsEstimateRepository) FindOne(queryOptions map[string]i | @@ -171,6 +183,7 @@ func (repository *DividendsEstimateRepository) FindOne(queryOptions map[string]i | ||
171 | return transform.TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel) | 183 | return transform.TransformToDividendsEstimateDomainModelFromPgModels(dividendsEstimateModel) |
172 | } | 184 | } |
173 | } | 185 | } |
186 | + | ||
174 | func (repository *DividendsEstimateRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.DividendsEstimate, error) { | 187 | func (repository *DividendsEstimateRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.DividendsEstimate, error) { |
175 | tx := repository.transactionContext.PgTx | 188 | tx := repository.transactionContext.PgTx |
176 | var dividendsEstimateModels []*models.DividendsEstimate | 189 | var dividendsEstimateModels []*models.DividendsEstimate |
@@ -197,6 +210,7 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte | @@ -197,6 +210,7 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte | ||
197 | return int64(count), dividendsEstimates, nil | 210 | return int64(count), dividendsEstimates, nil |
198 | } | 211 | } |
199 | } | 212 | } |
213 | + | ||
200 | func NewDividendsEstimateRepository(transactionContext *pgTransaction.TransactionContext) (*DividendsEstimateRepository, error) { | 214 | func NewDividendsEstimateRepository(transactionContext *pgTransaction.TransactionContext) (*DividendsEstimateRepository, error) { |
201 | if transactionContext == nil { | 215 | if transactionContext == nil { |
202 | return nil, fmt.Errorf("transactionContext参数不能为nil") | 216 | return nil, fmt.Errorf("transactionContext参数不能为nil") |
@@ -24,6 +24,7 @@ func (repository *DividendsIncentivesRuleRepository) nextIdentify() (int64, erro | @@ -24,6 +24,7 @@ func (repository *DividendsIncentivesRuleRepository) nextIdentify() (int64, erro | ||
24 | id, err := IdWorker.NextId() | 24 | id, err := IdWorker.NextId() |
25 | return id, err | 25 | return id, err |
26 | } | 26 | } |
27 | + | ||
27 | func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRule *domain.DividendsIncentivesRule) (*domain.DividendsIncentivesRule, error) { | 28 | func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRule *domain.DividendsIncentivesRule) (*domain.DividendsIncentivesRule, error) { |
28 | sqlBuildFields := []string{ | 29 | sqlBuildFields := []string{ |
29 | "dividends_incentives_rule_id", | 30 | "dividends_incentives_rule_id", |
@@ -129,6 +130,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | @@ -129,6 +130,7 @@ func (repository *DividendsIncentivesRuleRepository) Save(dividendsIncentivesRul | ||
129 | } | 130 | } |
130 | return dividendsIncentivesRule, nil | 131 | return dividendsIncentivesRule, nil |
131 | } | 132 | } |
133 | + | ||
132 | func (repository *DividendsIncentivesRuleRepository) Remove(dividendsIncentivesRule *domain.DividendsIncentivesRule) (*domain.DividendsIncentivesRule, error) { | 134 | func (repository *DividendsIncentivesRuleRepository) Remove(dividendsIncentivesRule *domain.DividendsIncentivesRule) (*domain.DividendsIncentivesRule, error) { |
133 | tx := repository.transactionContext.PgTx | 135 | tx := repository.transactionContext.PgTx |
134 | dividendsIncentivesRuleModel := new(models.DividendsIncentivesRule) | 136 | dividendsIncentivesRuleModel := new(models.DividendsIncentivesRule) |
@@ -138,6 +140,7 @@ func (repository *DividendsIncentivesRuleRepository) Remove(dividendsIncentivesR | @@ -138,6 +140,7 @@ func (repository *DividendsIncentivesRuleRepository) Remove(dividendsIncentivesR | ||
138 | } | 140 | } |
139 | return dividendsIncentivesRule, nil | 141 | return dividendsIncentivesRule, nil |
140 | } | 142 | } |
143 | + | ||
141 | func (repository *DividendsIncentivesRuleRepository) FindOne(queryOptions map[string]interface{}) (*domain.DividendsIncentivesRule, error) { | 144 | func (repository *DividendsIncentivesRuleRepository) FindOne(queryOptions map[string]interface{}) (*domain.DividendsIncentivesRule, error) { |
142 | tx := repository.transactionContext.PgTx | 145 | tx := repository.transactionContext.PgTx |
143 | dividendsIncentivesRuleModel := new(models.DividendsIncentivesRule) | 146 | dividendsIncentivesRuleModel := new(models.DividendsIncentivesRule) |
@@ -156,6 +159,7 @@ func (repository *DividendsIncentivesRuleRepository) FindOne(queryOptions map[st | @@ -156,6 +159,7 @@ func (repository *DividendsIncentivesRuleRepository) FindOne(queryOptions map[st | ||
156 | return transform.TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentivesRuleModel) | 159 | return transform.TransformToDividendsIncentivesRuleDomainModelFromPgModels(dividendsIncentivesRuleModel) |
157 | } | 160 | } |
158 | } | 161 | } |
162 | + | ||
159 | func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.DividendsIncentivesRule, error) { | 163 | func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.DividendsIncentivesRule, error) { |
160 | tx := repository.transactionContext.PgTx | 164 | tx := repository.transactionContext.PgTx |
161 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule | 165 | var dividendsIncentivesRuleModels []*models.DividendsIncentivesRule |
@@ -182,6 +186,7 @@ func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[strin | @@ -182,6 +186,7 @@ func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[strin | ||
182 | return int64(count), dividendsIncentivesRules, nil | 186 | return int64(count), dividendsIncentivesRules, nil |
183 | } | 187 | } |
184 | } | 188 | } |
189 | + | ||
185 | func NewDividendsIncentivesRuleRepository(transactionContext *pgTransaction.TransactionContext) (*DividendsIncentivesRuleRepository, error) { | 190 | func NewDividendsIncentivesRuleRepository(transactionContext *pgTransaction.TransactionContext) (*DividendsIncentivesRuleRepository, error) { |
186 | if transactionContext == nil { | 191 | if transactionContext == nil { |
187 | return nil, fmt.Errorf("transactionContext参数不能为nil") | 192 | return nil, fmt.Errorf("transactionContext参数不能为nil") |
@@ -24,6 +24,7 @@ func (repository *MoneyIncentivesRuleRepository) nextIdentify() (int64, error) { | @@ -24,6 +24,7 @@ func (repository *MoneyIncentivesRuleRepository) nextIdentify() (int64, error) { | ||
24 | id, err := IdWorker.NextId() | 24 | id, err := IdWorker.NextId() |
25 | return id, err | 25 | return id, err |
26 | } | 26 | } |
27 | + | ||
27 | func (repository *MoneyIncentivesRuleRepository) Save(moneyIncentivesRule *domain.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) { | 28 | func (repository *MoneyIncentivesRuleRepository) Save(moneyIncentivesRule *domain.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) { |
28 | sqlBuildFields := []string{ | 29 | sqlBuildFields := []string{ |
29 | "money_incentives_rule_id", | 30 | "money_incentives_rule_id", |
@@ -129,6 +130,7 @@ func (repository *MoneyIncentivesRuleRepository) Save(moneyIncentivesRule *domai | @@ -129,6 +130,7 @@ func (repository *MoneyIncentivesRuleRepository) Save(moneyIncentivesRule *domai | ||
129 | } | 130 | } |
130 | return moneyIncentivesRule, nil | 131 | return moneyIncentivesRule, nil |
131 | } | 132 | } |
133 | + | ||
132 | func (repository *MoneyIncentivesRuleRepository) Remove(moneyIncentivesRule *domain.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) { | 134 | func (repository *MoneyIncentivesRuleRepository) Remove(moneyIncentivesRule *domain.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) { |
133 | tx := repository.transactionContext.PgTx | 135 | tx := repository.transactionContext.PgTx |
134 | moneyIncentivesRuleModel := new(models.MoneyIncentivesRule) | 136 | moneyIncentivesRuleModel := new(models.MoneyIncentivesRule) |
@@ -138,6 +140,7 @@ func (repository *MoneyIncentivesRuleRepository) Remove(moneyIncentivesRule *dom | @@ -138,6 +140,7 @@ func (repository *MoneyIncentivesRuleRepository) Remove(moneyIncentivesRule *dom | ||
138 | } | 140 | } |
139 | return moneyIncentivesRule, nil | 141 | return moneyIncentivesRule, nil |
140 | } | 142 | } |
143 | + | ||
141 | func (repository *MoneyIncentivesRuleRepository) FindOne(queryOptions map[string]interface{}) (*domain.MoneyIncentivesRule, error) { | 144 | func (repository *MoneyIncentivesRuleRepository) FindOne(queryOptions map[string]interface{}) (*domain.MoneyIncentivesRule, error) { |
142 | tx := repository.transactionContext.PgTx | 145 | tx := repository.transactionContext.PgTx |
143 | moneyIncentivesRuleModel := new(models.MoneyIncentivesRule) | 146 | moneyIncentivesRuleModel := new(models.MoneyIncentivesRule) |
@@ -156,6 +159,7 @@ func (repository *MoneyIncentivesRuleRepository) FindOne(queryOptions map[string | @@ -156,6 +159,7 @@ func (repository *MoneyIncentivesRuleRepository) FindOne(queryOptions map[string | ||
156 | return transform.TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleModel) | 159 | return transform.TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleModel) |
157 | } | 160 | } |
158 | } | 161 | } |
162 | + | ||
159 | func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.MoneyIncentivesRule, error) { | 163 | func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.MoneyIncentivesRule, error) { |
160 | tx := repository.transactionContext.PgTx | 164 | tx := repository.transactionContext.PgTx |
161 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule | 165 | var moneyIncentivesRuleModels []*models.MoneyIncentivesRule |
@@ -182,6 +186,7 @@ func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]in | @@ -182,6 +186,7 @@ func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]in | ||
182 | return int64(count), moneyIncentivesRules, nil | 186 | return int64(count), moneyIncentivesRules, nil |
183 | } | 187 | } |
184 | } | 188 | } |
189 | + | ||
185 | func NewMoneyIncentivesRuleRepository(transactionContext *pgTransaction.TransactionContext) (*MoneyIncentivesRuleRepository, error) { | 190 | func NewMoneyIncentivesRuleRepository(transactionContext *pgTransaction.TransactionContext) (*MoneyIncentivesRuleRepository, error) { |
186 | if transactionContext == nil { | 191 | if transactionContext == nil { |
187 | return nil, fmt.Errorf("transactionContext参数不能为nil") | 192 | return nil, fmt.Errorf("transactionContext参数不能为nil") |
@@ -34,6 +34,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | @@ -34,6 +34,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | ||
34 | "dividends_order_number", | 34 | "dividends_order_number", |
35 | "cooperation_contract_number", | 35 | "cooperation_contract_number", |
36 | "order_good_expense", | 36 | "order_good_expense", |
37 | + "order_good_dividends_status", | ||
37 | "org_id", | 38 | "org_id", |
38 | "company_id", | 39 | "company_id", |
39 | "created_at", | 40 | "created_at", |
@@ -63,6 +64,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | @@ -63,6 +64,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | ||
63 | &orderGood.DividendsOrderNumber, | 64 | &orderGood.DividendsOrderNumber, |
64 | &orderGood.CooperationContractNumber, | 65 | &orderGood.CooperationContractNumber, |
65 | &orderGood.OrderGoodExpense, | 66 | &orderGood.OrderGoodExpense, |
67 | + &orderGood.OrderGoodDividendsStatus, | ||
66 | &orderGood.OrgId, | 68 | &orderGood.OrgId, |
67 | &orderGood.CompanyId, | 69 | &orderGood.CompanyId, |
68 | &orderGood.CreatedAt, | 70 | &orderGood.CreatedAt, |
@@ -78,6 +80,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | @@ -78,6 +80,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | ||
78 | orderGood.DividendsOrderNumber, | 80 | orderGood.DividendsOrderNumber, |
79 | orderGood.CooperationContractNumber, | 81 | orderGood.CooperationContractNumber, |
80 | orderGood.OrderGoodExpense, | 82 | orderGood.OrderGoodExpense, |
83 | + orderGood.OrderGoodDividendsStatus, | ||
81 | orderGood.OrgId, | 84 | orderGood.OrgId, |
82 | orderGood.CompanyId, | 85 | orderGood.CompanyId, |
83 | orderGood.CreatedAt, | 86 | orderGood.CreatedAt, |
@@ -97,6 +100,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | @@ -97,6 +100,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | ||
97 | &orderGood.DividendsOrderNumber, | 100 | &orderGood.DividendsOrderNumber, |
98 | &orderGood.CooperationContractNumber, | 101 | &orderGood.CooperationContractNumber, |
99 | &orderGood.OrderGoodExpense, | 102 | &orderGood.OrderGoodExpense, |
103 | + &orderGood.OrderGoodDividendsStatus, | ||
100 | &orderGood.OrgId, | 104 | &orderGood.OrgId, |
101 | &orderGood.CompanyId, | 105 | &orderGood.CompanyId, |
102 | &orderGood.CreatedAt, | 106 | &orderGood.CreatedAt, |
@@ -112,6 +116,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | @@ -112,6 +116,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | ||
112 | orderGood.DividendsOrderNumber, | 116 | orderGood.DividendsOrderNumber, |
113 | orderGood.CooperationContractNumber, | 117 | orderGood.CooperationContractNumber, |
114 | orderGood.OrderGoodExpense, | 118 | orderGood.OrderGoodExpense, |
119 | + orderGood.OrderGoodDividendsStatus, | ||
115 | orderGood.OrgId, | 120 | orderGood.OrgId, |
116 | orderGood.CompanyId, | 121 | orderGood.CompanyId, |
117 | orderGood.CreatedAt, | 122 | orderGood.CreatedAt, |
@@ -124,6 +129,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | @@ -124,6 +129,7 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai | ||
124 | } | 129 | } |
125 | return orderGood, nil | 130 | return orderGood, nil |
126 | } | 131 | } |
132 | + | ||
127 | func (repository *OrderGoodRepository) Remove(orderGood *domain.OrderGood) (*domain.OrderGood, error) { | 133 | func (repository *OrderGoodRepository) Remove(orderGood *domain.OrderGood) (*domain.OrderGood, error) { |
128 | tx := repository.transactionContext.PgTx | 134 | tx := repository.transactionContext.PgTx |
129 | orderGoodModel := new(models.OrderGood) | 135 | orderGoodModel := new(models.OrderGood) |
@@ -133,6 +139,7 @@ func (repository *OrderGoodRepository) Remove(orderGood *domain.OrderGood) (*dom | @@ -133,6 +139,7 @@ func (repository *OrderGoodRepository) Remove(orderGood *domain.OrderGood) (*dom | ||
133 | } | 139 | } |
134 | return orderGood, nil | 140 | return orderGood, nil |
135 | } | 141 | } |
142 | + | ||
136 | func (repository *OrderGoodRepository) FindOne(queryOptions map[string]interface{}) (*domain.OrderGood, error) { | 143 | func (repository *OrderGoodRepository) FindOne(queryOptions map[string]interface{}) (*domain.OrderGood, error) { |
137 | tx := repository.transactionContext.PgTx | 144 | tx := repository.transactionContext.PgTx |
138 | orderGoodModel := new(models.OrderGood) | 145 | orderGoodModel := new(models.OrderGood) |
@@ -151,6 +158,7 @@ func (repository *OrderGoodRepository) FindOne(queryOptions map[string]interface | @@ -151,6 +158,7 @@ func (repository *OrderGoodRepository) FindOne(queryOptions map[string]interface | ||
151 | return transform.TransformToOrderGoodDomainModelFromPgModels(orderGoodModel) | 158 | return transform.TransformToOrderGoodDomainModelFromPgModels(orderGoodModel) |
152 | } | 159 | } |
153 | } | 160 | } |
161 | + | ||
154 | func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.OrderGood, error) { | 162 | func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{}) (int64, []*domain.OrderGood, error) { |
155 | tx := repository.transactionContext.PgTx | 163 | tx := repository.transactionContext.PgTx |
156 | var orderGoodModels []*models.OrderGood | 164 | var orderGoodModels []*models.OrderGood |
@@ -177,6 +185,7 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{}) | @@ -177,6 +185,7 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{}) | ||
177 | return int64(count), orderGoods, nil | 185 | return int64(count), orderGoods, nil |
178 | } | 186 | } |
179 | } | 187 | } |
188 | + | ||
180 | func NewOrderGoodRepository(transactionContext *pgTransaction.TransactionContext) (*OrderGoodRepository, error) { | 189 | func NewOrderGoodRepository(transactionContext *pgTransaction.TransactionContext) (*OrderGoodRepository, error) { |
181 | if transactionContext == nil { | 190 | if transactionContext == nil { |
182 | return nil, fmt.Errorf("transactionContext参数不能为nil") | 191 | return nil, fmt.Errorf("transactionContext参数不能为nil") |
@@ -10,6 +10,7 @@ type DividendsEstimateController struct { | @@ -10,6 +10,7 @@ type DividendsEstimateController struct { | ||
10 | BaseController | 10 | BaseController |
11 | } | 11 | } |
12 | 12 | ||
13 | +// CreateDividendsEstimate 新增分红预算单(预留) | ||
13 | func (controller *DividendsEstimateController) CreateDividendsEstimate() { | 14 | func (controller *DividendsEstimateController) CreateDividendsEstimate() { |
14 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 15 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
15 | createDividendsEstimateCommand := &command.CreateDividendsEstimateCommand{} | 16 | createDividendsEstimateCommand := &command.CreateDividendsEstimateCommand{} |
@@ -23,6 +24,7 @@ func (controller *DividendsEstimateController) CreateDividendsEstimate() { | @@ -23,6 +24,7 @@ func (controller *DividendsEstimateController) CreateDividendsEstimate() { | ||
23 | controller.Response(data, err) | 24 | controller.Response(data, err) |
24 | } | 25 | } |
25 | 26 | ||
27 | +// UpdateDividendsEstimate 编辑分红预算单(预留) | ||
26 | func (controller *DividendsEstimateController) UpdateDividendsEstimate() { | 28 | func (controller *DividendsEstimateController) UpdateDividendsEstimate() { |
27 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 29 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
28 | updateDividendsEstimateCommand := &command.UpdateDividendsEstimateCommand{} | 30 | updateDividendsEstimateCommand := &command.UpdateDividendsEstimateCommand{} |
@@ -38,6 +40,7 @@ func (controller *DividendsEstimateController) UpdateDividendsEstimate() { | @@ -38,6 +40,7 @@ func (controller *DividendsEstimateController) UpdateDividendsEstimate() { | ||
38 | controller.Response(data, err) | 40 | controller.Response(data, err) |
39 | } | 41 | } |
40 | 42 | ||
43 | +// GetDividendsEstimate 获取分红预算单详情 | ||
41 | func (controller *DividendsEstimateController) GetDividendsEstimate() { | 44 | func (controller *DividendsEstimateController) GetDividendsEstimate() { |
42 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 45 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
43 | getDividendsEstimateQuery := &query.GetDividendsEstimateQuery{} | 46 | getDividendsEstimateQuery := &query.GetDividendsEstimateQuery{} |
@@ -52,6 +55,7 @@ func (controller *DividendsEstimateController) GetDividendsEstimate() { | @@ -52,6 +55,7 @@ func (controller *DividendsEstimateController) GetDividendsEstimate() { | ||
52 | controller.Response(data, err) | 55 | controller.Response(data, err) |
53 | } | 56 | } |
54 | 57 | ||
58 | +// RemoveDividendsEstimate 移除分红预算单(预留) | ||
55 | func (controller *DividendsEstimateController) RemoveDividendsEstimate() { | 59 | func (controller *DividendsEstimateController) RemoveDividendsEstimate() { |
56 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 60 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
57 | removeDividendsEstimateCommand := &command.RemoveDividendsEstimateCommand{} | 61 | removeDividendsEstimateCommand := &command.RemoveDividendsEstimateCommand{} |
@@ -67,6 +71,7 @@ func (controller *DividendsEstimateController) RemoveDividendsEstimate() { | @@ -67,6 +71,7 @@ func (controller *DividendsEstimateController) RemoveDividendsEstimate() { | ||
67 | controller.Response(data, err) | 71 | controller.Response(data, err) |
68 | } | 72 | } |
69 | 73 | ||
74 | +// CancelDividendsEstimate 取消分红预算单 | ||
70 | func (controller *DividendsEstimateController) CancelDividendsEstimate() { | 75 | func (controller *DividendsEstimateController) CancelDividendsEstimate() { |
71 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 76 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
72 | cancelDividendsEstimateCommand := &command.CancelDividendsEstimateCommand{} | 77 | cancelDividendsEstimateCommand := &command.CancelDividendsEstimateCommand{} |
@@ -82,20 +87,40 @@ func (controller *DividendsEstimateController) CancelDividendsEstimate() { | @@ -82,20 +87,40 @@ func (controller *DividendsEstimateController) CancelDividendsEstimate() { | ||
82 | controller.Response(data, err) | 87 | controller.Response(data, err) |
83 | } | 88 | } |
84 | 89 | ||
90 | +// BatchCancelDividendsEstimate 批量取消分红预算单 | ||
91 | +func (controller *DividendsEstimateController) BatchCancelDividendsEstimate() { | ||
92 | + dividendsEstimateService := service.NewDividendsEstimateService(nil) | ||
93 | + batchCancelDividendsEstimateCommand := &command.BatchCancelDividendsEstimateCommand{} | ||
94 | + _ = controller.Unmarshal(batchCancelDividendsEstimateCommand) | ||
95 | + header := controller.GetRequestHeader(controller.Ctx) | ||
96 | + batchCancelDividendsEstimateCommand.CompanyId = header.CompanyId | ||
97 | + batchCancelDividendsEstimateCommand.OrgId = header.OrgId | ||
98 | + batchCancelDividendsEstimateCommand.UserId = header.UserId | ||
99 | + batchCancelDividendsEstimateCommand.UserBaseId = header.UserBaseId | ||
100 | + data, err := dividendsEstimateService.BatchCancelDividendsEstimate(batchCancelDividendsEstimateCommand) | ||
101 | + controller.Response(data, err) | ||
102 | +} | ||
103 | + | ||
104 | +// SearchDividendsEstimate 搜索分红预算单 | ||
85 | func (controller *DividendsEstimateController) SearchDividendsEstimate() { | 105 | func (controller *DividendsEstimateController) SearchDividendsEstimate() { |
86 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 106 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
87 | searchDividendsEstimateQuery := &query.SearchDividendsEstimateQuery{} | 107 | searchDividendsEstimateQuery := &query.SearchDividendsEstimateQuery{} |
88 | - // 解析头部信息 | 108 | + _ = controller.Unmarshal(searchDividendsEstimateQuery) |
89 | header := controller.GetRequestHeader(controller.Ctx) | 109 | header := controller.GetRequestHeader(controller.Ctx) |
90 | searchDividendsEstimateQuery.CompanyId = header.CompanyId | 110 | searchDividendsEstimateQuery.CompanyId = header.CompanyId |
91 | searchDividendsEstimateQuery.OrgId = header.OrgId | 111 | searchDividendsEstimateQuery.OrgId = header.OrgId |
92 | searchDividendsEstimateQuery.UserId = header.UserId | 112 | searchDividendsEstimateQuery.UserId = header.UserId |
93 | searchDividendsEstimateQuery.UserBaseId = header.UserBaseId | 113 | searchDividendsEstimateQuery.UserBaseId = header.UserBaseId |
114 | + pageSize, _ := controller.GetInt64("pageSize") | ||
115 | + searchDividendsEstimateQuery.PageSize = pageSize | ||
116 | + pageNumber, _ := controller.GetInt64("pageNumber") | ||
117 | + searchDividendsEstimateQuery.PageNumber = pageNumber | ||
94 | data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery) | 118 | data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery) |
95 | controller.Response(data, err) | 119 | controller.Response(data, err) |
96 | } | 120 | } |
97 | 121 | ||
98 | -func (controller *DividendsEstimateController) EstimateDividendsIncentives() { | 122 | +// ConfirmDividendsIncentivesEstimate 确定业绩激励分红预算 |
123 | +func (controller *DividendsEstimateController) ConfirmDividendsIncentivesEstimate() { | ||
99 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 124 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
100 | estimateDividendsIncentivesCommand := &command.ConfirmDividendsIncentivesEstimateCommand{} | 125 | estimateDividendsIncentivesCommand := &command.ConfirmDividendsIncentivesEstimateCommand{} |
101 | _ = controller.Unmarshal(estimateDividendsIncentivesCommand) | 126 | _ = controller.Unmarshal(estimateDividendsIncentivesCommand) |
@@ -104,48 +129,61 @@ func (controller *DividendsEstimateController) EstimateDividendsIncentives() { | @@ -104,48 +129,61 @@ func (controller *DividendsEstimateController) EstimateDividendsIncentives() { | ||
104 | estimateDividendsIncentivesCommand.OrgId = header.OrgId | 129 | estimateDividendsIncentivesCommand.OrgId = header.OrgId |
105 | estimateDividendsIncentivesCommand.UserId = header.UserId | 130 | estimateDividendsIncentivesCommand.UserId = header.UserId |
106 | estimateDividendsIncentivesCommand.UserBaseId = header.UserBaseId | 131 | estimateDividendsIncentivesCommand.UserBaseId = header.UserBaseId |
107 | - data, err := dividendsEstimateService.EstimateDividendsIncentives(estimateDividendsIncentivesCommand) | 132 | + data, err := dividendsEstimateService.ConfirmDividendsIncentivesEstimate(estimateDividendsIncentivesCommand) |
108 | controller.Response(data, err) | 133 | controller.Response(data, err) |
109 | } | 134 | } |
110 | 135 | ||
111 | -func (controller *DividendsEstimateController) EstimateMoneyIncentives() { | 136 | +// ConfirmMoneyIncentivesEstimate 确定金额激励分红预算 |
137 | +func (controller *DividendsEstimateController) ConfirmMoneyIncentivesEstimate() { | ||
112 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 138 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
113 | - estimateMoneyIncentivesCommand := &command.ConfirmMoneyIncentivesEstimateCommand{} | ||
114 | - _ = controller.Unmarshal(estimateMoneyIncentivesCommand) | 139 | + confirmMoneyIncentivesEstimateCommand := &command.ConfirmMoneyIncentivesEstimateCommand{} |
140 | + _ = controller.Unmarshal(confirmMoneyIncentivesEstimateCommand) | ||
115 | header := controller.GetRequestHeader(controller.Ctx) | 141 | header := controller.GetRequestHeader(controller.Ctx) |
116 | - estimateMoneyIncentivesCommand.CompanyId = header.CompanyId | ||
117 | - estimateMoneyIncentivesCommand.OrgId = header.OrgId | ||
118 | - estimateMoneyIncentivesCommand.UserId = header.UserId | ||
119 | - estimateMoneyIncentivesCommand.UserBaseId = header.UserBaseId | ||
120 | - data, err := dividendsEstimateService.EstimateMoneyIncentives(estimateMoneyIncentivesCommand) | 142 | + confirmMoneyIncentivesEstimateCommand.CompanyId = header.CompanyId |
143 | + confirmMoneyIncentivesEstimateCommand.OrgId = header.OrgId | ||
144 | + confirmMoneyIncentivesEstimateCommand.UserId = header.UserId | ||
145 | + confirmMoneyIncentivesEstimateCommand.UserBaseId = header.UserBaseId | ||
146 | + data, err := dividendsEstimateService.ConfirmMoneyIncentivesEstimate(confirmMoneyIncentivesEstimateCommand) | ||
121 | controller.Response(data, err) | 147 | controller.Response(data, err) |
122 | } | 148 | } |
123 | 149 | ||
124 | -func (controller *DividendsEstimateController) ListMoneyIncentives() { | 150 | +// ListMoneyIncentivesEstimate 返回金额激励分红预算信息列表 |
151 | +func (controller *DividendsEstimateController) ListMoneyIncentivesEstimate() { | ||
125 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 152 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
126 | - listMoneyIncentivesQuery := &query.ListMoneyIncentivesEstimateQuery{} | 153 | + listMoneyIncentivesEstimateQuery := &query.ListMoneyIncentivesEstimateQuery{} |
127 | header := controller.GetRequestHeader(controller.Ctx) | 154 | header := controller.GetRequestHeader(controller.Ctx) |
128 | - listMoneyIncentivesQuery.CompanyId = header.CompanyId | ||
129 | - listMoneyIncentivesQuery.OrgId = header.OrgId | ||
130 | - listMoneyIncentivesQuery.UserId = header.UserId | ||
131 | - listMoneyIncentivesQuery.UserBaseId = header.UserBaseId | ||
132 | - data, err := dividendsEstimateService.ListMoneyIncentives(listMoneyIncentivesQuery) | 155 | + listMoneyIncentivesEstimateQuery.CompanyId = header.CompanyId |
156 | + listMoneyIncentivesEstimateQuery.OrgId = header.OrgId | ||
157 | + listMoneyIncentivesEstimateQuery.UserId = header.UserId | ||
158 | + listMoneyIncentivesEstimateQuery.UserBaseId = header.UserBaseId | ||
159 | + pageSize, _ := controller.GetInt64("pageSize") | ||
160 | + listMoneyIncentivesEstimateQuery.PageSize = pageSize | ||
161 | + pageNumber, _ := controller.GetInt64("pageNumber") | ||
162 | + listMoneyIncentivesEstimateQuery.PageNumber = pageNumber | ||
163 | + data, err := dividendsEstimateService.ListMoneyIncentivesEstimate(listMoneyIncentivesEstimateQuery) | ||
133 | controller.Response(data, err) | 164 | controller.Response(data, err) |
134 | } | 165 | } |
135 | 166 | ||
136 | -func (controller *DividendsEstimateController) SearchMoneyIncentives() { | 167 | +// SearchMoneyIncentivesEstimate 搜索金额激励分红预算信息 |
168 | +func (controller *DividendsEstimateController) SearchMoneyIncentivesEstimate() { | ||
137 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 169 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
138 | - searchMoneyIncentivesQuery := &query.SearchMoneyIncentivesEstimateQuery{} | 170 | + searchMoneyIncentivesEstimateQuery := &query.SearchMoneyIncentivesEstimateQuery{} |
171 | + _ = controller.Unmarshal(searchMoneyIncentivesEstimateQuery) | ||
139 | header := controller.GetRequestHeader(controller.Ctx) | 172 | header := controller.GetRequestHeader(controller.Ctx) |
140 | - searchMoneyIncentivesQuery.CompanyId = header.CompanyId | ||
141 | - searchMoneyIncentivesQuery.OrgId = header.OrgId | ||
142 | - searchMoneyIncentivesQuery.UserId = header.UserId | ||
143 | - searchMoneyIncentivesQuery.UserBaseId = header.UserBaseId | ||
144 | - data, err := dividendsEstimateService.SearchMoneyIncentives(searchMoneyIncentivesQuery) | 173 | + searchMoneyIncentivesEstimateQuery.CompanyId = header.CompanyId |
174 | + searchMoneyIncentivesEstimateQuery.OrgId = header.OrgId | ||
175 | + searchMoneyIncentivesEstimateQuery.UserId = header.UserId | ||
176 | + searchMoneyIncentivesEstimateQuery.UserBaseId = header.UserBaseId | ||
177 | + pageSize, _ := controller.GetInt64("pageSize") | ||
178 | + searchMoneyIncentivesEstimateQuery.PageSize = pageSize | ||
179 | + pageNumber, _ := controller.GetInt64("pageNumber") | ||
180 | + searchMoneyIncentivesEstimateQuery.PageNumber = pageNumber | ||
181 | + data, err := dividendsEstimateService.SearchMoneyIncentivesEstimate(searchMoneyIncentivesEstimateQuery) | ||
145 | controller.Response(data, err) | 182 | controller.Response(data, err) |
146 | } | 183 | } |
147 | 184 | ||
148 | -func (controller *DividendsEstimateController) ListDividendsIncentives() { | 185 | +// ListDividendsIncentivesEstimate 返回业绩激励分红预算信息列表 |
186 | +func (controller *DividendsEstimateController) ListDividendsIncentivesEstimate() { | ||
149 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 187 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
150 | listDividendsIncentivesQuery := &query.ListDividendsIncentivesEstimateQuery{} | 188 | listDividendsIncentivesQuery := &query.ListDividendsIncentivesEstimateQuery{} |
151 | header := controller.GetRequestHeader(controller.Ctx) | 189 | header := controller.GetRequestHeader(controller.Ctx) |
@@ -153,22 +191,33 @@ func (controller *DividendsEstimateController) ListDividendsIncentives() { | @@ -153,22 +191,33 @@ func (controller *DividendsEstimateController) ListDividendsIncentives() { | ||
153 | listDividendsIncentivesQuery.OrgId = header.OrgId | 191 | listDividendsIncentivesQuery.OrgId = header.OrgId |
154 | listDividendsIncentivesQuery.UserId = header.UserId | 192 | listDividendsIncentivesQuery.UserId = header.UserId |
155 | listDividendsIncentivesQuery.UserBaseId = header.UserBaseId | 193 | listDividendsIncentivesQuery.UserBaseId = header.UserBaseId |
156 | - data, err := dividendsEstimateService.ListDividendsIncentives(listDividendsIncentivesQuery) | 194 | + pageSize, _ := controller.GetInt64("pageSize") |
195 | + listDividendsIncentivesQuery.PageSize = pageSize | ||
196 | + pageNumber, _ := controller.GetInt64("pageNumber") | ||
197 | + listDividendsIncentivesQuery.PageNumber = pageNumber | ||
198 | + data, err := dividendsEstimateService.ListDividendsIncentivesEstimate(listDividendsIncentivesQuery) | ||
157 | controller.Response(data, err) | 199 | controller.Response(data, err) |
158 | } | 200 | } |
159 | 201 | ||
160 | -func (controller *DividendsEstimateController) SearchDividendsIncentives() { | 202 | +// SearchDividendsIncentivesEstimate 搜索业绩激励分红预算信息 |
203 | +func (controller *DividendsEstimateController) SearchDividendsIncentivesEstimate() { | ||
161 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 204 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
162 | searchDividendsIncentivesQuery := &query.SearchDividendsIncentivesEstimateQuery{} | 205 | searchDividendsIncentivesQuery := &query.SearchDividendsIncentivesEstimateQuery{} |
206 | + _ = controller.Unmarshal(searchDividendsIncentivesQuery) | ||
163 | header := controller.GetRequestHeader(controller.Ctx) | 207 | header := controller.GetRequestHeader(controller.Ctx) |
164 | searchDividendsIncentivesQuery.CompanyId = header.CompanyId | 208 | searchDividendsIncentivesQuery.CompanyId = header.CompanyId |
165 | searchDividendsIncentivesQuery.OrgId = header.OrgId | 209 | searchDividendsIncentivesQuery.OrgId = header.OrgId |
166 | searchDividendsIncentivesQuery.UserId = header.UserId | 210 | searchDividendsIncentivesQuery.UserId = header.UserId |
167 | searchDividendsIncentivesQuery.UserBaseId = header.UserBaseId | 211 | searchDividendsIncentivesQuery.UserBaseId = header.UserBaseId |
168 | - data, err := dividendsEstimateService.SearchDividendsIncentives(searchDividendsIncentivesQuery) | 212 | + pageSize, _ := controller.GetInt64("pageSize") |
213 | + searchDividendsIncentivesQuery.PageSize = pageSize | ||
214 | + pageNumber, _ := controller.GetInt64("pageNumber") | ||
215 | + searchDividendsIncentivesQuery.PageNumber = pageNumber | ||
216 | + data, err := dividendsEstimateService.SearchDividendsIncentivesEstimate(searchDividendsIncentivesQuery) | ||
169 | controller.Response(data, err) | 217 | controller.Response(data, err) |
170 | } | 218 | } |
171 | 219 | ||
220 | +// ListDividendsEstimate 返回分红预算单列表 | ||
172 | func (controller *DividendsEstimateController) ListDividendsEstimate() { | 221 | func (controller *DividendsEstimateController) ListDividendsEstimate() { |
173 | dividendsEstimateService := service.NewDividendsEstimateService(nil) | 222 | dividendsEstimateService := service.NewDividendsEstimateService(nil) |
174 | listDividendsEstimateQuery := &query.ListDividendsEstimateQuery{} | 223 | listDividendsEstimateQuery := &query.ListDividendsEstimateQuery{} |
@@ -6,17 +6,18 @@ import ( | @@ -6,17 +6,18 @@ import ( | ||
6 | ) | 6 | ) |
7 | 7 | ||
8 | func init() { | 8 | func init() { |
9 | - web.Router("/dividends-estimates/", &controllers.DividendsEstimateController{}, "Post:CreateDividendsEstimate") | ||
10 | - web.Router("/dividends-estimates/:dividendsEstimateId", &controllers.DividendsEstimateController{}, "Put:UpdateDividendsEstimate") | ||
11 | - web.Router("/dividends-estimates/:dividendsEstimateId", &controllers.DividendsEstimateController{}, "Get:GetDividendsEstimate") | ||
12 | - web.Router("/dividends-estimates/:dividendsEstimateId", &controllers.DividendsEstimateController{}, "Delete:RemoveDividendsEstimate") | ||
13 | - web.Router("/dividends-estimates/:dividendsEstimateId/cancel", &controllers.DividendsEstimateController{}, "Post:CancelDividendsEstimate") | ||
14 | - web.Router("/dividends-estimates/search", &controllers.DividendsEstimateController{}, "Post:SearchDividendsEstimate") | ||
15 | - web.Router("/dividends-estimates/estimate-dividends-incentives", &controllers.DividendsEstimateController{}, "Post:EstimateDividendsIncentives") | ||
16 | - web.Router("/dividends-estimates/estimate-money-incentives", &controllers.DividendsEstimateController{}, "Post:EstimateMoneyIncentives") | ||
17 | - web.Router("/dividends-estimates/list-money-incentives", &controllers.DividendsEstimateController{}, "Get:ListMoneyIncentives") | ||
18 | - web.Router("/dividends-estimates/search-money-incentives", &controllers.DividendsEstimateController{}, "Post:SearchMoneyIncentives") | ||
19 | - web.Router("/dividends-estimates/list-dividends-incentives", &controllers.DividendsEstimateController{}, "Get:ListDividendsIncentives") | ||
20 | - web.Router("/dividends-estimates/search-dividends-incentives", &controllers.DividendsEstimateController{}, "Post:SearchDividendsIncentives") | ||
21 | - web.Router("/dividends-estimates/", &controllers.DividendsEstimateController{}, "Get:ListDividendsEstimate") | 9 | + web.Router("/dividends-estimates/", &controllers.DividendsEstimateController{}, "Post:CreateDividendsEstimate") // 新增分红预算单(预留) |
10 | + web.Router("/dividends-estimates/:dividendsEstimateId", &controllers.DividendsEstimateController{}, "Put:UpdateDividendsEstimate") // 编辑分红预算单(预留) | ||
11 | + web.Router("/dividends-estimates/:dividendsEstimateId", &controllers.DividendsEstimateController{}, "Get:GetDividendsEstimate") // 返回分红预算单详情 | ||
12 | + web.Router("/dividends-estimates/:dividendsEstimateId", &controllers.DividendsEstimateController{}, "Delete:RemoveDividendsEstimate") // 移除分红预算单(预留) | ||
13 | + web.Router("/dividends-estimates/:dividendsEstimateId/cancel", &controllers.DividendsEstimateController{}, "Post:CancelDividendsEstimate") // 取消分红预算单 | ||
14 | + web.Router("/dividends-estimates/batch-cancel", &controllers.DividendsEstimateController{}, "Post:BatchCancelDividendsEstimate") // 批量取消分红预算单 | ||
15 | + web.Router("/dividends-estimates/search", &controllers.DividendsEstimateController{}, "Post:SearchDividendsEstimate") // 搜索分红预算单 | ||
16 | + web.Router("/dividends-estimates/estimate-dividends-incentives", &controllers.DividendsEstimateController{}, "Post:ConfirmDividendsIncentivesEstimate") // 确认业绩积累激励分红预算 | ||
17 | + web.Router("/dividends-estimates/estimate-money-incentives", &controllers.DividendsEstimateController{}, "Post:ConfirmMoneyIncentivesEstimate") // 确认金额激励分红预算 | ||
18 | + web.Router("/dividends-estimates/list-money-incentives", &controllers.DividendsEstimateController{}, "Get:ListMoneyIncentivesEstimate") // 返回金额激励分红预算信息列表 | ||
19 | + web.Router("/dividends-estimates/search-money-incentives", &controllers.DividendsEstimateController{}, "Post:SearchMoneyIncentivesEstimate") // 搜索金额激励分红预算信息列表 | ||
20 | + web.Router("/dividends-estimates/list-dividends-incentives", &controllers.DividendsEstimateController{}, "Get:ListDividendsIncentivesEstimate") // 返回业绩激励分红预算信息列表 | ||
21 | + web.Router("/dividends-estimates/search-dividends-incentives", &controllers.DividendsEstimateController{}, "Post:SearchDividendsIncentivesEstimate") // 搜索业绩激励分红预算信息列表 | ||
22 | + web.Router("/dividends-estimates/", &controllers.DividendsEstimateController{}, "Get:ListDividendsEstimate") // 返回分红预算单列表 | ||
22 | } | 23 | } |
-
请 注册 或 登录 后发表评论