money_incentives_estimate_dto.go 1.6 KB
package dto

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
	"time"
)

type StageAndUndertaker struct {
	// 分红阶段
	Stage int32 `json:"stage"`
	// 共创承接人
	Undertakers []*domain.Undertaker `json:"undertakers"`
}

type MoneyIncentivesEstimateDto struct {
	// 共创合约ID
	CooperationContractId int64 `json:"cooperationContractId,string"`
	// 共创合约编号
	CooperationContractNumber string `json:"cooperationContractNumber"`
	// 共创合约名称
	CooperationContractName string `json:"cooperationContractName"`
	// 共创模式或者合伙模式
	CooperationModeName string `json:"cooperationMode"`
	// 共创合约发起部门
	Department *domain.Department `json:"department"`
	// 共创合约发起人
	CooperationContractSponsorName string `json:"cooperationContractSponsor"`
	// 创建合约时间
	CreatedAt time.Time `json:"createdAt"`
	// 阶段和承接人
	StageAndUndertaker []*StageAndUndertaker `json:"stageAndUndertaker"`
}

func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContract, stageAndUndertaker []*StageAndUndertaker) error {
	dto.CooperationContractId = contract.CooperationContractId
	dto.CooperationContractNumber = contract.CooperationContractNumber
	dto.CooperationContractName = contract.CooperationContractName
	dto.CooperationModeName = contract.CooperationMode.CooperationModeName
	dto.Department = contract.Department
	dto.CooperationContractSponsorName = contract.CooperationContractSponsor.UserName
	dto.CreatedAt = contract.CreatedAt
	dto.StageAndUndertaker = stageAndUndertaker
	return nil
}