作者 tangxuhui

修正 合约相关错误

... ... @@ -14,8 +14,6 @@ type CreateCooperationContractCommand struct {
CooperationContract struct {
// 共创合约描述
CooperationContractDescription string `json:"cooperationContractDescription"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 共创项目编号,
CooperationProjectNumber string `json:"cooperationProjectNumber"`
// 共创合约发起部门id
... ...
... ... @@ -62,13 +62,16 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
Undertakers: underTakers,
RelevantIds: createCooperationContractCommand.RelevantIds,
CooperationContractDescription: createCooperationContractCommand.CooperationContract.CooperationContractDescription,
CooperationContractNumber: createCooperationContractCommand.CooperationContract.CooperationContractNumber,
CooperationProjectNumber: createCooperationContractCommand.CooperationContract.CooperationProjectNumber,
DepartmentId: createCooperationContractCommand.CooperationContract.DepartmentId,
CooperationContractUndertakerType: createCooperationContractCommand.CooperationContract.CooperationContractUndertakerType,
CooperationContractName: createCooperationContractCommand.CooperationContract.CooperationContractName,
CooperationModeNumber: createCooperationContractCommand.CooperationContract.CooperationModeNumber,
SponsorUid: createCooperationContractCommand.CooperationContract.SponsorUid,
CompanyId: int(createCooperationContractCommand.Operator.CompanyId),
UserId: int(createCooperationContractCommand.Operator.UserId),
UserBaseId: int(createCooperationContractCommand.Operator.UserBaseId),
OrgId: int(createCooperationContractCommand.Operator.OrgId),
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -180,6 +183,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
CooperationContractName: updateCooperationContractCommand.CooperationContract.CooperationContractName,
CooperationModeNumber: updateCooperationContractCommand.CooperationContract.CooperationModeNumber,
SponsorUid: updateCooperationContractCommand.CooperationContract.SponsorUid,
CompanyId: int(updateCooperationContractCommand.Operator.CompanyId),
UserId: int(updateCooperationContractCommand.Operator.UserId),
UserBaseId: int(updateCooperationContractCommand.Operator.UserBaseId),
OrgId: int(updateCooperationContractCommand.Operator.OrgId),
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -153,7 +153,7 @@ type (
CooperationContractNumber string `json:"cooperationContractNumber"` // 共创合约编号
CooperationProjectNumber string `json:"cooperationProjectNumber"` // 共创项目编号,
DepartmentId string `json:"departmentId"` // 共创合约发起部门id
CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` // 共创合约承接对象,1员工,2共创用户,3公开
CooperationContractUndertakerType []int `json:"cooperationContractUndertakerTypes"` // 共创合约承接对象,1员工,2共创用户,3公开
CooperationContractName string `json:"cooperationContractName"` // 共创合约名称
CooperationModeNumber string `json:"cooperationModeNumber"` // 共创模式编码,
SponsorUid string `json:"sponsorUid"` // 共创合约发起人uid
... ... @@ -161,6 +161,10 @@ type (
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
}
DataCooperationContractAdd struct {
... ... @@ -182,10 +186,12 @@ type (
SponsorUid string `json:"sponsorUid,omitempty,"` // 共创合约发起人uid
DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` // 金额激励规则列表
MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"`
Undertakers []Undertaker `json:"undertakers"` // 承接方列表 // 业绩分红激励规则列表
//关联业务员
RelevantIds []string `json:"relevantIds"`
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 {
... ...
package web_client
import (
"github.com/linmadan/egglib-go/web/beego"
"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/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type CooperationContractController struct {
beego.BaseController
baseController
}
func (controller *CooperationContractController) CreateCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
createCooperationContractCommand := &command.CreateCooperationContractCommand{}
controller.Unmarshal(createCooperationContractCommand)
err := controller.Unmarshal(createCooperationContractCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
createCooperationContractCommand.Operator = controller.GetOperator()
data, err := cooperationContractService.CreateCooperationContract(createCooperationContractCommand)
controller.Response(data, err)
}
... ... @@ -22,8 +26,12 @@ func (controller *CooperationContractController) CreateCooperationContract() {
func (controller *CooperationContractController) UpdateCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
updateCooperationContractCommand := &command.UpdateCooperationContractCommand{}
controller.Unmarshal(updateCooperationContractCommand)
err := controller.Unmarshal(updateCooperationContractCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
contractId, _ := controller.GetInt(":contractId")
updateCooperationContractCommand.Operator = controller.GetOperator()
updateCooperationContractCommand.CooperationContract.CooperationContractId = contractId
data, err := cooperationContractService.UpdateCooperationContract(updateCooperationContractCommand)
controller.Response(data, err)
... ... @@ -33,6 +41,7 @@ func (controller *CooperationContractController) GetCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
getCooperationContractQuery := &query.GetCooperationContractQuery{}
contractId, _ := controller.GetInt(":contractId")
getCooperationContractQuery.Operator = controller.GetOperator()
getCooperationContractQuery.CooperationContractId = contractId
data, err := cooperationContractService.GetCooperationContract(getCooperationContractQuery)
controller.Response(data, err)
... ... @@ -41,14 +50,22 @@ func (controller *CooperationContractController) GetCooperationContract() {
func (controller *CooperationContractController) ListCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
listCooperationContractQuery := &query.ListCooperationContractQuery{}
_, data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)
controller.Response(data, err)
err := controller.Unmarshal(listCooperationContractQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
listCooperationContractQuery.Operator = controller.GetOperator()
cnt, data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)
controller.ReturnPageListData(int64(cnt), data, err, listCooperationContractQuery.PageNumber)
}
func (controller *CooperationContractController) EnableCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
enableCooperationContractCommand := &command.EnableCooperationContractCommand{}
controller.Unmarshal(enableCooperationContractCommand)
err := controller.Unmarshal(enableCooperationContractCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
data, err := cooperationContractService.EnableCooperationContract(enableCooperationContractCommand)
controller.Response(data, err)
}
... ...