param_cooperation_contract.go 13.9 KB
package allied_creation_cooperation

import (
	"time"

	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)

type CooperationContract struct {
	CooperationContractId              int    `json:"cooperationContractId,string,"`  // 共创合约ID
	CooperationContractDescription     string `json:"cooperationContractDescription"` // 共创合约描述
	CooperationContractName            string `json:"cooperationContractName"`        // 共创合约名称
	CooperationContractNumber          string `json:"cooperationContractNumber"`      // 共创合约编号
	CooperationProjectNumber           string `json:"cooperationProjectNumber"`
	CooperationContractUndertakerTypes []int  `json:"cooperationContractUndertakerType"` // 共创合约承接对象,1员工,2共创用户,3公开
	Department                         struct {
		DepartmentId   int    `json:"departmentId"`
		DepartmentName string `json:"departmentName"`
	} `jsopn:"department" json:"department"` //发起部门
	CooperationContractSponsor struct {
		UserId   int `json:"userId"` //id
		UserInfo struct {
			UserAvatar  string `json:"userAvatar"`  // 用户头像
			UserEmail   string `json:"userEmail"`   // 用户邮箱
			UserName    string `json:"userName"`    // 共创人员姓名
			UserPhone   string `json:"userPhone"`   // 用户手机号
			UserAccount string `json:"userAccount"` // 用户账号,区别于手机号,冗余字段
		} `json:"userInfo"`
		Department struct {
			DepartmentId     int64  `json:"departmentId,string,"` // 部门ID,通过REST集成上下文获取
			DepartmentName   string `json:"departmentName"`       // 部门名称
			DepartmentNumber string `json:"departmentNumber"`     // 部门编码
		} `json:"department"` //申请人部门
		Org struct {
			OrgId   int64  `json:"orgId,string,"` // 组织机构ID
			OrgName string `json:"orgName"`       // 组织名称
		} `json:"org"`
		UserType  int    `json:"userType"`
		UserName  string `json:"userName"`
		UserPhone string `json:"userPhone"`
	} `json:"cooperationContractSponsor"` // 共创合约发起人
	CooperationMode domain.CooperationMode `json:"cooperationMode"` // 共创模式或者合伙模式
	Status          int                    `json:"status"`          // 合约状态,1启用,2禁用
	Org             struct {
		OrgId   int64  `json:"orgId,string,"` // 组织机构ID
		OrgName string `json:"orgName"`       // 组织名称
	} `json:"org"` // 数据所属组织机构
	Company struct {
		CompanyId   int64  `json:"companyId,string,"` // 公司ID
		CompanyLogo string `json:"companyLogo"`       // 公司logo
		CompanyName string `json:"companyName"`       // 公司名称
	} `json:"company"` // 公司
	DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 分红激励规则
	MoneyIncentivesRules     []MoneyIncentivesRule     `json:"moneyIncentivesRules"`     // 金额激励规则
	Undertakers              []struct {
		ContractAttachment []domain.Attachment `json:"contractAttachment"`
		UserId             int                 `json:"userId"`
		UserInfo           struct {
			UserAvatar  string `json:"userAvatar"`  // 用户头像
			UserEmail   string `json:"userEmail"`   // 用户邮箱
			UserName    string `json:"userName"`    // 共创人员姓名
			UserPhone   string `json:"userPhone"`   // 用户手机号
			UserAccount string `json:"userAccount"` // 用户账号,区别于手机号,冗余字段
		} `json:"userInfo"`
		Department struct {
			DepartmentId     int64  `json:"departmentId,string,"` // 部门ID
			DepartmentName   string `json:"departmentName"`       // 部门名称
			DepartmentNumber string `json:"departmentNumber"`     // 部门编码
		} `json:"department"` //申请人部门
		Org struct {
			OrgId   int64  `json:"orgId,string,"` // 组织机构ID
			OrgName string `json:"orgName"`       // 组织名称
		} `json:"org"`
		UserType  int    `json:"userType"`
		UserName  string `json:"userName"`
		UserPhone string `json:"userPhone"`
		Referrer  struct {
			UserId   int `json:"userId"`
			UserInfo struct {
				UserAvatar  string `json:"userAvatar"`  // 用户头像
				UserEmail   string `json:"userEmail"`   // 用户邮箱
				UserName    string `json:"userName"`    // 共创人员姓名
				UserPhone   string `json:"userPhone"`   // 用户手机号
				UserAccount string `json:"userAccount"` // 用户账号,区别于手机号,冗余字段
			} `json:"userInfo"`
		} `json:"referrer"`
		Salesman struct {
			UserId   int `json:"userId"`
			UserInfo struct {
				UserAvatar  string `json:"userAvatar"`  // 用户头像
				UserEmail   string `json:"userEmail"`   // 用户邮箱
				UserName    string `json:"userName"`    // 共创人员姓名
				UserPhone   string `json:"userPhone"`   // 用户手机号
				UserAccount string `json:"userAccount"` // 用户账号,区别于手机号,冗余字段
			} `json:"userInfo"`
		} `json:"salesman"`
	} `json:"undertakers"` // 共创承接人列表
	RelevantPeople []struct {
		RelevantId                int    `json:"relevantId,string,"`
		CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
		UserId                    int64  `json:"userId,string,"`
		UserBaseId                int    `json:"userBaseId,string,"`
		Org                       struct {
			OrgId   int64  `json:"orgId,string,"` // 组织机构ID
			OrgName string `json:"orgName"`       // 组织名称
		} `json:"org"`
		UserInfo   domain.UserInfo `json:"userInfo"`
		Department struct {
			DepartmentId     int64  `json:"departmentId,string,"` // 部门ID
			DepartmentName   string `json:"departmentName"`       // 部门名称
			DepartmentNumber string `json:"departmentNumber"`     // 部门编码
		} `json:"department"` //申请人部门
	} `json:"relevantPeople"` // 共创合约相关人列表
	OperateTime time.Time `json:"operateTime"` // 操作时间
	CreatedAt   time.Time `json:"createdAt"`   // 创建时间
	UpdatedAt   time.Time `json:"updatedAt"`   // 更新时间
}

//创建共创合约
type (
	//分红激励规则
	DividendsIncentivesRule struct {
		DividendsIncentivesRuleId     int       `json:"dividendsIncentivesRuleId"`
		CooperationContractNumber     string    `json:"cooperationContractNumber"`        // 关联的项目合约编号
		ReferrerPercentage            float64   `json:"referrerPercentage"`               // 推荐人抽成比例
		SalesmanPercentage            float64   `json:"salesmanPercentage"`               // 业务员抽成比例
		DividendsIncentivesPercentage float64   `json:"dividendsIncentivesPercentage"`    // 分红规则激励百分点
		DividendsIncentivesStage      int64     `json:"dividendsIncentivesStage,string,"` // 分红规则激励阶段,
		DividendsIncentivesStageEnd   time.Time `json:"dividendsIncentivesStageEnd"`      // 分红规则激励阶段结束
		DividendsIncentivesStageStart time.Time `json:"dividendsIncentivesStageStart"`    // 分红规则激励阶段开始
	}
	//金额激励规则
	MoneyIncentivesRule struct {
		MoneyIncentivesRuleId     int       `json:"moneyIncentivesRuleId,string"` // 金额激励规则ID
		CooperationContractNumber string    `json:"cooperationContractNumber"`    // 关联的共创合约编号
		MoneyIncentivesAmount     float64   `json:"moneyIncentivesAmount"`        // 激励金额
		MoneyIncentivesStage      int       `json:"moneyIncentivesStage"`         // 金额激励阶段
		MoneyIncentivesTime       time.Time `json:"moneyIncentivesTime"`          // 金额激励规则时间
		ReferrerPercentage        float64   `json:"referrerPercentage"`           // 推荐人抽成比例
		SalesmanPercentage        float64   `json:"salesmanPercentage"`           // 业务员抽成比例
	}

	//合约承接方
	Undertaker struct {
		UndertakerId string            `json:"undertakerId"` //承接人用户id
		RerferrerId  string            `json:"rerferrerId"`  //推荐人用户id
		SalesmanId   string            `json:"salesmanId"`   //关联业务员id
		Attachment   domain.Attachment `json:"attachment"`
	}

	ReqCooperationContractAdd struct {
		CooperationContractDescription    string                    `json:"cooperationContractDescription"`     // 共创合约描述
		CooperationContractNumber         string                    `json:"cooperationContractNumber"`          // 共创合约编号
		CooperationProjectNumber          string                    `json:"cooperationProjectNumber"`           // 共创项目编号,
		DepartmentId                      string                    `json:"departmentId"`                       // 共创合约发起部门id
		CooperationContractUndertakerType []int                     `json:"cooperationContractUndertakerTypes"` // 共创合约承接对象,1员工,2共创用户,3公开
		CooperationContractName           string                    `json:"cooperationContractName"`            // 共创合约名称
		CooperationModeNumber             string                    `json:"cooperationModeNumber"`              // 共创模式编码,
		SponsorUid                        string                    `json:"sponsorUid"`                         // 共创合约发起人uid
		DividendsIncentivesRules          []DividendsIncentivesRule `json:"dividendsIncentivesRules"`           // 业绩分红激励规则列表
		MoneyIncentivesRules              []MoneyIncentivesRule     `json:"moneyIncentivesRules"`               // 金额激励规则列表
		Undertakers                       []Undertaker              `json:"undertakers"`                        // 承接方列表
		RelevantIds                       []string                  `json:"relevantIds"`                        //关联业务员
		CompanyId                         int                       `json:"-"`
		OrgId                             int                       `json:"-"`  // 组织机构ID
		UserId                            int                       `json:"-"`  // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
		UserBaseId                        int                       `json:"-" ` // 用户基础数据id
	}

	DataCooperationContractAdd struct {
		CooperationContract
	}
)

//更新共创合约
type (
	ReqCooperationContractUpdate struct {
		CooperationContractId             int                       `json:"cooperationContractId"`             // 共创合约id
		CooperationContractDescription    string                    `json:"cooperationContractDescription"`    //共创
		CooperationContractNumber         string                    `json:"cooperationContractNumber"`         // 共创合约编号
		CooperationProjectNumber          string                    `json:"cooperationProjectNumber"`          // 共创项目编号,
		DepartmentId                      string                    `json:"departmentId"`                      // 共创合约发起部门id
		CooperationContractUndertakerType []int                     `json:"cooperationContractUndertakerType"` // 共创合约承接对象,1员工,2共创用户,3公开
		CooperationContractName           string                    `json:"cooperationContractName"`           // 共创合约名称
		CooperationModeNumber             string                    `json:"cooperationModeNumber"`             // 共创模式编码,
		SponsorUid                        string                    `json:"sponsorUid,omitempty,"`             // 共创合约发起人uid
		DividendsIncentivesRules          []DividendsIncentivesRule `json:"dividendsIncentivesRules"`          // 金额激励规则列表
		MoneyIncentivesRules              []MoneyIncentivesRule     `json:"moneyIncentivesRules"`
		Undertakers                       []Undertaker              `json:"undertakers"` // 承接方列表		// 业绩分红激励规则列表
		RelevantIds                       []string                  `json:"relevantIds"` //关联业务员
		CompanyId                         int                       `json:"companyId,string"`
		OrgId                             int                       `json:"orgId,string"`       // 组织机构ID
		UserId                            int                       ` json:"userId,string"`     // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
		UserBaseId                        int                       `json:"userBaseId,string" ` // 用户基础数据id
	}

	DataCooperationContractUpdate struct {
		CooperationContract
	}
)

//查询共创合约
type (
	ReqCooperationContractSearch struct {
		// 查询偏离量
		PageNumber int `json:"pageNumber"`
		// 查询限制
		PageSize                  int    `json:"pageSize"`
		CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
		SponsorName               string `json:"sponsorName"`               //发起人名字
	}

	DataCooperationContractSearch struct {
		Grid struct {
			Total int                   `json:"total"`
			List  []CooperationContract `json:"list"`
		} `json:"grid"`
	}
)

//根据承接人查询并返回共创项目合约
type (
	ReqCooperationContractSearchByUndertaker struct {
		CooperationContractName string `json:"cooperationContractName"` //合约名称
		SponsorName             string `json:"sponsorName"`             //项目发起人姓名
		PageNumber              int    `json:"pageNumber"`
		PageIndex               int    `json:"pageIndex"`
	}

	DataCooperationContractSearchByUndertaker struct {
	}
)

//移除共创合约
type (
	ReqCooperationContractRemove struct {
		CooperationContractId int `json:"cooperationContractId"`
	}

	DataCooperationContractRemove struct {
		CooperationContract
	}
)

//返回共创合约列表
type (
	ReqCooperationContractList struct {
	}

	DataCooperationContractList struct {
	}
)

//返回共创合约详情
type (
	ReqCooperationContractGet struct {
		CooperationContractId int `json:"cooperationContractId"`
	}

	DataCooperationContractGet struct {
		CooperationContract
		// 可以去除勾选的共创项目承接对象列表
		UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"`
	}
)