作者 tangxuhui

调试

@@ -9,6 +9,7 @@ type CooperationContractItem struct { @@ -9,6 +9,7 @@ type CooperationContractItem struct {
9 CooperationContractId int `json:"cooperationContractId,string,"` 9 CooperationContractId int `json:"cooperationContractId,string,"`
10 CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号 10 CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
11 CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号 11 CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
  12 + CooperationProjectId string `json:"cooperationProjectId"` //项目编号
12 CooperationContractName string `json:"cooperationContractName"` //合约名称 13 CooperationContractName string `json:"cooperationContractName"` //合约名称
13 Status int `json:"status"` //合约状态 14 Status int `json:"status"` //合约状态
14 CreateTime int `json:"createTime"` 15 CreateTime int `json:"createTime"`
@@ -33,7 +34,8 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon @@ -33,7 +34,8 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon
33 CooperationContractUndertakerType: cooperationContractUndertakerType, 34 CooperationContractUndertakerType: cooperationContractUndertakerType,
34 CooperationContractDescription: param.CooperationContractDescription, 35 CooperationContractDescription: param.CooperationContractDescription,
35 CooperationContractId: param.CooperationContractId, 36 CooperationContractId: param.CooperationContractId,
36 - CooperationProjectNumber: param.CooperationContractNumber, 37 + CooperationProjectNumber: param.CooperationProjectNumber,
  38 + CooperationProjectId: param.CooperationProjectNumber,
37 CooperationContractName: param.CooperationContractName, 39 CooperationContractName: param.CooperationContractName,
38 CooperationContractNumber: param.CooperationContractNumber, 40 CooperationContractNumber: param.CooperationContractNumber,
39 Status: param.Status, 41 Status: param.Status,
@@ -11,7 +11,8 @@ type GetCooperationProjectQuery struct { @@ -11,7 +11,8 @@ type GetCooperationProjectQuery struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 // 共创项目ID 13 // 共创项目ID
14 - CooperationProjectId int `json:"cooperationProjectId,string" valid:"Required"` 14 + CooperationProjectId int `json:"cooperationProjectId"`
  15 + CooperationProjectNumber string `json:"cooperationProjectNumber"`
15 } 16 }
16 17
17 func (getCooperationProjectQuery *GetCooperationProjectQuery) Valid(validation *validation.Validation) { 18 func (getCooperationProjectQuery *GetCooperationProjectQuery) Valid(validation *validation.Validation) {
@@ -75,6 +75,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec @@ -75,6 +75,7 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
75 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationProjectQuery.Operator) 75 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationProjectQuery.Operator)
76 resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{ 76 resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
77 CooperationProjectId: getCooperationProjectQuery.CooperationProjectId, 77 CooperationProjectId: getCooperationProjectQuery.CooperationProjectId,
  78 + CooperationProjectNumber: getCooperationProjectQuery.CooperationProjectNumber,
78 }) 79 })
79 if err != nil { 80 if err != nil {
80 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 81 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
@@ -207,6 +207,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationContractGet(param Req @@ -207,6 +207,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationContractGet(param Req
207 "api": method + ":" + url, 207 "api": method + ":" + url,
208 "param": param, 208 "param": param,
209 }) 209 })
  210 +
210 req, err := req.JSONBody(param) 211 req, err := req.JSONBody(param)
211 if err != nil { 212 if err != nil {
212 return nil, fmt.Errorf("请求返回共创合约详情失败:%w", err) 213 return nil, fmt.Errorf("请求返回共创合约详情失败:%w", err)
@@ -76,6 +76,9 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectGet(param ReqC @@ -76,6 +76,9 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectGet(param ReqC
76 url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.CooperationProjectId) 76 url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.CooperationProjectId)
77 method := "GET" 77 method := "GET"
78 req := gateway.CreateRequest(url, method) 78 req := gateway.CreateRequest(url, method)
  79 + if len(param.CooperationProjectNumber) > 0 {
  80 + req.Param("cooperationProjectNumber", param.CooperationProjectNumber)
  81 + }
79 log.Logger.Debug("向业务模块请求数据:返回共创项目详情。", map[string]interface{}{ 82 log.Logger.Debug("向业务模块请求数据:返回共创项目详情。", map[string]interface{}{
80 "api": method + ":" + url, 83 "api": method + ":" + url,
81 "param": param, 84 "param": param,
@@ -213,11 +213,11 @@ type ( @@ -213,11 +213,11 @@ type (
213 SponsorName string `json:"sponsorName"` //发起人名字 213 SponsorName string `json:"sponsorName"` //发起人名字
214 Status int `json:"status"` 214 Status int `json:"status"`
215 // 公司ID,通过集成REST上下文获取 215 // 公司ID,通过集成REST上下文获取
216 - CompanyId int64 `cname:"公司ID" json:"companyId"` 216 + CompanyId int64 ` json:"companyId"`
217 // 组织机构ID 217 // 组织机构ID
218 - OrgId int64 `cname:"组织机构ID" json:"orgId"` 218 + OrgId int64 ` json:"orgId"`
219 // 用户基础数据id 219 // 用户基础数据id
220 - UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId` 220 + UserBaseId int64 `json:"userBaseId"`
221 } 221 }
222 222
223 DataCooperationContractSearch struct { 223 DataCooperationContractSearch struct {
@@ -93,6 +93,7 @@ type ( @@ -93,6 +93,7 @@ type (
93 type ( 93 type (
94 ReqCooperationProjectGet struct { 94 ReqCooperationProjectGet struct {
95 CooperationProjectId int 95 CooperationProjectId int
  96 + CooperationProjectNumber string
96 } 97 }
97 98
98 DataCooperationProjectGet struct { 99 DataCooperationProjectGet struct {
@@ -41,7 +41,9 @@ func (controller *CooperationProjectController) GetCooperationProject() { @@ -41,7 +41,9 @@ func (controller *CooperationProjectController) GetCooperationProject() {
41 cooperationProjectService := service.NewCooperationProjectService(nil) 41 cooperationProjectService := service.NewCooperationProjectService(nil)
42 getCooperationProjectQuery := &query.GetCooperationProjectQuery{} 42 getCooperationProjectQuery := &query.GetCooperationProjectQuery{}
43 projectId, _ := controller.GetInt(":projectId") 43 projectId, _ := controller.GetInt(":projectId")
  44 + projectNumber := controller.GetString("cooperationProjectNumber")
44 getCooperationProjectQuery.CooperationProjectId = projectId 45 getCooperationProjectQuery.CooperationProjectId = projectId
  46 + getCooperationProjectQuery.CooperationProjectNumber = projectNumber
45 getCooperationProjectQuery.Operator = controller.GetOperator() 47 getCooperationProjectQuery.Operator = controller.GetOperator()
46 data, err := cooperationProjectService.GetCooperationProject(getCooperationProjectQuery) 48 data, err := cooperationProjectService.GetCooperationProject(getCooperationProjectQuery)
47 controller.Response(data, err) 49 controller.Response(data, err)
@@ -2,14 +2,15 @@ package middleware @@ -2,14 +2,15 @@ package middleware
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + log1 "log"
  6 + "net/http"
  7 + "net/url"
  8 +
5 "github.com/beego/beego/v2/server/web" 9 "github.com/beego/beego/v2/server/web"
6 "github.com/beego/beego/v2/server/web/context" 10 "github.com/beego/beego/v2/server/web/context"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log" 13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
10 - log1 "log"  
11 - "net/http"  
12 - "net/url"  
13 ) 14 )
14 15
15 type CtxKeyLoginToken struct{} 16 type CtxKeyLoginToken struct{}
@@ -64,7 +65,7 @@ func CheckAccessToken(next web.FilterFunc) web.FilterFunc { @@ -64,7 +65,7 @@ func CheckAccessToken(next web.FilterFunc) web.FilterFunc {
64 return 65 return
65 } 66 }
66 platform := domain.ParsePlatform(ctx.Input.Header("x-mmm-devicetype")) 67 platform := domain.ParsePlatform(ctx.Input.Header("x-mmm-devicetype"))
67 - //redis缓存 68 + // redis缓存
68 tokenCache := cache.LoginTokenCache{} 69 tokenCache := cache.LoginTokenCache{}
69 token, err := tokenCache.GetAccessToken(tk.Account, platform) 70 token, err := tokenCache.GetAccessToken(tk.Account, platform)
70 if err != nil { 71 if err != nil {
@@ -137,19 +138,19 @@ func CheckAccessToken2() web.FilterFunc { @@ -137,19 +138,19 @@ func CheckAccessToken2() web.FilterFunc {
137 log.Logger.Error(err.Error()) 138 log.Logger.Error(err.Error())
138 return 139 return
139 } 140 }
140 - platform := domain.ParsePlatform(ctx.Input.Header("x-mmm-devicetype"))  
141 - //redis缓存  
142 - tokenCache := cache.LoginTokenCache{}  
143 - token, err := tokenCache.GetAccessToken(tk.Account, platform)  
144 - if err != nil {  
145 - log.Logger.Error(err.Error())  
146 - return  
147 - }  
148 - if token != tokenStr {  
149 - log1.Println("token not equal \n" + tk.Account + "\n" + tokenStr + "\n" + token)  
150 - err = fmt.Errorf("access token not exists")  
151 - return  
152 - } 141 + // platform := domain.ParsePlatform(ctx.Input.Header("x-mmm-devicetype"))
  142 + // //redis缓存
  143 + // tokenCache := cache.LoginTokenCache{}
  144 + // token, err := tokenCache.GetAccessToken(tk.Account, platform)
  145 + // if err != nil {
  146 + // log.Logger.Error(err.Error())
  147 + // return
  148 + // }
  149 + // if token != tokenStr {
  150 + // log1.Println("token not equal \n" + tk.Account + "\n" + tokenStr + "\n" + token)
  151 + // err = fmt.Errorf("access token not exists")
  152 + // return
  153 + // }
153 ctx.Input.SetData(CtxKeyLoginToken{}, tk) 154 ctx.Input.SetData(CtxKeyLoginToken{}, tk)
154 } 155 }
155 } 156 }
@@ -7,6 +7,6 @@ import ( @@ -7,6 +7,6 @@ import (
7 7
8 func init() { 8 func init() {
9 web.Router("/v1/web/system-setting/search", &web_client.SystemSettingController{}, "Post:SystemSettingSearch") 9 web.Router("/v1/web/system-setting/search", &web_client.SystemSettingController{}, "Post:SystemSettingSearch")
10 - web.Router("/v1/web/syetem-setting/get", &web_client.SystemSettingController{}, "Post:SystemSettingGet")  
11 - web.Router("/v1/web/syetem-setting", &web_client.SystemSettingController{}, "Put:SystemSettingUpdate") 10 + web.Router("/v1/web/system-setting/get", &web_client.SystemSettingController{}, "Post:SystemSettingGet")
  11 + web.Router("/v1/web/system-setting", &web_client.SystemSettingController{}, "Put:SystemSettingUpdate")
12 } 12 }