作者 陈志颖

feat:共创合约模型和仓储调整

package domain
import "time"
import (
"time"
)
// CooperationContract 共创项目合约实体
type CooperationContract struct {
... ... @@ -30,6 +32,10 @@ type CooperationContract struct {
Company *Company `json:"company"`
// 操作人
Operator *User `json:"operator"`
// 分红激励规则
DividendsIncentivesRules []*DividendsIncentivesRule `json:"dividendsIncentivesRules"`
// 金额激励规则
MoneyIncentivesRules []*MoneyIncentivesRule `json:"moneyIncentivesRules"`
// 操作时间
OperateTime time.Time `json:"operateTime"`
// 创建时间
... ...
... ... @@ -17,8 +17,8 @@ type ContractUndertakerFeedback struct {
CooperationContractNumber string `comment:"共创合约编号"`
// 共创合约承接人
ContractUndertaker *domain.User `comment:"共创合约承接人"`
// 共创模式
CooperationMode *domain.CooperationMode `comment:"共创模式"`
// 共创模式编号
CooperationModeNumber string `comment:"共创模式编号"`
// 数据所属组织机构
Org *domain.Org `comment:"数据所属组织机构"`
// 公司
... ...
... ... @@ -26,7 +26,7 @@ type CooperationApplication struct {
// 共创申请时间
CooperationApplyTime time.Time `comment:"共创申请时间"`
// 共创项目编号
CooperationProject *domain.CooperationProject `comment:"共创项目编号"`
CooperationProjectNumber string `comment:"共创项目编号"`
// 数据所属组织机构
Org *domain.Org `comment:"数据所属组织机构"`
// 公司
... ...
... ... @@ -23,8 +23,8 @@ type CooperationContract struct {
CooperationContractUndertakerType []int32 `comment:"共创合约承接对象,1员工,2共创用户,3公开" pg:",array"`
// 共创合约发起人
CooperationContractSponsor *domain.User `comment:"共创合约发起人"`
// 共创模式或者合伙模式
CooperationMode *domain.CooperationMode `comment:"共创模式或者合伙模式"`
// 共创模式编号
CooperationModeNumber string `comment:"共创模式编号"`
// 合约状态,1启用,2禁用
Status int32 `comment:"合约状态,1启用,2禁用"`
// 数据所属组织机构
... ...
package models
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"time"
)
type DividendsOrder struct {
tableName string `comment:"分红订单实体" pg:"dividends_orders,alias:dividends_order"`
// 分红订单ID
... ... @@ -11,7 +16,7 @@ type DividendsOrder struct {
// 分红订单金额
DividendsOrderAmount float64 `comment:"分红订单金额"`
// 订单业务员
OrderSalesman *User `comment:"订单业务员"`
OrderSalesman *domain.User `comment:"订单业务员"`
// 订单产生时间
OrderTime time.Time `comment:"订单产生时间"`
// 分红订单分红时间
... ... @@ -19,13 +24,13 @@ type DividendsOrder struct {
// 分红订单分红状态,1待分红,2已分红,3部分分红
DividendStatus int32 `comment:"分红订单分红状态,1待分红,2已分红,3部分分红"`
// 区域
Region *RegionInfo `comment:"区域"`
Region *domain.RegionInfo `comment:"区域"`
// 客户姓名
CustomerName string `comment:"客户姓名"`
// 数据所属组织机构
Org *Org `comment:"数据所属组织机构"`
Org *domain.Org `comment:"数据所属组织机构"`
// 公司
Company *Company `comment:"公司"`
Company *domain.Company `comment:"公司"`
// 创建时间
CreatedAt time.Time `comment:"创建时间"`
// 删除时间
... ... @@ -35,5 +40,5 @@ type DividendsOrder struct {
// 操作时间
OperateTime time.Time `comment:"操作时间"`
// 操作人
Operator *User `comment:"操作人"`
Operator *domain.User `comment:"操作人"`
}
... ...
... ... @@ -8,7 +8,7 @@ import (
type MoneyIncentivesRule struct {
tableName string `comment:"金额激励规则实体" pg:"money_incentives_rules,alias:money_incentives_rule"`
// 金额激励规则ID
MoneyIncentivesRuleId int64 `comment:"金额激励规则ID" pg:",pk"`
MoneyIncentivesRuleId int64 `comment:"金额激励规则ID" pg:",pk:money_incentives_rule_id"`
// 关联的共创合约编号
CooperationContractNumber string `comment:"关联的共创合约编号"`
// 激励金额
... ...
... ... @@ -5,14 +5,29 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
)
func TransformToContractUndertakerFeedbackDomainModelFromPgModels(contractUndertakerFeedbackModel *models.ContractUndertakerFeedback) (*domain.ContractUndertakerFeedback, error) {
func TransformToContractUndertakerFeedbackDomainModelFromPgModels(
contractUndertakerFeedbackModel *models.ContractUndertakerFeedback,
cooperationMode *models.CooperationMode) (*domain.ContractUndertakerFeedback, error) {
return &domain.ContractUndertakerFeedback{
FeedbackId: contractUndertakerFeedbackModel.FeedbackId,
FeedbackAttachment: contractUndertakerFeedbackModel.FeedbackAttachment,
FeedbackContent: contractUndertakerFeedbackModel.FeedbackContent,
CooperationContractNumber: contractUndertakerFeedbackModel.CooperationContractNumber,
ContractUndertaker: contractUndertakerFeedbackModel.ContractUndertaker,
CooperationMode: contractUndertakerFeedbackModel.CooperationMode,
CooperationMode: &domain.CooperationMode{
CooperationModeId: cooperationMode.CooperationModeId,
CooperationModeNumber: cooperationMode.CooperationModeNumber,
CooperationModeName: cooperationMode.CooperationModeName,
Status: cooperationMode.Status,
Org: cooperationMode.Org,
Company: cooperationMode.Company,
Remarks: cooperationMode.Remarks,
Operator: cooperationMode.Operator,
OperateTime: cooperationMode.OperateTime,
UpdatedAt: cooperationMode.UpdatedAt,
DeletedAt: cooperationMode.DeletedAt,
CreatedAt: cooperationMode.CreatedAt,
},
Org: contractUndertakerFeedbackModel.Org,
Company: contractUndertakerFeedbackModel.Company,
UpdatedAt: contractUndertakerFeedbackModel.UpdatedAt,
... ...
... ... @@ -5,7 +5,9 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
)
func TransformToCooperationApplicationDomainModelFromPgModels(cooperationApplicationModel *models.CooperationApplication) (*domain.CooperationApplication, error) {
func TransformToCooperationApplicationDomainModelFromPgModels(
cooperationApplicationModel *models.CooperationApplication,
cooperationProject *models.CooperationProject) (*domain.CooperationApplication, error) {
return &domain.CooperationApplication{
CooperationApplicationId: cooperationApplicationModel.CooperationApplicationId,
CooperationApplicationApplicant: cooperationApplicationModel.CooperationApplicationApplicant,
... ... @@ -16,7 +18,24 @@ func TransformToCooperationApplicationDomainModelFromPgModels(cooperationApplica
CooperationApplicationVerifyDescription: cooperationApplicationModel.CooperationApplicationVerifyDescription,
CooperationApplicationVerifyTime: cooperationApplicationModel.CooperationApplicationVerifyTime,
CooperationApplyTime: cooperationApplicationModel.CooperationApplyTime,
CooperationProject: cooperationApplicationModel.CooperationProject,
CooperationProject: &domain.CooperationProject{
CooperationProjectId: cooperationProject.CooperationProjectId,
CooperationProjectNumber: cooperationProject.CooperationProjectNumber,
CooperationProjectDescription: cooperationProject.CooperationProjectDescription,
CooperationProjectName: cooperationProject.CooperationProjectName,
CooperationProjectPublishTime: cooperationProject.CooperationProjectPublishTime,
CooperationProjectPublisher: cooperationProject.CooperationProjectPublisher,
CooperationProjectSponsor: cooperationProject.CooperationProjectSponsor,
CooperationProjectUndertakerType: cooperationProject.CooperationProjectUndertakerType,
Org: cooperationProject.Org,
Company: cooperationProject.Company,
Operator: cooperationProject.Operator,
OperateTime: cooperationProject.OperateTime,
Status: cooperationProject.Status,
UpdatedAt: cooperationProject.UpdatedAt,
DeletedAt: cooperationProject.DeletedAt,
CreatedAt: cooperationProject.CreatedAt,
},
Org: cooperationApplicationModel.Org,
Company: cooperationApplicationModel.Company,
CreatedAt: cooperationApplicationModel.CreatedAt,
... ...
... ... @@ -5,7 +5,51 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
)
func TransformToCooperationContractDomainModelFromPgModels(cooperationContractModel *models.CooperationContract) (*domain.CooperationContract, error) {
func TransformToCooperationContractDomainModelFromPgModels(
cooperationContractModel *models.CooperationContract,
cooperationMode *models.CooperationMode,
dividendsIncentivesRules []*models.DividendsIncentivesRule,
moneyIncentivesRules []*models.MoneyIncentivesRule) (*domain.CooperationContract, error) {
var dividendsIncentivesRulesDomain []*domain.DividendsIncentivesRule
for _, rule := range dividendsIncentivesRules {
dividendsIncentivesRulesDomain = append(dividendsIncentivesRulesDomain, &domain.DividendsIncentivesRule{
DividendsIncentivesRuleId: rule.DividendsIncentivesRuleId,
CooperationContractNumber: rule.CooperationContractNumber,
ReferrerPercentage: rule.ReferrerPercentage,
SalesmanPercentage: rule.SalesmanPercentage,
DividendsIncentivesPercentage: rule.DividendsIncentivesPercentage,
DividendsIncentivesStage: rule.DividendsIncentivesStage,
DividendsIncentivesStageEnd: rule.DividendsIncentivesStageEnd,
DividendsIncentivesStageStart: rule.DividendsIncentivesStageStart,
Org: rule.Org,
Company: rule.Company,
UpdatedAt: rule.UpdatedAt,
DeletedAt: rule.DeletedAt,
CreatedAt: rule.CreatedAt,
})
}
var moneyIncentivesRulesDomain []*domain.MoneyIncentivesRule
for _, rule := range moneyIncentivesRules {
moneyIncentivesRulesDomain = append(moneyIncentivesRulesDomain, &domain.MoneyIncentivesRule{
MoneyIncentivesRuleId: rule.MoneyIncentivesRuleId,
CooperationContractNumber: rule.CooperationContractNumber,
MoneyIncentivesAmount: rule.MoneyIncentivesAmount,
MoneyIncentivesStage: rule.MoneyIncentivesStage,
MoneyIncentivesStageEnd: rule.MoneyIncentivesStageEnd,
MoneyIncentivesStageStart: rule.MoneyIncentivesStageStart,
MoneyIncentivesTime: rule.MoneyIncentivesTime,
ReferrerPercentage: rule.ReferrerPercentage,
SalesmanPercentage: rule.SalesmanPercentage,
Org: rule.Org,
Company: rule.Company,
UpdatedAt: rule.UpdatedAt,
DeletedAt: rule.DeletedAt,
CreatedAt: rule.CreatedAt,
})
}
return &domain.CooperationContract{
CooperationContractId: cooperationContractModel.CooperationContractId,
CooperationContractDescription: cooperationContractModel.CooperationContractDescription,
... ... @@ -15,7 +59,22 @@ func TransformToCooperationContractDomainModelFromPgModels(cooperationContractMo
CooperationContractSalesman: cooperationContractModel.CooperationContractSalesman,
CooperationContractUndertakerType: cooperationContractModel.CooperationContractUndertakerType,
CooperationContractSponsor: cooperationContractModel.CooperationContractSponsor,
CooperationMode: cooperationContractModel.CooperationMode,
CooperationMode: &domain.CooperationMode{
CooperationModeId: cooperationMode.CooperationModeId,
CooperationModeNumber: cooperationMode.CooperationModeNumber,
CooperationModeName: cooperationMode.CooperationModeName,
Status: cooperationMode.Status,
Org: cooperationMode.Org,
Company: cooperationMode.Company,
Remarks: cooperationMode.Remarks,
Operator: cooperationMode.Operator,
OperateTime: cooperationMode.OperateTime,
UpdatedAt: cooperationMode.UpdatedAt,
DeletedAt: cooperationMode.DeletedAt,
CreatedAt: cooperationMode.CreatedAt,
},
DividendsIncentivesRules: dividendsIncentivesRulesDomain,
MoneyIncentivesRules: moneyIncentivesRulesDomain,
Status: cooperationContractModel.Status,
Org: cooperationContractModel.Org,
Company: cooperationContractModel.Company,
... ...