作者 yangfu
... ... @@ -7,9 +7,9 @@ metadata:
k8s-app: allied-creation-gateway
spec:
ports:
- name: "http"
port: 80
targetPort: 8082
- name: "http"
port: 80
targetPort: 8082
selector:
k8s-app: allied-creation-gateway
---
... ... @@ -43,74 +43,78 @@ spec:
- cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
- cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
containers:
- name: allied-creation-gateway
image: 192.168.0.243:5000/mmm/allied-creation-gateway:dev
imagePullPolicy: Always
ports:
- containerPort: 8082
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
env:
- name: POSTGRESQL_DB_NAME
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresqlalliedcreation.dbname
- name: POSTGRESQL_USER
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.user
- name: POSTGRESQL_PASSWORD
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.password
- name: POSTGRESQL_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.host
- name: POSTGRESQL_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.port
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.ip
- name: REDIS_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.port
- name: REDIS_AUTH
value: ""
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: ENABLE_KAFKA_LOG
value: "true"
- name: HTTP_PORT
value: "8082"
- name: ALLIED_CREATION_USER_HOST
value: "http://allied-creation-user-dev.fjmaimaimai.com"
# - name: REDIS_HOST
# valueFrom:
# configMapKeyRef:
# name: suplus-config
# key: redis.ip
# - name: REDIS_PORT
# valueFrom:
# configMapKeyRef:
# name: suplus-config
# key: redis.port
- name: allied-creation-gateway
image: 192.168.0.243:5000/mmm/allied-creation-gateway:dev
imagePullPolicy: Always
ports:
- containerPort: 8082
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
env:
- name: POSTGRESQL_DB_NAME
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresqlalliedcreation.dbname
- name: POSTGRESQL_USER
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.user
- name: POSTGRESQL_PASSWORD
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.password
- name: POSTGRESQL_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.host
- name: POSTGRESQL_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: postgresql.port
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.ip
- name: REDIS_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.port
- name: REDIS_AUTH
value: ""
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: ENABLE_KAFKA_LOG
value: "true"
- name: HTTP_PORT
value: "8082"
- name: ALLIED_CREATION_USER_HOST
value: "http://allied-creation-user-dev.fjmaimaimai.com"
- name: ALLIED_CREATION_COOPERATION_HOST
value: "http://allied-creation-cooperation-dev.fjmaimaimai.com/"
- name: SMS_SERVE_HOST
value: "https://sms.fjmaimaimai.com:9897"
# - name: REDIS_HOST
# valueFrom:
# configMapKeyRef:
# name: suplus-config
# key: redis.ip
# - name: REDIS_PORT
# valueFrom:
# configMapKeyRef:
# name: suplus-config
# key: redis.port
volumes:
- name: accesslogs
emptyDir: {}
\ No newline at end of file
- name: accesslogs
emptyDir: {}
... ...
... ... @@ -7,9 +7,9 @@ metadata:
k8s-app: project
spec:
ports:
- name: "http"
port: 80
targetPort: 8082
- name: "http"
port: 80
targetPort: 8082
selector:
k8s-app: project
---
... ... @@ -43,21 +43,21 @@ spec:
- cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
- cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
containers:
- name: project
image: 192.168.0.243:5000/mmm/project:dev
imagePullPolicy: Always
ports:
- containerPort: 8082
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
env:
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: project
image: 192.168.0.243:5000/mmm/project:dev
imagePullPolicy: Always
ports:
- containerPort: 8082
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
env:
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
value: "1"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
volumes:
- name: accesslogs
emptyDir: {}
\ No newline at end of file
- name: accesslogs
emptyDir: {}
... ...
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628574006679578700}
\ No newline at end of file
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628731667364868600}
\ No newline at end of file
... ...
... ... @@ -15,7 +15,7 @@ type EndCooperationProjectCommand struct {
}
func (endCooperationProjectCommand *EndCooperationProjectCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (endCooperationProjectCommand *EndCooperationProjectCommand) ValidateCommand() error {
... ...
... ... @@ -29,7 +29,6 @@ type UpdateCooperationProjectCommand struct {
}
func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) ValidateCommand() error {
... ...
... ... @@ -5,13 +5,71 @@ import (
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
type UpdateCooperationContractCommand struct {
//操作人
Operator domain.Operator `json:"-"`
allied_creation_cooperation.ReqCooperationContractUpdate
Operator domain.Operator `json:"-"`
CooperationContractId int `json:"cooperationContractId"`
// 共创合约描述
CooperationContractDescription string `json:"cooperationContractDescription"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 共创项目编号,
CooperationProjectNumber string `json:"cooperationProjectNumber"`
// 共创合约发起部门id
DepartmentId string `json:"departmentId"`
// 共创合约承接对象,1员工,2共创用户,3公开
CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"`
// 共创合约名称
CooperationContractName string `json:"cooperationContractName"`
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 共创合约发起人uid
SponsorUid string `json:"sponsorUid"`
// 业绩分红激励规则列表
DividendsIncentivesRules []struct {
// 关联的项目合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 推荐人抽成比例
ReferrerPercentage float64 `json:"referrerPercentage"`
// 业务员抽成比例
SalesmanPercentage float64 `json:"salesmanPercentage"`
// 分红规则激励百分点
DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"`
// 分红规则激励阶段,
DividendsIncentivesStage int64 `json:"dividendsIncentivesStage,string"`
// 分红规则激励阶段结束
DividendsIncentivesStageEnd int `json:"dividendsIncentivesStageEnd"`
// 分红规则激励阶段开始
DividendsIncentivesStageStart int `json:"dividendsIncentivesStageStart"`
} `json:"dividendsIncentivesRules"`
// 金额激励规则列表
MoneyIncentivesRules []struct {
// 金额激励规则ID
MoneyIncentivesRuleId int64 `json:"moneyIncentivesRuleId,string"`
// 关联的共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 激励金额
MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"`
// 金额激励阶段
MoneyIncentivesStage int `json:"moneyIncentivesStage"`
// 金额激励规则时间
MoneyIncentivesTime int `json:"moneyIncentivesTime"`
// 推荐人抽成比例
ReferrerPercentage float64 `json:"referrerPercentage"`
// 业务员抽成比例
SalesmanPercentage float64 `json:"salesmanPercentage"`
} `json:"moneyIncentivesRules"`
// 承接方列表
Undertakers []struct {
UndertakerId string `json:"undertakerId"` //承接人用户id
RerferrerId string `json:"rerferrerId"` //推荐人用户id
SalesmanId string `json:"salesmanId"` //关联业务员id
Attachment domain.Attachment `json:"attachment"`
} `json:"undertakers"`
//关联业务员
RelevantIds []string `json:"relevantIds"`
}
func (updateCooperationContractCommand *UpdateCooperationContractCommand) Valid(validation *validation.Validation) {
... ...
package dto
import "time"
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
type CooperationContractItem struct {
CooperationContractId int `json:"cooperationContractId,string,"`
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
CooperationProjectNumber string `json:"cooperationProjectNumber"`
CooperationContractName string `json:"CooperationContractName"` //合约名称
Department string `json:"department"`
CooperationContractId int `json:"cooperationContractId,string,"`
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
CooperationContractName string `json:"CooperationContractName"` //合约名称
Status int `json:"status"` //合约状态
CreateTtime int `json:"createTtime"`
Department struct {
DepartmentId int `json:"departmentId"`
DepartmentName string `json:"departmentName"`
} `json:"department"`
IncentivesType string `json:"incentivesType"` //Incentives激励方式
CooperationContractSponsor struct {
UserId int `json:"userId,string,"`
... ... @@ -18,13 +25,34 @@ type CooperationContractItem struct {
CooperationModeNumber string `json:"cooperationModeNumber"` // 共创模式编码,
CooperationModeName string `json:"cooperationModeName"` // 模式名称,
} `json:"cooperationMode"` //共创模式
Status int `json:"status"` //合约状态
CreateTtime time.Time `json:"createTtime"`
Org struct {
OrgId int `json:"orgId"` //发部门, id
OrgName string `json:"orgName"` //发起企业
Org struct {
OrgId int `json:"orgId"` // id
OrgName string `json:"orgName"` //
} `json:"org"` //组织结构
}
func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract) *CooperationContractItem {
// relevantPeople := []int{}
data := CooperationContractItem{
CooperationContractId: param.CooperationContractId,
CooperationProjectNumber: param.CooperationContractNumber,
CooperationContractName: param.CooperationContractName,
CooperationContractNumber: param.CooperationContractNumber,
Status: param.Status,
CreateTtime: int(param.CreatedAt.Unix()),
}
data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId
data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName
data.Department.DepartmentId = param.Department.DepartmentId
data.Department.DepartmentName = param.Department.DepartmentName
data.Org.OrgId = int(param.Org.OrgId)
data.Org.OrgName = param.Org.OrgName
data.CooperationMode.CooperationModeId = param.CooperationMode.CooperationModeId
data.CooperationMode.CooperationModeName = param.CooperationMode.CooperationModeName
data.CooperationMode.CooperationModeNumber = param.CooperationMode.CooperationModeNumber
return nil
}
type CooperationContractInfo struct {
}
... ...
... ... @@ -5,6 +5,7 @@ import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
... ... @@ -19,7 +20,6 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationContractCommand.Operator)
rules1 := []allied_creation_cooperation.DividendsIncentivesRule{}
for _, v := range createCooperationContractCommand.DividendsIncentivesRules {
r := allied_creation_cooperation.DividendsIncentivesRule{
... ... @@ -33,9 +33,43 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
}
rules1 = append(rules1, r)
}
// rules2 := []allied_creation_cooperation.MoneyIncentivesRule{}
_, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{})
rules2 := []allied_creation_cooperation.MoneyIncentivesRule{}
for _, v := range createCooperationContractCommand.MoneyIncentivesRules {
r := allied_creation_cooperation.MoneyIncentivesRule{
MoneyIncentivesRuleId: 0,
CooperationContractNumber: v.CooperationContractNumber,
MoneyIncentivesAmount: v.MoneyIncentivesAmount,
MoneyIncentivesStage: v.MoneyIncentivesStage,
MoneyIncentivesTime: time.Unix(int64(v.MoneyIncentivesTime), 0),
ReferrerPercentage: v.ReferrerPercentage,
SalesmanPercentage: v.SalesmanPercentage,
}
rules2 = append(rules2, r)
}
underTakers := []allied_creation_cooperation.Undertaker{}
for _, v := range createCooperationContractCommand.Undertakers {
u := allied_creation_cooperation.Undertaker{
UndertakerId: v.UndertakerId,
RerferrerId: v.RerferrerId,
SalesmanId: v.SalesmanId,
Attachment: v.Attachment,
}
underTakers = append(underTakers, u)
}
_, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{
MoneyIncentivesRules: rules2,
DividendsIncentivesRules: rules1,
Undertakers: underTakers,
RelevantIds: createCooperationContractCommand.RelevantIds,
CooperationContractDescription: createCooperationContractCommand.CooperationContractDescription,
CooperationContractNumber: createCooperationContractCommand.CooperationContractNumber,
CooperationProjectNumber: createCooperationContractCommand.CooperationProjectNumber,
DepartmentId: createCooperationContractCommand.DepartmentId,
CooperationContractUndertakerType: createCooperationContractCommand.CooperationContractUndertakerType,
CooperationContractName: createCooperationContractCommand.CooperationContractName,
CooperationModeNumber: createCooperationContractCommand.CooperationModeNumber,
SponsorUid: createCooperationContractCommand.SponsorUid,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -51,7 +85,7 @@ func (cooperationContractService *CooperationContractService) EnableCooperationC
return nil, nil
}
// 返回共创合约管理
// 返回共创合约详情
func (cooperationContractService *CooperationContractService) GetCooperationContract(getCooperationContractQuery *query.GetCooperationContractQuery) (interface{}, error) {
if err := getCooperationContractQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -67,17 +101,25 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont
}
// 返回共创合约管理列表
func (cooperationContractService *CooperationContractService) ListCooperationContract(listCooperationContractQuery *query.ListCooperationContractQuery) (interface{}, error) {
func (cooperationContractService *CooperationContractService) ListCooperationContract(
listCooperationContractQuery *query.ListCooperationContractQuery) (int, interface{}, error) {
if err := listCooperationContractQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator)
result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
_ = result
return nil, nil
data := []dto.CooperationContractItem{}
for i := range result.Grid.List {
item := dto.ToCooperationContractItem(&result.Grid.List[i])
data = append(data, *item)
}
return result.Grid.Total, data, nil
}
// 更新共创合约管理
... ... @@ -85,6 +127,61 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
if err := updateCooperationContractCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationContractCommand.Operator)
rules1 := []allied_creation_cooperation.DividendsIncentivesRule{}
for _, v := range updateCooperationContractCommand.DividendsIncentivesRules {
r := allied_creation_cooperation.DividendsIncentivesRule{
CooperationContractNumber: v.CooperationContractNumber,
ReferrerPercentage: v.ReferrerPercentage,
SalesmanPercentage: v.SalesmanPercentage,
DividendsIncentivesPercentage: v.DividendsIncentivesPercentage,
DividendsIncentivesStage: v.DividendsIncentivesStage,
DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsIncentivesStageEnd), 0),
DividendsIncentivesStageStart: time.Unix(int64(v.DividendsIncentivesStageStart), 0),
}
rules1 = append(rules1, r)
}
rules2 := []allied_creation_cooperation.MoneyIncentivesRule{}
for _, v := range updateCooperationContractCommand.MoneyIncentivesRules {
r := allied_creation_cooperation.MoneyIncentivesRule{
MoneyIncentivesRuleId: 0,
CooperationContractNumber: v.CooperationContractNumber,
MoneyIncentivesAmount: v.MoneyIncentivesAmount,
MoneyIncentivesStage: v.MoneyIncentivesStage,
MoneyIncentivesTime: time.Unix(int64(v.MoneyIncentivesTime), 0),
ReferrerPercentage: v.ReferrerPercentage,
SalesmanPercentage: v.SalesmanPercentage,
}
rules2 = append(rules2, r)
}
underTakers := []allied_creation_cooperation.Undertaker{}
for _, v := range updateCooperationContractCommand.Undertakers {
u := allied_creation_cooperation.Undertaker{
UndertakerId: v.UndertakerId,
RerferrerId: v.RerferrerId,
SalesmanId: v.SalesmanId,
Attachment: v.Attachment,
}
underTakers = append(underTakers, u)
}
_, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{
CooperationContractId: updateCooperationContractCommand.CooperationContractId,
MoneyIncentivesRules: rules2,
DividendsIncentivesRules: rules1,
Undertakers: underTakers,
RelevantIds: updateCooperationContractCommand.RelevantIds,
CooperationContractDescription: updateCooperationContractCommand.CooperationContractDescription,
CooperationContractNumber: updateCooperationContractCommand.CooperationContractNumber,
CooperationProjectNumber: updateCooperationContractCommand.CooperationProjectNumber,
DepartmentId: updateCooperationContractCommand.DepartmentId,
CooperationContractUndertakerType: updateCooperationContractCommand.CooperationContractUndertakerType,
CooperationContractName: updateCooperationContractCommand.CooperationContractName,
CooperationModeNumber: updateCooperationContractCommand.CooperationModeNumber,
SponsorUid: updateCooperationContractCommand.SponsorUid,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return nil, nil
}
... ...
... ... @@ -33,6 +33,12 @@ func init() {
if os.Getenv("ALLIED_CREATION_USER_HOST") != "" {
ALLIED_CREATION_USER_HOST = os.Getenv("ALLIED_CREATION_USER_HOST")
}
if os.Getenv("ALLIED_CREATION_COOPERATION_HOST") != "" {
ALLIED_CREATION_COOPERATION_HOST = os.Getenv("ALLIED_CREATION_COOPERATION_HOST")
}
if os.Getenv("SMS_SERVE_HOST") != "" {
SMS_SERVE_HOST = os.Getenv("SMS_SERVE_HOST")
}
if os.Getenv("HTTP_PORT") != "" {
HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT"))
}
... ...
... ... @@ -6,6 +6,95 @@ import (
"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"` //发起部门
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 {
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"`
} `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 (
//分红激励规则
... ... @@ -27,20 +116,13 @@ type (
}
//金额激励规则
MoneyIncentivesRule struct {
// 金额激励规则ID
MoneyIncentivesRuleId int64 `json:"moneyIncentivesRuleId,string"`
// 关联的共创合约编号
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"`
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"` // 业务员抽成比例
}
//合约承接方
... ... @@ -52,67 +134,47 @@ type (
}
ReqCooperationContractAdd struct {
// 共创合约描述
CooperationContractDescription string `json:"cooperationContractDescription"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 共创项目编号,
CooperationProjectNumber string `json:"cooperationProjectNumber"`
// 共创合约发起部门id
DepartmentId string `json:"departmentId"`
// 共创合约承接对象,1员工,2共创用户,3公开
CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"`
// 共创合约名称
CooperationContractName string `json:"cooperationContractName"`
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 共创合约发起人uid
SponsorUid string `json:"sponsorUid"`
// 业绩分红激励规则列表
DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"`
// 金额激励规则列表
MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"`
// 承接方列表
Undertakers []Undertaker `json:"undertakers"`
//关联业务员
RelevantIds []string `json:"relevantIds"`
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"` // 共创合约发起人uid
DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 业绩分红激励规则列表
MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` // 金额激励规则列表
Undertakers []Undertaker `json:"undertakers"` // 承接方列表
RelevantIds []string `json:"relevantIds"` //关联业务员
}
DataCooperationContractAdd struct {
CooperationContract
}
)
//更新共创合约
type (
ReqCooperationContractUpdate struct {
CooperationContractId int `json:"cooperationContractId"`
// 共创合约描述
CooperationContractDescription string `json:"cooperationContractDescription"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 共创项目编号,
CooperationProjectNumber string `json:"cooperationProjectNumber"`
// 共创合约发起部门id
DepartmentId string `json:"departmentId"`
// 共创合约承接对象,1员工,2共创用户,3公开
CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"`
// 共创合约名称
CooperationContractName string `json:"cooperationContractName"`
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 共创合约发起人uid
SponsorUid string `json:"sponsorUid,omitempty,"`
// 业绩分红激励规则列表
DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"`
// 金额激励规则列表
MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"`
// 承接方列表
Undertakers []Undertaker `json:"undertakers"`
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"`
}
DataCooperationContractUpdate struct {
CooperationContract
}
)
... ... @@ -126,17 +188,21 @@ type (
}
DataCooperationContractSearch struct {
Grid struct {
Total int `json:"total"`
List []CooperationContract `json:"list"`
} `json:"grid"`
}
)
//根据承接人查询并返回共创项目合约
type (
ReqCooperationContractSearchByUndertaker struct {
CooperationContractName string //合约名称
SponsorName string //项目发起人姓名
UserId int //合约发起人
PageNumber int
PageIndex int
CooperationContractName string `json:"cooperationContractName"` //合约名称
SponsorName string `json:"sponsorName"` //项目发起人姓名
UserId int `json:"userId"` //合约发起人
PageNumber int `json:"pageNumber"`
PageIndex int `json:"pageIndex"`
}
DataCooperationContractSearchByUndertaker struct {
... ... @@ -146,10 +212,11 @@ type (
//移除共创合约
type (
ReqCooperationContractRemove struct {
CooperationContractId int
CooperationContractId int `json:"cooperationContractId"`
}
DataCooperationContractRemove struct {
CooperationContract
}
)
... ... @@ -169,5 +236,8 @@ type (
}
DataCooperationContractGet struct {
CooperationContract
// 可以去除勾选的共创项目承接对象列表
UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"`
}
)
... ...
... ... @@ -2,12 +2,11 @@ package allied_creation_cooperation
import "time"
//确定预算分红激励
type (
ReqDividendsEstimateIncentive struct {
// companyId
// orgId
// userId
CooperationContractNumber string //合约编号
OrderOrReturnedOrderNum string //分红订单号/退货单号
}
... ...
... ... @@ -133,7 +133,7 @@ type (
//移除分红订单
type (
ReqDividendsOrderRemove struct {
DividendsOrderId int
DividendsOrderId int `json:"dividendsOrderId"`
}
DataDividendsOrderRemove struct {
... ...
... ... @@ -41,7 +41,7 @@ func (controller *CooperationContractController) GetCooperationContract() {
func (controller *CooperationContractController) ListCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
listCooperationContractQuery := &query.ListCooperationContractQuery{}
data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)
_, data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)
controller.Response(data, err)
}
... ...