作者 tangxuhui

更新

  1 +package dto
  2 +
  3 +import "time"
  4 +
  5 +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"`
  11 + IncentivesType string `json:"incentivesType"` //Incentives激励方式
  12 + CooperationContractSponsor struct {
  13 + UserId int `json:"userId,string,"`
  14 + UserName string `json:"userName"`
  15 + } `json:"cooperationContractSponsor"` //共创发起人
  16 + CooperationMode struct {
  17 + CooperationModeId int `json:"cooperationModeId,string,"` // 共创模式ID
  18 + CooperationModeNumber string `json:"cooperationModeNumber"` // 共创模式编码,
  19 + CooperationModeName string `json:"cooperationModeName"` // 模式名称,
  20 + } `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"` //发起企业
  26 + } `json:"org"` //组织结构
  27 +}
  28 +
  29 +type CooperationContractInfo struct {
  30 +}
@@ -21,7 +21,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -21,7 +21,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
21 if err != nil { 21 if err != nil {
22 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 22 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
23 } 23 }
24 - return nil, err 24 + return createCooperationContractCommand, err
25 } 25 }
26 26
27 // 暂停恢复共创合约 27 // 暂停恢复共创合约
@@ -53,6 +53,12 @@ func (cooperationContractService *CooperationContractService) ListCooperationCon @@ -53,6 +53,12 @@ func (cooperationContractService *CooperationContractService) ListCooperationCon
53 if err := listCooperationContractQuery.ValidateQuery(); err != nil { 53 if err := listCooperationContractQuery.ValidateQuery(); err != nil {
54 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 54 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
55 } 55 }
  56 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationContractQuery.Operator)
  57 + result, err := creationCooperationGateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{})
  58 + if err != nil {
  59 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  60 + }
  61 + _ = result
56 return nil, nil 62 return nil, nil
57 } 63 }
58 64
@@ -119,6 +119,10 @@ type ( @@ -119,6 +119,10 @@ type (
119 //查询共创合约 119 //查询共创合约
120 type ( 120 type (
121 ReqCooperationContractSearch struct { 121 ReqCooperationContractSearch struct {
  122 + // 查询偏离量
  123 + PageNumber int `json:"pageNumber"`
  124 + // 查询限制
  125 + PageSize int `json:"pageSize" valid:"Required"`
122 } 126 }
123 127
124 DataCooperationContractSearch struct { 128 DataCooperationContractSearch struct {
@@ -161,7 +165,7 @@ type ( @@ -161,7 +165,7 @@ type (
161 //返回共创合约详情 165 //返回共创合约详情
162 type ( 166 type (
163 ReqCooperationContractGet struct { 167 ReqCooperationContractGet struct {
164 - CooperationContractId int 168 + CooperationContractId int `json:"cooperationContractId"`
165 } 169 }
166 170
167 DataCooperationContractGet struct { 171 DataCooperationContractGet struct {
@@ -19,23 +19,15 @@ func (controller *baseController) returnPageListData(count int64, data interface @@ -19,23 +19,15 @@ func (controller *baseController) returnPageListData(count int64, data interface
19 controller.Response(dataMap, err) 19 controller.Response(dataMap, err)
20 } 20 }
21 21
22 -func (controller *baseController) GetUserId() int64 {  
23 - return 1  
24 -}  
25 -  
26 -func (controller *baseController) GetCompanyId() int64 {  
27 - return 1  
28 -}  
29 -  
30 -func (controller *baseController) GetUserBaseId() int64 {  
31 - return 1  
32 -}  
33 -  
34 -func (controller *baseController) GetOrgId() int64 {  
35 - return 1  
36 -}  
37 -  
38 func (controller *baseController) GetOperator() domain.Operator { 22 func (controller *baseController) GetOperator() domain.Operator {
  23 +
  24 + // tk, _ := middleware.FormCtxLoginToken(controller.Ctx)
  25 + // operator := domain.Operator{
  26 + // UserId: tk.UserId,
  27 + // CompanyId: tk.CompanyId,
  28 + // OrgId: tk.OrgId,
  29 + // UserBaseId: tk.UserBaseId,
  30 + // }
39 return domain.Operator{ 31 return domain.Operator{
40 UserId: 9, 32 UserId: 9,
41 CompanyId: 23, 33 CompanyId: 23,
1 package middleware 1 package middleware
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web/context"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  6 +)
  7 +
  8 +type CtxKeyLoginToken struct{}
  9 +
  10 +func JWTAuth(ctx *context.Context) {
  11 + tokenStr := ctx.Input.Header("xxxx")
  12 + tk := domain.LoginToken{}
  13 + err := tk.ParseToken(tokenStr)
  14 + if err != nil {
  15 + //
  16 + return
  17 + }
  18 + ctx.Input.SetData(CtxKeyLoginToken{}, domain.LoginToken{})
  19 +}
  20 +
  21 +func NewCtxLoginToken(ctx *context.Context, tk domain.LoginToken) {
  22 + ctx.Input.SetData(CtxKeyLoginToken{}, domain.LoginToken{})
  23 +}
  24 +
  25 +func FormCtxLoginToken(ctx *context.Context) (domain.LoginToken, bool) {
  26 + val := ctx.Input.GetData(CtxKeyLoginToken{})
  27 + if v, ok := val.(domain.LoginToken); ok {
  28 + return v, true
  29 + }
  30 + return domain.LoginToken{}, false
  31 +}