作者 陈志颖

fix:修复共创合约参数

@@ -71,7 +71,7 @@ type CreateCooperationContractCommand struct { @@ -71,7 +71,7 @@ type CreateCooperationContractCommand struct {
71 // 承接方列表 71 // 承接方列表
72 Undertakers []*CreateUndertakersCommand `cname:"承接方列表" json:"undertakers,omitempty"` 72 Undertakers []*CreateUndertakersCommand `cname:"承接方列表" json:"undertakers,omitempty"`
73 // 相关人列表 73 // 相关人列表
74 - RelevantPeople []string `cname:"相关人列表" json:"relevantPeople,omitempty"` 74 + RelevantIds []string `cname:"相关人列表" json:"relevantIds,omitempty"`
75 // 公司ID,通过集成REST上下文获取 75 // 公司ID,通过集成REST上下文获取
76 CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` 76 CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
77 // 组织机构ID 77 // 组织机构ID
@@ -175,7 +175,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -175,7 +175,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
175 175
176 // 获取相关人 176 // 获取相关人
177 var relevantPeople []*domain.Relevant 177 var relevantPeople []*domain.Relevant
178 - for _, relevantPersonUid := range createCooperationContractCommand.RelevantPeople { 178 + for _, relevantPersonUid := range createCooperationContractCommand.RelevantIds {
179 var relevantDomain *domain.Relevant 179 var relevantDomain *domain.Relevant
180 relevantUid, _ := strconv.ParseInt(relevantPersonUid, 10, 64) 180 relevantUid, _ := strconv.ParseInt(relevantPersonUid, 10, 64)
181 if data, err := userService.RelevantFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, relevantUid); err != nil { 181 if data, err := userService.RelevantFrom(createCooperationContractCommand.CompanyId, createCooperationContractCommand.OrgId, relevantUid); err != nil {
1 package dto 1 package dto
2 2
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
  5 + "time"
  6 +)
  7 +
3 type DividendsIncentivesEstimateDto struct { 8 type DividendsIncentivesEstimateDto struct {
  9 + // 分红订单产品ID
  10 + OrderGoodId int64 `json:"orderGoodId,string"`
  11 + // 共创合约编号
  12 + CooperationContractNumber string `json:"cooperationContractNumber"`
  13 + // 分红订单号或退货单号、
  14 + OrderNumber string `json:"orderNumber"`
  15 + // 来源单号
  16 + OriginalOrderNum string `json:"originalOrderNum"`
  17 + // 客户名称
  18 + CustomerName string `json:"customerName"`
  19 + // 订单区域
  20 + RegionName string `json:"region"`
  21 + // 订单金额
  22 + OrderAmount float64 `json:"orderAmount"`
  23 + // 订单/退货单日期
  24 + OrderDate string `json:"orderDate"`
  25 +}
  26 +
  27 +func (dto *DividendsIncentivesEstimateDto) LoadDto(orderGood *domain.OrderGood, orderNumber string, originalOrderNum string, customerName string, regionName string, orderDate time.Time) error {
  28 + dto.OrderGoodId = orderGood.OrderGoodId
  29 + dto.CooperationContractNumber = orderGood.CooperationContractNumber
  30 + dto.OrderNumber = orderNumber
  31 + dto.OriginalOrderNum = originalOrderNum
  32 + dto.CustomerName = customerName
  33 + dto.RegionName = regionName
  34 + dto.OrderAmount = orderGood.OrderGoodAmount
  35 + dto.OrderDate = orderDate.String()
  36 + return nil
4 } 37 }
1 package dto 1 package dto
2 2
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
  5 + "time"
  6 +)
  7 +
  8 +type StageAndUndertaker struct {
  9 + // 分红阶段
  10 + Stage int32 `json:"stage"`
  11 +}
  12 +
3 type MoneyIncentivesEstimateDto struct { 13 type MoneyIncentivesEstimateDto struct {
  14 + // 共创合约ID
  15 + CooperationContractId int64 `json:"cooperationContractId,string"`
  16 + // 共创合约编号
  17 + CooperationContractNumber string `json:"cooperationContractNumber"`
  18 + // 共创合约名称
  19 + CooperationContractName string `json:"cooperationContractName"`
  20 + // 共创模式或者合伙模式
  21 + CooperationMode *domain.CooperationMode `json:"cooperationMode"`
  22 + // 共创合约发起部门
  23 + Department *domain.Department `json:"department"`
  24 + // 共创合约发起人
  25 + CooperationContractSponsor *domain.User `json:"cooperationContractSponsor"`
  26 + // 创建合约时间
  27 + CreatedAt time.Time `json:"createdAt"`
  28 + // 阶段和承接人
  29 + StageAndUndertaker *StageAndUndertaker `json:"stageAndUndertaker"`
  30 +}
  31 +
  32 +func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContract) error {
  33 + dto.CooperationContractId = contract.CooperationContractId
  34 + return nil
4 } 35 }
@@ -17,6 +17,48 @@ import ( @@ -17,6 +17,48 @@ import (
17 type DividendsEstimateService struct { 17 type DividendsEstimateService struct {
18 } 18 }
19 19
  20 +// ListDividendsIncentivesEstimate 返回业绩激励分红预算信息列表
  21 +func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentivesEstimate(listDividendsIncentivesEstimateQuery *query.ListDividendsIncentivesEstimateQuery) (interface{}, error) {
  22 + if err := listDividendsIncentivesEstimateQuery.ValidateQuery(); err != nil {
  23 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  24 + }
  25 + transactionContext, err := factory.CreateTransactionContext(nil)
  26 + if err != nil {
  27 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  28 + }
  29 + if err := transactionContext.StartTransaction(); err != nil {
  30 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  31 + }
  32 + defer func() {
  33 + _ = transactionContext.RollbackTransaction()
  34 + }()
  35 + if err := transactionContext.CommitTransaction(); err != nil {
  36 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  37 + }
  38 + return nil, nil
  39 +}
  40 +
  41 +// ListMoneyIncentivesEstimate 返回金额激励分红预算信息列表
  42 +func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentivesEstimate(listMoneyIncentivesEstimateQuery *query.ListMoneyIncentivesEstimateQuery) (interface{}, error) {
  43 + if err := listMoneyIncentivesEstimateQuery.ValidateQuery(); 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 +
20 // CancelDividendsEstimate 取消分红预算单 62 // CancelDividendsEstimate 取消分红预算单
21 func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimate(cancelDividendsEstimateCommand *command.CancelDividendsEstimateCommand) (interface{}, error) { 63 func (dividendsEstimateService *DividendsEstimateService) CancelDividendsEstimate(cancelDividendsEstimateCommand *command.CancelDividendsEstimateCommand) (interface{}, error) {
22 if err := cancelDividendsEstimateCommand.ValidateCommand(); err != nil { 64 if err := cancelDividendsEstimateCommand.ValidateCommand(); err != nil {
@@ -278,48 +320,6 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsEstimate( @@ -278,48 +320,6 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsEstimate(
278 } 320 }
279 } 321 }
280 322
281 -// ListDividendsIncentivesEstimate 返回业绩激励分红预算列表  
282 -func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentivesEstimate(listDividendsIncentivesEstimateQuery *query.ListDividendsIncentivesEstimateQuery) (interface{}, error) {  
283 - if err := listDividendsIncentivesEstimateQuery.ValidateQuery(); err != nil {  
284 - return nil, application.ThrowError(application.ARG_ERROR, err.Error())  
285 - }  
286 - transactionContext, err := factory.CreateTransactionContext(nil)  
287 - if err != nil {  
288 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
289 - }  
290 - if err := transactionContext.StartTransaction(); err != nil {  
291 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
292 - }  
293 - defer func() {  
294 - _ = transactionContext.RollbackTransaction()  
295 - }()  
296 - if err := transactionContext.CommitTransaction(); err != nil {  
297 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
298 - }  
299 - return nil, nil  
300 -}  
301 -  
302 -// ListMoneyIncentivesEstimate 返回金额激励分红预算列表  
303 -func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentivesEstimate(listMoneyIncentivesEstimateQuery *query.ListMoneyIncentivesEstimateQuery) (interface{}, error) {  
304 - if err := listMoneyIncentivesEstimateQuery.ValidateQuery(); err != nil {  
305 - return nil, application.ThrowError(application.ARG_ERROR, err.Error())  
306 - }  
307 - transactionContext, err := factory.CreateTransactionContext(nil)  
308 - if err != nil {  
309 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
310 - }  
311 - if err := transactionContext.StartTransaction(); err != nil {  
312 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
313 - }  
314 - defer func() {  
315 - _ = transactionContext.RollbackTransaction()  
316 - }()  
317 - if err := transactionContext.CommitTransaction(); err != nil {  
318 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
319 - }  
320 - return nil, nil  
321 -}  
322 -  
323 // RemoveDividendsEstimate 移除分红预算单(预留) 323 // RemoveDividendsEstimate 移除分红预算单(预留)
324 func (dividendsEstimateService *DividendsEstimateService) RemoveDividendsEstimate(removeDividendsEstimateCommand *command.RemoveDividendsEstimateCommand) (interface{}, error) { 324 func (dividendsEstimateService *DividendsEstimateService) RemoveDividendsEstimate(removeDividendsEstimateCommand *command.RemoveDividendsEstimateCommand) (interface{}, error) {
325 if err := removeDividendsEstimateCommand.ValidateCommand(); err != nil { 325 if err := removeDividendsEstimateCommand.ValidateCommand(); err != nil {
@@ -28,6 +28,8 @@ type CooperationContract struct { @@ -28,6 +28,8 @@ type CooperationContract struct {
28 Org *Org `json:"org"` 28 Org *Org `json:"org"`
29 // 公司 29 // 公司
30 Company *Company `json:"company"` 30 Company *Company `json:"company"`
  31 + // 共创合约发起部门
  32 + Department *Department `json:"department"`
31 // 操作人 33 // 操作人
32 Operator *User `json:"operator"` 34 Operator *User `json:"operator"`
33 // 分红激励规则 35 // 分红激励规则
@@ -29,6 +29,8 @@ type CooperationContract struct { @@ -29,6 +29,8 @@ type CooperationContract struct {
29 Org *domain.Org `comment:"数据所属组织机构"` 29 Org *domain.Org `comment:"数据所属组织机构"`
30 // 公司 30 // 公司
31 Company *domain.Company `comment:"公司"` 31 Company *domain.Company `comment:"公司"`
  32 + // 共创合约发起部门
  33 + Department *domain.Department `comment:"共创合约发起部门"`
32 // 操作人 34 // 操作人
33 Operator *domain.User `comment:"操作人"` 35 Operator *domain.User `comment:"操作人"`
34 // 操作时间 36 // 操作时间
@@ -120,6 +120,7 @@ func TransformToCooperationContractDomainModelFromPgModels( @@ -120,6 +120,7 @@ func TransformToCooperationContractDomainModelFromPgModels(
120 Status: cooperationContractModel.Status, 120 Status: cooperationContractModel.Status,
121 Org: cooperationContractModel.Org, 121 Org: cooperationContractModel.Org,
122 Company: cooperationContractModel.Company, 122 Company: cooperationContractModel.Company,
  123 + Department: cooperationContractModel.Department,
123 Operator: cooperationContractModel.Operator, 124 Operator: cooperationContractModel.Operator,
124 OperateTime: cooperationContractModel.OperateTime, 125 OperateTime: cooperationContractModel.OperateTime,
125 CreatedAt: cooperationContractModel.CreatedAt, 126 CreatedAt: cooperationContractModel.CreatedAt,