作者 tangxuhui

配置更新

@@ -7,9 +7,9 @@ metadata: @@ -7,9 +7,9 @@ metadata:
7 k8s-app: allied-creation-gateway 7 k8s-app: allied-creation-gateway
8 spec: 8 spec:
9 ports: 9 ports:
10 - - name: "http"  
11 - port: 80  
12 - targetPort: 8082 10 + - name: "http"
  11 + port: 80
  12 + targetPort: 8082
13 selector: 13 selector:
14 k8s-app: allied-creation-gateway 14 k8s-app: allied-creation-gateway
15 --- 15 ---
@@ -43,74 +43,78 @@ spec: @@ -43,74 +43,78 @@ spec:
43 - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb 43 - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
44 - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy 44 - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
45 containers: 45 containers:
46 - - name: allied-creation-gateway  
47 - image: 192.168.0.243:5000/mmm/allied-creation-gateway:dev  
48 - imagePullPolicy: Always  
49 - ports:  
50 - - containerPort: 8082  
51 - volumeMounts:  
52 - - mountPath: /opt/logs  
53 - name: accesslogs  
54 - env:  
55 - - name: POSTGRESQL_DB_NAME  
56 - valueFrom:  
57 - configMapKeyRef:  
58 - name: suplus-config  
59 - key: postgresqlalliedcreation.dbname  
60 - - name: POSTGRESQL_USER  
61 - valueFrom:  
62 - configMapKeyRef:  
63 - name: suplus-config  
64 - key: postgresql.user  
65 - - name: POSTGRESQL_PASSWORD  
66 - valueFrom:  
67 - configMapKeyRef:  
68 - name: suplus-config  
69 - key: postgresql.password  
70 - - name: POSTGRESQL_HOST  
71 - valueFrom:  
72 - configMapKeyRef:  
73 - name: suplus-config  
74 - key: postgresql.host  
75 - - name: POSTGRESQL_PORT  
76 - valueFrom:  
77 - configMapKeyRef:  
78 - name: suplus-config  
79 - key: postgresql.port  
80 - - name: REDIS_HOST  
81 - valueFrom:  
82 - configMapKeyRef:  
83 - name: suplus-config  
84 - key: redis.ip  
85 - - name: REDIS_PORT  
86 - valueFrom:  
87 - configMapKeyRef:  
88 - name: suplus-config  
89 - key: redis.port  
90 - - name: REDIS_AUTH  
91 - value: ""  
92 - - name: LOG_LEVEL  
93 - value: "debug"  
94 - - name: ERROR_BASE_CODE  
95 - value: "1"  
96 - - name: ERROR_BASE_CODE_MULTIPLE  
97 - value: "1000"  
98 - - name: ENABLE_KAFKA_LOG  
99 - value: "true"  
100 - - name: HTTP_PORT  
101 - value: "8082"  
102 - - name: ALLIED_CREATION_USER_HOST  
103 - value: "http://allied-creation-user-dev.fjmaimaimai.com"  
104 -# - name: REDIS_HOST  
105 -# valueFrom:  
106 -# configMapKeyRef:  
107 -# name: suplus-config  
108 -# key: redis.ip  
109 -# - name: REDIS_PORT  
110 -# valueFrom:  
111 -# configMapKeyRef:  
112 -# name: suplus-config  
113 -# key: redis.port 46 + - name: allied-creation-gateway
  47 + image: 192.168.0.243:5000/mmm/allied-creation-gateway:dev
  48 + imagePullPolicy: Always
  49 + ports:
  50 + - containerPort: 8082
  51 + volumeMounts:
  52 + - mountPath: /opt/logs
  53 + name: accesslogs
  54 + env:
  55 + - name: POSTGRESQL_DB_NAME
  56 + valueFrom:
  57 + configMapKeyRef:
  58 + name: suplus-config
  59 + key: postgresqlalliedcreation.dbname
  60 + - name: POSTGRESQL_USER
  61 + valueFrom:
  62 + configMapKeyRef:
  63 + name: suplus-config
  64 + key: postgresql.user
  65 + - name: POSTGRESQL_PASSWORD
  66 + valueFrom:
  67 + configMapKeyRef:
  68 + name: suplus-config
  69 + key: postgresql.password
  70 + - name: POSTGRESQL_HOST
  71 + valueFrom:
  72 + configMapKeyRef:
  73 + name: suplus-config
  74 + key: postgresql.host
  75 + - name: POSTGRESQL_PORT
  76 + valueFrom:
  77 + configMapKeyRef:
  78 + name: suplus-config
  79 + key: postgresql.port
  80 + - name: REDIS_HOST
  81 + valueFrom:
  82 + configMapKeyRef:
  83 + name: suplus-config
  84 + key: redis.ip
  85 + - name: REDIS_PORT
  86 + valueFrom:
  87 + configMapKeyRef:
  88 + name: suplus-config
  89 + key: redis.port
  90 + - name: REDIS_AUTH
  91 + value: ""
  92 + - name: LOG_LEVEL
  93 + value: "debug"
  94 + - name: ERROR_BASE_CODE
  95 + value: "1"
  96 + - name: ERROR_BASE_CODE_MULTIPLE
  97 + value: "1000"
  98 + - name: ENABLE_KAFKA_LOG
  99 + value: "true"
  100 + - name: HTTP_PORT
  101 + value: "8082"
  102 + - name: ALLIED_CREATION_USER_HOST
  103 + value: "http://allied-creation-user-dev.fjmaimaimai.com"
  104 + - name: ALLIED_CREATION_COOPERATION_HOST
  105 + value: "http://allied-creation-cooperation-dev.fjmaimaimai.com/"
  106 + - name: SMS_SERVE_HOST
  107 + value: "https://sms.fjmaimaimai.com:9897"
  108 + # - name: REDIS_HOST
  109 + # valueFrom:
  110 + # configMapKeyRef:
  111 + # name: suplus-config
  112 + # key: redis.ip
  113 + # - name: REDIS_PORT
  114 + # valueFrom:
  115 + # configMapKeyRef:
  116 + # name: suplus-config
  117 + # key: redis.port
114 volumes: 118 volumes:
115 - - name: accesslogs  
116 - emptyDir: {}  
  119 + - name: accesslogs
  120 + emptyDir: {}
@@ -7,9 +7,9 @@ metadata: @@ -7,9 +7,9 @@ metadata:
7 k8s-app: project 7 k8s-app: project
8 spec: 8 spec:
9 ports: 9 ports:
10 - - name: "http"  
11 - port: 80  
12 - targetPort: 8082 10 + - name: "http"
  11 + port: 80
  12 + targetPort: 8082
13 selector: 13 selector:
14 k8s-app: project 14 k8s-app: project
15 --- 15 ---
@@ -43,21 +43,21 @@ spec: @@ -43,21 +43,21 @@ spec:
43 - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb 43 - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
44 - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy 44 - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
45 containers: 45 containers:
46 - - name: project  
47 - image: 192.168.0.243:5000/mmm/project:dev  
48 - imagePullPolicy: Always  
49 - ports:  
50 - - containerPort: 8082  
51 - volumeMounts:  
52 - - mountPath: /opt/logs  
53 - name: accesslogs  
54 - env:  
55 - - name: LOG_LEVEL  
56 - value: "debug"  
57 - - name: ERROR_BASE_CODE  
58 - value: "1"  
59 - - name: ERROR_BASE_CODE_MULTIPLE  
60 - value: "1000" 46 + - name: project
  47 + image: 192.168.0.243:5000/mmm/project:dev
  48 + imagePullPolicy: Always
  49 + ports:
  50 + - containerPort: 8082
  51 + volumeMounts:
  52 + - mountPath: /opt/logs
  53 + name: accesslogs
  54 + env:
  55 + - name: LOG_LEVEL
  56 + value: "debug"
  57 + - name: ERROR_BASE_CODE
  58 + value: "1"
  59 + - name: ERROR_BASE_CODE_MULTIPLE
  60 + value: "1000"
61 volumes: 61 volumes:
62 - - name: accesslogs  
63 - emptyDir: {}  
  62 + - name: accesslogs
  63 + emptyDir: {}
1 -{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628574006679578700}  
  1 +{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628731667364868600}
@@ -15,7 +15,7 @@ type EndCooperationProjectCommand struct { @@ -15,7 +15,7 @@ type EndCooperationProjectCommand struct {
15 } 15 }
16 16
17 func (endCooperationProjectCommand *EndCooperationProjectCommand) Valid(validation *validation.Validation) { 17 func (endCooperationProjectCommand *EndCooperationProjectCommand) Valid(validation *validation.Validation) {
18 - validation.SetError("CustomValid", "未实现的自定义认证") 18 +
19 } 19 }
20 20
21 func (endCooperationProjectCommand *EndCooperationProjectCommand) ValidateCommand() error { 21 func (endCooperationProjectCommand *EndCooperationProjectCommand) ValidateCommand() error {
@@ -29,7 +29,6 @@ type UpdateCooperationProjectCommand struct { @@ -29,7 +29,6 @@ type UpdateCooperationProjectCommand struct {
29 } 29 }
30 30
31 func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) Valid(validation *validation.Validation) { 31 func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) Valid(validation *validation.Validation) {
32 - validation.SetError("CustomValid", "未实现的自定义认证")  
33 } 32 }
34 33
35 func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) ValidateCommand() error { 34 func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) ValidateCommand() error {
@@ -5,13 +5,71 @@ import ( @@ -5,13 +5,71 @@ import (
5 5
6 "github.com/beego/beego/v2/core/validation" 6 "github.com/beego/beego/v2/core/validation"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"  
9 ) 8 )
10 9
11 type UpdateCooperationContractCommand struct { 10 type UpdateCooperationContractCommand struct {
12 //操作人 11 //操作人
13 - Operator domain.Operator `json:"-"`  
14 - allied_creation_cooperation.ReqCooperationContractUpdate 12 + Operator domain.Operator `json:"-"`
  13 + CooperationContractId int `json:"cooperationContractId"`
  14 + // 共创合约描述
  15 + CooperationContractDescription string `json:"cooperationContractDescription"`
  16 + // 共创合约编号
  17 + CooperationContractNumber string `json:"cooperationContractNumber"`
  18 + // 共创项目编号,
  19 + CooperationProjectNumber string `json:"cooperationProjectNumber"`
  20 + // 共创合约发起部门id
  21 + DepartmentId string `json:"departmentId"`
  22 + // 共创合约承接对象,1员工,2共创用户,3公开
  23 + CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"`
  24 + // 共创合约名称
  25 + CooperationContractName string `json:"cooperationContractName"`
  26 + // 共创模式编码,
  27 + CooperationModeNumber string `json:"cooperationModeNumber"`
  28 + // 共创合约发起人uid
  29 + SponsorUid string `json:"sponsorUid"`
  30 + // 业绩分红激励规则列表
  31 + DividendsIncentivesRules []struct {
  32 + // 关联的项目合约编号
  33 + CooperationContractNumber string `json:"cooperationContractNumber"`
  34 + // 推荐人抽成比例
  35 + ReferrerPercentage float64 `json:"referrerPercentage"`
  36 + // 业务员抽成比例
  37 + SalesmanPercentage float64 `json:"salesmanPercentage"`
  38 + // 分红规则激励百分点
  39 + DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"`
  40 + // 分红规则激励阶段,
  41 + DividendsIncentivesStage int64 `json:"dividendsIncentivesStage,string"`
  42 + // 分红规则激励阶段结束
  43 + DividendsIncentivesStageEnd int `json:"dividendsIncentivesStageEnd"`
  44 + // 分红规则激励阶段开始
  45 + DividendsIncentivesStageStart int `json:"dividendsIncentivesStageStart"`
  46 + } `json:"dividendsIncentivesRules"`
  47 + // 金额激励规则列表
  48 + MoneyIncentivesRules []struct {
  49 + // 金额激励规则ID
  50 + MoneyIncentivesRuleId int64 `json:"moneyIncentivesRuleId,string"`
  51 + // 关联的共创合约编号
  52 + CooperationContractNumber string `json:"cooperationContractNumber"`
  53 + // 激励金额
  54 + MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"`
  55 + // 金额激励阶段
  56 + MoneyIncentivesStage int `json:"moneyIncentivesStage"`
  57 + // 金额激励规则时间
  58 + MoneyIncentivesTime int `json:"moneyIncentivesTime"`
  59 + // 推荐人抽成比例
  60 + ReferrerPercentage float64 `json:"referrerPercentage"`
  61 + // 业务员抽成比例
  62 + SalesmanPercentage float64 `json:"salesmanPercentage"`
  63 + } `json:"moneyIncentivesRules"`
  64 + // 承接方列表
  65 + Undertakers []struct {
  66 + UndertakerId string `json:"undertakerId"` //承接人用户id
  67 + RerferrerId string `json:"rerferrerId"` //推荐人用户id
  68 + SalesmanId string `json:"salesmanId"` //关联业务员id
  69 + Attachment domain.Attachment `json:"attachment"`
  70 + } `json:"undertakers"`
  71 + //关联业务员
  72 + RelevantIds []string `json:"relevantIds"`
15 } 73 }
16 74
17 func (updateCooperationContractCommand *UpdateCooperationContractCommand) Valid(validation *validation.Validation) { 75 func (updateCooperationContractCommand *UpdateCooperationContractCommand) Valid(validation *validation.Validation) {
1 package dto 1 package dto
2 2
3 -import "time" 3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
  5 +)
4 6
5 type CooperationContractItem struct { 7 type CooperationContractItem struct {
6 - CooperationContractId int `json:"cooperationContractId,string,"`  
7 - CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号  
8 - CooperationProjectNumber string `json:"cooperationProjectNumber"`  
9 - CooperationContractName string `json:"CooperationContractName"` //合约名称  
10 - Department string `json:"department"` 8 + CooperationContractId int `json:"cooperationContractId,string,"`
  9 + CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
  10 + CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
  11 + CooperationContractName string `json:"CooperationContractName"` //合约名称
  12 + Status int `json:"status"` //合约状态
  13 + CreateTtime int `json:"createTtime"`
  14 + Department struct {
  15 + DepartmentId int `json:"departmentId"`
  16 + DepartmentName string `json:"departmentName"`
  17 + } `json:"department"`
11 IncentivesType string `json:"incentivesType"` //Incentives激励方式 18 IncentivesType string `json:"incentivesType"` //Incentives激励方式
12 CooperationContractSponsor struct { 19 CooperationContractSponsor struct {
13 UserId int `json:"userId,string,"` 20 UserId int `json:"userId,string,"`
@@ -18,13 +25,34 @@ type CooperationContractItem struct { @@ -18,13 +25,34 @@ type CooperationContractItem struct {
18 CooperationModeNumber string `json:"cooperationModeNumber"` // 共创模式编码, 25 CooperationModeNumber string `json:"cooperationModeNumber"` // 共创模式编码,
19 CooperationModeName string `json:"cooperationModeName"` // 模式名称, 26 CooperationModeName string `json:"cooperationModeName"` // 模式名称,
20 } `json:"cooperationMode"` //共创模式 27 } `json:"cooperationMode"` //共创模式
21 - Status int `json:"status"` //合约状态  
22 - CreateTtime time.Time `json:"createTtime"`  
23 - Org struct {  
24 - OrgId int `json:"orgId"` //发部门, id  
25 - OrgName string `json:"orgName"` //发起企业 28 + Org struct {
  29 + OrgId int `json:"orgId"` // id
  30 + OrgName string `json:"orgName"` //
26 } `json:"org"` //组织结构 31 } `json:"org"` //组织结构
27 } 32 }
28 33
  34 +func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract) *CooperationContractItem {
  35 + // relevantPeople := []int{}
  36 + data := CooperationContractItem{
  37 + CooperationContractId: param.CooperationContractId,
  38 + CooperationProjectNumber: param.CooperationContractNumber,
  39 + CooperationContractName: param.CooperationContractName,
  40 + CooperationContractNumber: param.CooperationContractNumber,
  41 + Status: param.Status,
  42 + CreateTtime: int(param.CreatedAt.Unix()),
  43 + }
  44 + data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId
  45 + data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName
  46 + data.Department.DepartmentId = param.Department.DepartmentId
  47 + data.Department.DepartmentName = param.Department.DepartmentName
  48 + data.Org.OrgId = int(param.Org.OrgId)
  49 + data.Org.OrgName = param.Org.OrgName
  50 + data.CooperationMode.CooperationModeId = param.CooperationMode.CooperationModeId
  51 + data.CooperationMode.CooperationModeName = param.CooperationMode.CooperationModeName
  52 + data.CooperationMode.CooperationModeNumber = param.CooperationMode.CooperationModeNumber
  53 +
  54 + return nil
  55 +}
  56 +
29 type CooperationContractInfo struct { 57 type CooperationContractInfo struct {
30 } 58 }
@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 5
6 "github.com/linmadan/egglib-go/core/application" 6 "github.com/linmadan/egglib-go/core/application"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/command" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/command"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/dto"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/query" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/query"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
10 ) 11 )
@@ -19,7 +20,6 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -19,7 +20,6 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
19 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 20 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
20 } 21 }
21 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationContractCommand.Operator) 22 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationContractCommand.Operator)
22 -  
23 rules1 := []allied_creation_cooperation.DividendsIncentivesRule{} 23 rules1 := []allied_creation_cooperation.DividendsIncentivesRule{}
24 for _, v := range createCooperationContractCommand.DividendsIncentivesRules { 24 for _, v := range createCooperationContractCommand.DividendsIncentivesRules {
25 r := allied_creation_cooperation.DividendsIncentivesRule{ 25 r := allied_creation_cooperation.DividendsIncentivesRule{
@@ -33,9 +33,43 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -33,9 +33,43 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
33 } 33 }
34 rules1 = append(rules1, r) 34 rules1 = append(rules1, r)
35 } 35 }
36 - // rules2 := []allied_creation_cooperation.MoneyIncentivesRule{}  
37 -  
38 - _, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{}) 36 + rules2 := []allied_creation_cooperation.MoneyIncentivesRule{}
  37 + for _, v := range createCooperationContractCommand.MoneyIncentivesRules {
  38 + r := allied_creation_cooperation.MoneyIncentivesRule{
  39 + MoneyIncentivesRuleId: 0,
  40 + CooperationContractNumber: v.CooperationContractNumber,
  41 + MoneyIncentivesAmount: v.MoneyIncentivesAmount,
  42 + MoneyIncentivesStage: v.MoneyIncentivesStage,
  43 + MoneyIncentivesTime: time.Unix(int64(v.MoneyIncentivesTime), 0),
  44 + ReferrerPercentage: v.ReferrerPercentage,
  45 + SalesmanPercentage: v.SalesmanPercentage,
  46 + }
  47 + rules2 = append(rules2, r)
  48 + }
  49 + underTakers := []allied_creation_cooperation.Undertaker{}
  50 + for _, v := range createCooperationContractCommand.Undertakers {
  51 + u := allied_creation_cooperation.Undertaker{
  52 + UndertakerId: v.UndertakerId,
  53 + RerferrerId: v.RerferrerId,
  54 + SalesmanId: v.SalesmanId,
  55 + Attachment: v.Attachment,
  56 + }
  57 + underTakers = append(underTakers, u)
  58 + }
  59 + _, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{
  60 + MoneyIncentivesRules: rules2,
  61 + DividendsIncentivesRules: rules1,
  62 + Undertakers: underTakers,
  63 + RelevantIds: createCooperationContractCommand.RelevantIds,
  64 + CooperationContractDescription: createCooperationContractCommand.CooperationContractDescription,
  65 + CooperationContractNumber: createCooperationContractCommand.CooperationContractNumber,
  66 + CooperationProjectNumber: createCooperationContractCommand.CooperationProjectNumber,
  67 + DepartmentId: createCooperationContractCommand.DepartmentId,
  68 + CooperationContractUndertakerType: createCooperationContractCommand.CooperationContractUndertakerType,
  69 + CooperationContractName: createCooperationContractCommand.CooperationContractName,
  70 + CooperationModeNumber: createCooperationContractCommand.CooperationModeNumber,
  71 + SponsorUid: createCooperationContractCommand.SponsorUid,
  72 + })
39 if err != nil { 73 if err != nil {
40 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 74 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
41 } 75 }
@@ -51,7 +85,7 @@ func (cooperationContractService *CooperationContractService) EnableCooperationC @@ -51,7 +85,7 @@ func (cooperationContractService *CooperationContractService) EnableCooperationC
51 return nil, nil 85 return nil, nil
52 } 86 }
53 87
54 -// 返回共创合约管理 88 +// 返回共创合约详情
55 func (cooperationContractService *CooperationContractService) GetCooperationContract(getCooperationContractQuery *query.GetCooperationContractQuery) (interface{}, error) { 89 func (cooperationContractService *CooperationContractService) GetCooperationContract(getCooperationContractQuery *query.GetCooperationContractQuery) (interface{}, error) {
56 if err := getCooperationContractQuery.ValidateQuery(); err != nil { 90 if err := getCooperationContractQuery.ValidateQuery(); err != nil {
57 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 91 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
@@ -67,17 +101,25 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont @@ -67,17 +101,25 @@ func (cooperationContractService *CooperationContractService) GetCooperationCont
67 } 101 }
68 102
69 // 返回共创合约管理列表 103 // 返回共创合约管理列表
70 -func (cooperationContractService *CooperationContractService) ListCooperationContract(listCooperationContractQuery *query.ListCooperationContractQuery) (interface{}, error) { 104 +func (cooperationContractService *CooperationContractService) ListCooperationContract(
  105 + listCooperationContractQuery *query.ListCooperationContractQuery) (int, interface{}, error) {
71 if err := listCooperationContractQuery.ValidateQuery(); err != nil { 106 if err := listCooperationContractQuery.ValidateQuery(); err != nil {
72 - return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 107 + return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
73 } 108 }
74 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator) 109 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator)
75 result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{}) 110 result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{})
76 if err != nil { 111 if err != nil {
77 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 112 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
78 } 113 }
79 - _ = result  
80 - return nil, nil 114 +
  115 + data := []dto.CooperationContractItem{}
  116 +
  117 + for i := range result.Grid.List {
  118 + item := dto.ToCooperationContractItem(&result.Grid.List[i])
  119 + data = append(data, *item)
  120 + }
  121 +
  122 + return result.Grid.Total, data, nil
81 } 123 }
82 124
83 // 更新共创合约管理 125 // 更新共创合约管理
@@ -85,6 +127,61 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -85,6 +127,61 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
85 if err := updateCooperationContractCommand.ValidateCommand(); err != nil { 127 if err := updateCooperationContractCommand.ValidateCommand(); err != nil {
86 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 128 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
87 } 129 }
  130 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationContractCommand.Operator)
  131 + rules1 := []allied_creation_cooperation.DividendsIncentivesRule{}
  132 + for _, v := range updateCooperationContractCommand.DividendsIncentivesRules {
  133 + r := allied_creation_cooperation.DividendsIncentivesRule{
  134 + CooperationContractNumber: v.CooperationContractNumber,
  135 + ReferrerPercentage: v.ReferrerPercentage,
  136 + SalesmanPercentage: v.SalesmanPercentage,
  137 + DividendsIncentivesPercentage: v.DividendsIncentivesPercentage,
  138 + DividendsIncentivesStage: v.DividendsIncentivesStage,
  139 + DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsIncentivesStageEnd), 0),
  140 + DividendsIncentivesStageStart: time.Unix(int64(v.DividendsIncentivesStageStart), 0),
  141 + }
  142 + rules1 = append(rules1, r)
  143 + }
  144 + rules2 := []allied_creation_cooperation.MoneyIncentivesRule{}
  145 + for _, v := range updateCooperationContractCommand.MoneyIncentivesRules {
  146 + r := allied_creation_cooperation.MoneyIncentivesRule{
  147 + MoneyIncentivesRuleId: 0,
  148 + CooperationContractNumber: v.CooperationContractNumber,
  149 + MoneyIncentivesAmount: v.MoneyIncentivesAmount,
  150 + MoneyIncentivesStage: v.MoneyIncentivesStage,
  151 + MoneyIncentivesTime: time.Unix(int64(v.MoneyIncentivesTime), 0),
  152 + ReferrerPercentage: v.ReferrerPercentage,
  153 + SalesmanPercentage: v.SalesmanPercentage,
  154 + }
  155 + rules2 = append(rules2, r)
  156 + }
  157 + underTakers := []allied_creation_cooperation.Undertaker{}
  158 + for _, v := range updateCooperationContractCommand.Undertakers {
  159 + u := allied_creation_cooperation.Undertaker{
  160 + UndertakerId: v.UndertakerId,
  161 + RerferrerId: v.RerferrerId,
  162 + SalesmanId: v.SalesmanId,
  163 + Attachment: v.Attachment,
  164 + }
  165 + underTakers = append(underTakers, u)
  166 + }
  167 + _, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{
  168 + CooperationContractId: updateCooperationContractCommand.CooperationContractId,
  169 + MoneyIncentivesRules: rules2,
  170 + DividendsIncentivesRules: rules1,
  171 + Undertakers: underTakers,
  172 + RelevantIds: updateCooperationContractCommand.RelevantIds,
  173 + CooperationContractDescription: updateCooperationContractCommand.CooperationContractDescription,
  174 + CooperationContractNumber: updateCooperationContractCommand.CooperationContractNumber,
  175 + CooperationProjectNumber: updateCooperationContractCommand.CooperationProjectNumber,
  176 + DepartmentId: updateCooperationContractCommand.DepartmentId,
  177 + CooperationContractUndertakerType: updateCooperationContractCommand.CooperationContractUndertakerType,
  178 + CooperationContractName: updateCooperationContractCommand.CooperationContractName,
  179 + CooperationModeNumber: updateCooperationContractCommand.CooperationModeNumber,
  180 + SponsorUid: updateCooperationContractCommand.SponsorUid,
  181 + })
  182 + if err != nil {
  183 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  184 + }
88 return nil, nil 185 return nil, nil
89 } 186 }
90 187
@@ -33,6 +33,12 @@ func init() { @@ -33,6 +33,12 @@ func init() {
33 if os.Getenv("ALLIED_CREATION_USER_HOST") != "" { 33 if os.Getenv("ALLIED_CREATION_USER_HOST") != "" {
34 ALLIED_CREATION_USER_HOST = os.Getenv("ALLIED_CREATION_USER_HOST") 34 ALLIED_CREATION_USER_HOST = os.Getenv("ALLIED_CREATION_USER_HOST")
35 } 35 }
  36 + if os.Getenv("ALLIED_CREATION_COOPERATION_HOST") != "" {
  37 + ALLIED_CREATION_COOPERATION_HOST = os.Getenv("ALLIED_CREATION_COOPERATION_HOST")
  38 + }
  39 + if os.Getenv("SMS_SERVE_HOST") != "" {
  40 + SMS_SERVE_HOST = os.Getenv("SMS_SERVE_HOST")
  41 + }
36 if os.Getenv("HTTP_PORT") != "" { 42 if os.Getenv("HTTP_PORT") != "" {
37 HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT")) 43 HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT"))
38 } 44 }
@@ -7,12 +7,17 @@ import ( @@ -7,12 +7,17 @@ import (
7 ) 7 )
8 8
9 type CooperationContract struct { 9 type CooperationContract struct {
10 - CooperationContractId int `json:"cooperationContractId,string"` // 共创合约ID  
11 - CooperationContractDescription string `json:"cooperationContractDescription"` // 共创合约描述  
12 - CooperationContractName string `json:"cooperationContractName"` // 共创合约名称  
13 - CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号 10 + CooperationContractId int `json:"cooperationContractId,string"` // 共创合约ID
  11 + CooperationContractDescription string `json:"cooperationContractDescription"` // 共创合约描述
  12 + CooperationContractName string `json:"cooperationContractName"` // 共创合约名称
  13 + CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
  14 + CooperationProjectNumber string `json:"cooperationProjectNumber"`
14 CooperationContractUndertakerTypes []int `json:"cooperationContractUndertakerType"` // 共创合约承接对象,1员工,2共创用户,3公开 15 CooperationContractUndertakerTypes []int `json:"cooperationContractUndertakerType"` // 共创合约承接对象,1员工,2共创用户,3公开
15 - CooperationContractSponsor struct { 16 + Department struct {
  17 + DepartmentId int `json:"departmentId"`
  18 + DepartmentName string `json:"departmentName"`
  19 + } `jsopn:"department"` //发起部门
  20 + CooperationContractSponsor struct {
16 UserId int `json:"userId"` //id 21 UserId int `json:"userId"` //id
17 UserInfo struct { 22 UserInfo struct {
18 UserAvatar string `json:"userAvatar"` // 用户头像 23 UserAvatar string `json:"userAvatar"` // 用户头像
@@ -111,20 +116,13 @@ type ( @@ -111,20 +116,13 @@ type (
111 } 116 }
112 //金额激励规则 117 //金额激励规则
113 MoneyIncentivesRule struct { 118 MoneyIncentivesRule struct {
114 - // 金额激励规则ID  
115 - MoneyIncentivesRuleId int64 `json:"moneyIncentivesRuleId,string"`  
116 - // 关联的共创合约编号  
117 - CooperationContractNumber string `json:"cooperationContractNumber"`  
118 - // 激励金额  
119 - MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"`  
120 - // 金额激励阶段  
121 - MoneyIncentivesStage int `json:"moneyIncentivesStage"`  
122 - // 金额激励规则时间  
123 - MoneyIncentivesTime time.Time `json:"moneyIncentivesTime"`  
124 - // 推荐人抽成比例  
125 - ReferrerPercentage float64 `json:"referrerPercentage"`  
126 - // 业务员抽成比例  
127 - SalesmanPercentage float64 `json:"salesmanPercentage"` 119 + MoneyIncentivesRuleId int `json:"moneyIncentivesRuleId,string"` // 金额激励规则ID
  120 + CooperationContractNumber string `json:"cooperationContractNumber"` // 关联的共创合约编号
  121 + MoneyIncentivesAmount float64 `json:"moneyIncentivesAmount"` // 激励金额
  122 + MoneyIncentivesStage int `json:"moneyIncentivesStage"` // 金额激励阶段
  123 + MoneyIncentivesTime time.Time `json:"moneyIncentivesTime"` // 金额激励规则时间
  124 + ReferrerPercentage float64 `json:"referrerPercentage"` // 推荐人抽成比例
  125 + SalesmanPercentage float64 `json:"salesmanPercentage"` // 业务员抽成比例
128 } 126 }
129 127
130 //合约承接方 128 //合约承接方
@@ -136,67 +134,47 @@ type ( @@ -136,67 +134,47 @@ type (
136 } 134 }
137 135
138 ReqCooperationContractAdd struct { 136 ReqCooperationContractAdd struct {
139 - // 共创合约描述  
140 - CooperationContractDescription string `json:"cooperationContractDescription"`  
141 - // 共创合约编号  
142 - CooperationContractNumber string `json:"cooperationContractNumber"`  
143 - // 共创项目编号,  
144 - CooperationProjectNumber string `json:"cooperationProjectNumber"`  
145 - // 共创合约发起部门id  
146 - DepartmentId string `json:"departmentId"`  
147 - // 共创合约承接对象,1员工,2共创用户,3公开  
148 - CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"`  
149 - // 共创合约名称  
150 - CooperationContractName string `json:"cooperationContractName"`  
151 - // 共创模式编码,  
152 - CooperationModeNumber string `json:"cooperationModeNumber"`  
153 - // 共创合约发起人uid  
154 - SponsorUid string `json:"sponsorUid"`  
155 - // 业绩分红激励规则列表  
156 - DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"`  
157 - // 金额激励规则列表  
158 - MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"`  
159 - // 承接方列表  
160 - Undertakers []Undertaker `json:"undertakers"`  
161 - //关联业务员  
162 - RelevantIds []string `json:"relevantIds"` 137 + CooperationContractDescription string `json:"cooperationContractDescription"` // 共创合约描述
  138 + CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
  139 + CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
  140 + DepartmentId string `json:"departmentId"` // 共创合约发起部门id
  141 + CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` // 共创合约承接对象,1员工,2共创用户,3公开
  142 + CooperationContractName string `json:"cooperationContractName"` // 共创合约名称
  143 + CooperationModeNumber string `json:"cooperationModeNumber"` // 共创模式编码,
  144 + SponsorUid string `json:"sponsorUid"` // 共创合约发起人uid
  145 + DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 业绩分红激励规则列表
  146 + MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` // 金额激励规则列表
  147 + Undertakers []Undertaker `json:"undertakers"` // 承接方列表
  148 + RelevantIds []string `json:"relevantIds"` //关联业务员
163 } 149 }
164 150
165 DataCooperationContractAdd struct { 151 DataCooperationContractAdd struct {
  152 + CooperationContract
166 } 153 }
167 ) 154 )
168 155
169 //更新共创合约 156 //更新共创合约
170 type ( 157 type (
171 ReqCooperationContractUpdate struct { 158 ReqCooperationContractUpdate struct {
172 - CooperationContractId int `json:"cooperationContractId"`  
173 - // 共创合约描述  
174 - CooperationContractDescription string `json:"cooperationContractDescription"`  
175 - // 共创合约编号  
176 - CooperationContractNumber string `json:"cooperationContractNumber"`  
177 - // 共创项目编号,  
178 - CooperationProjectNumber string `json:"cooperationProjectNumber"`  
179 - // 共创合约发起部门id  
180 - DepartmentId string `json:"departmentId"`  
181 - // 共创合约承接对象,1员工,2共创用户,3公开  
182 - CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"`  
183 - // 共创合约名称  
184 - CooperationContractName string `json:"cooperationContractName"`  
185 - // 共创模式编码,  
186 - CooperationModeNumber string `json:"cooperationModeNumber"`  
187 - // 共创合约发起人uid  
188 - SponsorUid string `json:"sponsorUid,omitempty,"`  
189 - // 业绩分红激励规则列表  
190 - DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"`  
191 - // 金额激励规则列表  
192 - MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"`  
193 - // 承接方列表  
194 - Undertakers []Undertaker `json:"undertakers"` 159 + CooperationContractId int `json:"cooperationContractId"` // 共创合约id
  160 + CooperationContractDescription string `json:"cooperationContractDescription"` //共创
  161 + CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
  162 + CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
  163 + DepartmentId string `json:"departmentId"` // 共创合约发起部门id
  164 + CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` // 共创合约承接对象,1员工,2共创用户,3公开
  165 + CooperationContractName string `json:"cooperationContractName"` // 共创合约名称
  166 + CooperationModeNumber string `json:"cooperationModeNumber"` // 共创模式编码,
  167 + SponsorUid string `json:"sponsorUid,omitempty,"` // 共创合约发起人uid
  168 + DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 金额激励规则列表
  169 + MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"`
  170 +
  171 + Undertakers []Undertaker `json:"undertakers"` // 承接方列表 // 业绩分红激励规则列表
195 //关联业务员 172 //关联业务员
196 RelevantIds []string `json:"relevantIds"` 173 RelevantIds []string `json:"relevantIds"`
197 } 174 }
198 175
199 DataCooperationContractUpdate struct { 176 DataCooperationContractUpdate struct {
  177 + CooperationContract
200 } 178 }
201 ) 179 )
202 180
@@ -220,11 +198,11 @@ type ( @@ -220,11 +198,11 @@ type (
220 //根据承接人查询并返回共创项目合约 198 //根据承接人查询并返回共创项目合约
221 type ( 199 type (
222 ReqCooperationContractSearchByUndertaker struct { 200 ReqCooperationContractSearchByUndertaker struct {
223 - CooperationContractName string //合约名称  
224 - SponsorName string //项目发起人姓名  
225 - UserId int //合约发起人  
226 - PageNumber int  
227 - PageIndex int 201 + CooperationContractName string `json:"cooperationContractName"` //合约名称
  202 + SponsorName string `json:"sponsorName"` //项目发起人姓名
  203 + UserId int `json:"userId"` //合约发起人
  204 + PageNumber int `json:"pageNumber"`
  205 + PageIndex int `json:"pageIndex"`
228 } 206 }
229 207
230 DataCooperationContractSearchByUndertaker struct { 208 DataCooperationContractSearchByUndertaker struct {
@@ -234,10 +212,11 @@ type ( @@ -234,10 +212,11 @@ type (
234 //移除共创合约 212 //移除共创合约
235 type ( 213 type (
236 ReqCooperationContractRemove struct { 214 ReqCooperationContractRemove struct {
237 - CooperationContractId int 215 + CooperationContractId int `json:"cooperationContractId"`
238 } 216 }
239 217
240 DataCooperationContractRemove struct { 218 DataCooperationContractRemove struct {
  219 + CooperationContract
241 } 220 }
242 ) 221 )
243 222
@@ -258,5 +237,7 @@ type ( @@ -258,5 +237,7 @@ type (
258 237
259 DataCooperationContractGet struct { 238 DataCooperationContractGet struct {
260 CooperationContract 239 CooperationContract
  240 + // 可以去除勾选的共创项目承接对象列表
  241 + UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"`
261 } 242 }
262 ) 243 )
@@ -41,7 +41,7 @@ func (controller *CooperationContractController) GetCooperationContract() { @@ -41,7 +41,7 @@ func (controller *CooperationContractController) GetCooperationContract() {
41 func (controller *CooperationContractController) ListCooperationContract() { 41 func (controller *CooperationContractController) ListCooperationContract() {
42 cooperationContractService := service.NewCooperationContractService(nil) 42 cooperationContractService := service.NewCooperationContractService(nil)
43 listCooperationContractQuery := &query.ListCooperationContractQuery{} 43 listCooperationContractQuery := &query.ListCooperationContractQuery{}
44 - data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery) 44 + _, data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)
45 controller.Response(data, err) 45 controller.Response(data, err)
46 } 46 }
47 47