作者 tangxuhui

修正 合约相关错误

@@ -14,8 +14,6 @@ type CreateCooperationContractCommand struct { @@ -14,8 +14,6 @@ type CreateCooperationContractCommand struct {
14 CooperationContract struct { 14 CooperationContract struct {
15 // 共创合约描述 15 // 共创合约描述
16 CooperationContractDescription string `json:"cooperationContractDescription"` 16 CooperationContractDescription string `json:"cooperationContractDescription"`
17 - // 共创合约编号  
18 - CooperationContractNumber string `json:"cooperationContractNumber"`  
19 // 共创项目编号, 17 // 共创项目编号,
20 CooperationProjectNumber string `json:"cooperationProjectNumber"` 18 CooperationProjectNumber string `json:"cooperationProjectNumber"`
21 // 共创合约发起部门id 19 // 共创合约发起部门id
@@ -62,13 +62,16 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -62,13 +62,16 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
62 Undertakers: underTakers, 62 Undertakers: underTakers,
63 RelevantIds: createCooperationContractCommand.RelevantIds, 63 RelevantIds: createCooperationContractCommand.RelevantIds,
64 CooperationContractDescription: createCooperationContractCommand.CooperationContract.CooperationContractDescription, 64 CooperationContractDescription: createCooperationContractCommand.CooperationContract.CooperationContractDescription,
65 - CooperationContractNumber: createCooperationContractCommand.CooperationContract.CooperationContractNumber,  
66 CooperationProjectNumber: createCooperationContractCommand.CooperationContract.CooperationProjectNumber, 65 CooperationProjectNumber: createCooperationContractCommand.CooperationContract.CooperationProjectNumber,
67 DepartmentId: createCooperationContractCommand.CooperationContract.DepartmentId, 66 DepartmentId: createCooperationContractCommand.CooperationContract.DepartmentId,
68 CooperationContractUndertakerType: createCooperationContractCommand.CooperationContract.CooperationContractUndertakerType, 67 CooperationContractUndertakerType: createCooperationContractCommand.CooperationContract.CooperationContractUndertakerType,
69 CooperationContractName: createCooperationContractCommand.CooperationContract.CooperationContractName, 68 CooperationContractName: createCooperationContractCommand.CooperationContract.CooperationContractName,
70 CooperationModeNumber: createCooperationContractCommand.CooperationContract.CooperationModeNumber, 69 CooperationModeNumber: createCooperationContractCommand.CooperationContract.CooperationModeNumber,
71 SponsorUid: createCooperationContractCommand.CooperationContract.SponsorUid, 70 SponsorUid: createCooperationContractCommand.CooperationContract.SponsorUid,
  71 + CompanyId: int(createCooperationContractCommand.Operator.CompanyId),
  72 + UserId: int(createCooperationContractCommand.Operator.UserId),
  73 + UserBaseId: int(createCooperationContractCommand.Operator.UserBaseId),
  74 + OrgId: int(createCooperationContractCommand.Operator.OrgId),
72 }) 75 })
73 if err != nil { 76 if err != nil {
74 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 77 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -180,6 +183,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -180,6 +183,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
180 CooperationContractName: updateCooperationContractCommand.CooperationContract.CooperationContractName, 183 CooperationContractName: updateCooperationContractCommand.CooperationContract.CooperationContractName,
181 CooperationModeNumber: updateCooperationContractCommand.CooperationContract.CooperationModeNumber, 184 CooperationModeNumber: updateCooperationContractCommand.CooperationContract.CooperationModeNumber,
182 SponsorUid: updateCooperationContractCommand.CooperationContract.SponsorUid, 185 SponsorUid: updateCooperationContractCommand.CooperationContract.SponsorUid,
  186 + CompanyId: int(updateCooperationContractCommand.Operator.CompanyId),
  187 + UserId: int(updateCooperationContractCommand.Operator.UserId),
  188 + UserBaseId: int(updateCooperationContractCommand.Operator.UserBaseId),
  189 + OrgId: int(updateCooperationContractCommand.Operator.OrgId),
183 }) 190 })
184 if err != nil { 191 if err != nil {
185 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 192 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -149,18 +149,22 @@ type ( @@ -149,18 +149,22 @@ type (
149 } 149 }
150 150
151 ReqCooperationContractAdd struct { 151 ReqCooperationContractAdd struct {
152 - CooperationContractDescription string `json:"cooperationContractDescription"` // 共创合约描述  
153 - CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号  
154 - CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,  
155 - DepartmentId string `json:"departmentId"` // 共创合约发起部门id  
156 - CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` // 共创合约承接对象,1员工,2共创用户,3公开  
157 - CooperationContractName string `json:"cooperationContractName"` // 共创合约名称  
158 - CooperationModeNumber string `json:"cooperationModeNumber"` // 共创模式编码,  
159 - SponsorUid string `json:"sponsorUid"` // 共创合约发起人uid  
160 - DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 业绩分红激励规则列表  
161 - MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` // 金额激励规则列表  
162 - Undertakers []Undertaker `json:"undertakers"` // 承接方列表  
163 - RelevantIds []string `json:"relevantIds"` //关联业务员 152 + CooperationContractDescription string `json:"cooperationContractDescription"` // 共创合约描述
  153 + CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
  154 + CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
  155 + DepartmentId string `json:"departmentId"` // 共创合约发起部门id
  156 + CooperationContractUndertakerType []int `json:"cooperationContractUndertakerTypes"` // 共创合约承接对象,1员工,2共创用户,3公开
  157 + CooperationContractName string `json:"cooperationContractName"` // 共创合约名称
  158 + CooperationModeNumber string `json:"cooperationModeNumber"` // 共创模式编码,
  159 + SponsorUid string `json:"sponsorUid"` // 共创合约发起人uid
  160 + DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 业绩分红激励规则列表
  161 + MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` // 金额激励规则列表
  162 + Undertakers []Undertaker `json:"undertakers"` // 承接方列表
  163 + RelevantIds []string `json:"relevantIds"` //关联业务员
  164 + CompanyId int `json:"companyId,string"`
  165 + OrgId int `json:"orgId,string"` // 组织机构ID
  166 + UserId int ` json:"userId,string"` // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
  167 + UserBaseId int `json:"userBaseId,string" ` // 用户基础数据id
164 } 168 }
165 169
166 DataCooperationContractAdd struct { 170 DataCooperationContractAdd struct {
@@ -182,10 +186,12 @@ type ( @@ -182,10 +186,12 @@ type (
182 SponsorUid string `json:"sponsorUid,omitempty,"` // 共创合约发起人uid 186 SponsorUid string `json:"sponsorUid,omitempty,"` // 共创合约发起人uid
183 DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 金额激励规则列表 187 DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 金额激励规则列表
184 MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` 188 MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"`
185 -  
186 - Undertakers []Undertaker `json:"undertakers"` // 承接方列表 // 业绩分红激励规则列表  
187 - //关联业务员  
188 - RelevantIds []string `json:"relevantIds"` 189 + Undertakers []Undertaker `json:"undertakers"` // 承接方列表 // 业绩分红激励规则列表
  190 + RelevantIds []string `json:"relevantIds"` //关联业务员
  191 + CompanyId int `json:"companyId,string"`
  192 + OrgId int `json:"orgId,string"` // 组织机构ID
  193 + UserId int ` json:"userId,string"` // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
  194 + UserBaseId int `json:"userBaseId,string" ` // 用户基础数据id
189 } 195 }
190 196
191 DataCooperationContractUpdate struct { 197 DataCooperationContractUpdate struct {
1 package web_client 1 package web_client
2 2
3 import ( 3 import (
4 - "github.com/linmadan/egglib-go/web/beego"  
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/command" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/command"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/query" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/query"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/service" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/service"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
8 ) 8 )
9 9
10 type CooperationContractController struct { 10 type CooperationContractController struct {
11 - beego.BaseController 11 + baseController
12 } 12 }
13 13
14 func (controller *CooperationContractController) CreateCooperationContract() { 14 func (controller *CooperationContractController) CreateCooperationContract() {
15 cooperationContractService := service.NewCooperationContractService(nil) 15 cooperationContractService := service.NewCooperationContractService(nil)
16 createCooperationContractCommand := &command.CreateCooperationContractCommand{} 16 createCooperationContractCommand := &command.CreateCooperationContractCommand{}
17 - controller.Unmarshal(createCooperationContractCommand) 17 + err := controller.Unmarshal(createCooperationContractCommand)
  18 + if err != nil {
  19 + log.Logger.Debug("json err:" + err.Error())
  20 + }
  21 + createCooperationContractCommand.Operator = controller.GetOperator()
18 data, err := cooperationContractService.CreateCooperationContract(createCooperationContractCommand) 22 data, err := cooperationContractService.CreateCooperationContract(createCooperationContractCommand)
19 controller.Response(data, err) 23 controller.Response(data, err)
20 } 24 }
@@ -22,8 +26,12 @@ func (controller *CooperationContractController) CreateCooperationContract() { @@ -22,8 +26,12 @@ func (controller *CooperationContractController) CreateCooperationContract() {
22 func (controller *CooperationContractController) UpdateCooperationContract() { 26 func (controller *CooperationContractController) UpdateCooperationContract() {
23 cooperationContractService := service.NewCooperationContractService(nil) 27 cooperationContractService := service.NewCooperationContractService(nil)
24 updateCooperationContractCommand := &command.UpdateCooperationContractCommand{} 28 updateCooperationContractCommand := &command.UpdateCooperationContractCommand{}
25 - controller.Unmarshal(updateCooperationContractCommand) 29 + err := controller.Unmarshal(updateCooperationContractCommand)
  30 + if err != nil {
  31 + log.Logger.Debug("json err:" + err.Error())
  32 + }
26 contractId, _ := controller.GetInt(":contractId") 33 contractId, _ := controller.GetInt(":contractId")
  34 + updateCooperationContractCommand.Operator = controller.GetOperator()
27 updateCooperationContractCommand.CooperationContract.CooperationContractId = contractId 35 updateCooperationContractCommand.CooperationContract.CooperationContractId = contractId
28 data, err := cooperationContractService.UpdateCooperationContract(updateCooperationContractCommand) 36 data, err := cooperationContractService.UpdateCooperationContract(updateCooperationContractCommand)
29 controller.Response(data, err) 37 controller.Response(data, err)
@@ -33,6 +41,7 @@ func (controller *CooperationContractController) GetCooperationContract() { @@ -33,6 +41,7 @@ func (controller *CooperationContractController) GetCooperationContract() {
33 cooperationContractService := service.NewCooperationContractService(nil) 41 cooperationContractService := service.NewCooperationContractService(nil)
34 getCooperationContractQuery := &query.GetCooperationContractQuery{} 42 getCooperationContractQuery := &query.GetCooperationContractQuery{}
35 contractId, _ := controller.GetInt(":contractId") 43 contractId, _ := controller.GetInt(":contractId")
  44 + getCooperationContractQuery.Operator = controller.GetOperator()
36 getCooperationContractQuery.CooperationContractId = contractId 45 getCooperationContractQuery.CooperationContractId = contractId
37 data, err := cooperationContractService.GetCooperationContract(getCooperationContractQuery) 46 data, err := cooperationContractService.GetCooperationContract(getCooperationContractQuery)
38 controller.Response(data, err) 47 controller.Response(data, err)
@@ -41,14 +50,22 @@ func (controller *CooperationContractController) GetCooperationContract() { @@ -41,14 +50,22 @@ func (controller *CooperationContractController) GetCooperationContract() {
41 func (controller *CooperationContractController) ListCooperationContract() { 50 func (controller *CooperationContractController) ListCooperationContract() {
42 cooperationContractService := service.NewCooperationContractService(nil) 51 cooperationContractService := service.NewCooperationContractService(nil)
43 listCooperationContractQuery := &query.ListCooperationContractQuery{} 52 listCooperationContractQuery := &query.ListCooperationContractQuery{}
44 - _, data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)  
45 - controller.Response(data, err) 53 + err := controller.Unmarshal(listCooperationContractQuery)
  54 + if err != nil {
  55 + log.Logger.Debug("json err:" + err.Error())
  56 + }
  57 + listCooperationContractQuery.Operator = controller.GetOperator()
  58 + cnt, data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)
  59 + controller.ReturnPageListData(int64(cnt), data, err, listCooperationContractQuery.PageNumber)
46 } 60 }
47 61
48 func (controller *CooperationContractController) EnableCooperationContract() { 62 func (controller *CooperationContractController) EnableCooperationContract() {
49 cooperationContractService := service.NewCooperationContractService(nil) 63 cooperationContractService := service.NewCooperationContractService(nil)
50 enableCooperationContractCommand := &command.EnableCooperationContractCommand{} 64 enableCooperationContractCommand := &command.EnableCooperationContractCommand{}
51 - controller.Unmarshal(enableCooperationContractCommand) 65 + err := controller.Unmarshal(enableCooperationContractCommand)
  66 + if err != nil {
  67 + log.Logger.Debug("json err:" + err.Error())
  68 + }
52 data, err := cooperationContractService.EnableCooperationContract(enableCooperationContractCommand) 69 data, err := cooperationContractService.EnableCooperationContract(enableCooperationContractCommand)
53 controller.Response(data, err) 70 controller.Response(data, err)
54 } 71 }