作者 yangfu
... ... @@ -9,6 +9,7 @@ type CooperationContractItem struct {
CooperationContractId int `json:"cooperationContractId,string,"`
CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号
CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号
CooperationProjectId string `json:"cooperationProjectId"` //项目编号
CooperationContractName string `json:"cooperationContractName"` //合约名称
Status int `json:"status"` //合约状态
CreateTime int `json:"createTime"`
... ... @@ -33,7 +34,8 @@ func ToCooperationContractItem(param *allied_creation_cooperation.CooperationCon
CooperationContractUndertakerType: cooperationContractUndertakerType,
CooperationContractDescription: param.CooperationContractDescription,
CooperationContractId: param.CooperationContractId,
CooperationProjectNumber: param.CooperationContractNumber,
CooperationProjectNumber: param.CooperationProjectNumber,
CooperationProjectId: param.CooperationProjectNumber,
CooperationContractName: param.CooperationContractName,
CooperationContractNumber: param.CooperationContractNumber,
Status: param.Status,
... ...
... ... @@ -11,7 +11,8 @@ type GetCooperationProjectQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目ID
CooperationProjectId int `json:"cooperationProjectId,string" valid:"Required"`
CooperationProjectId int `json:"cooperationProjectId"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
}
func (getCooperationProjectQuery *GetCooperationProjectQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -74,7 +74,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationProjectQuery.Operator)
resultProject, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
CooperationProjectId: getCooperationProjectQuery.CooperationProjectId,
CooperationProjectId: getCooperationProjectQuery.CooperationProjectId,
CooperationProjectNumber: getCooperationProjectQuery.CooperationProjectNumber,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -207,6 +207,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationContractGet(param Req
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求返回共创合约详情失败:%w", err)
... ...
... ... @@ -76,6 +76,9 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectGet(param ReqC
url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.CooperationProjectId)
method := "GET"
req := gateway.CreateRequest(url, method)
if len(param.CooperationProjectNumber) > 0 {
req.Param("cooperationProjectNumber", param.CooperationProjectNumber)
}
log.Logger.Debug("向业务模块请求数据:返回共创项目详情。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
... ...
... ... @@ -213,11 +213,11 @@ type (
SponsorName string `json:"sponsorName"` //发起人名字
Status int `json:"status"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId"`
CompanyId int64 ` json:"companyId"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
OrgId int64 ` json:"orgId"`
// 用户基础数据id
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId`
UserBaseId int64 `json:"userBaseId"`
}
DataCooperationContractSearch struct {
... ...
... ... @@ -92,7 +92,8 @@ type (
//返回共创项目详情
type (
ReqCooperationProjectGet struct {
CooperationProjectId int
CooperationProjectId int
CooperationProjectNumber string
}
DataCooperationProjectGet struct {
... ...
... ... @@ -41,7 +41,9 @@ func (controller *CooperationProjectController) GetCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
getCooperationProjectQuery := &query.GetCooperationProjectQuery{}
projectId, _ := controller.GetInt(":projectId")
projectNumber := controller.GetString("cooperationProjectNumber")
getCooperationProjectQuery.CooperationProjectId = projectId
getCooperationProjectQuery.CooperationProjectNumber = projectNumber
getCooperationProjectQuery.Operator = controller.GetOperator()
data, err := cooperationProjectService.GetCooperationProject(getCooperationProjectQuery)
controller.Response(data, err)
... ...
... ... @@ -2,14 +2,15 @@ package middleware
import (
"fmt"
log1 "log"
"net/http"
"net/url"
"github.com/beego/beego/v2/server/web"
"github.com/beego/beego/v2/server/web/context"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
log1 "log"
"net/http"
"net/url"
)
type CtxKeyLoginToken struct{}
... ... @@ -64,7 +65,7 @@ func CheckAccessToken(next web.FilterFunc) web.FilterFunc {
return
}
platform := domain.ParsePlatform(ctx.Input.Header("x-mmm-devicetype"))
//redis缓存
// redis缓存
tokenCache := cache.LoginTokenCache{}
token, err := tokenCache.GetAccessToken(tk.Account, platform)
if err != nil {
... ... @@ -138,19 +139,19 @@ func CheckAccessToken2() web.FilterFunc {
log.Logger.Error(err.Error())
return
}
platform := domain.ParsePlatform(ctx.Input.Header("x-mmm-devicetype"))
//redis缓存
tokenCache := cache.LoginTokenCache{}
token, err := tokenCache.GetAccessToken(tk.Account, platform)
if err != nil {
log.Logger.Error(err.Error())
return
}
if token != tokenStr {
log1.Println("token not equal \n" + tk.Account + "\n" + tokenStr + "\n" + token)
err = fmt.Errorf("access token not exists")
return
}
// platform := domain.ParsePlatform(ctx.Input.Header("x-mmm-devicetype"))
// //redis缓存
// tokenCache := cache.LoginTokenCache{}
// token, err := tokenCache.GetAccessToken(tk.Account, platform)
// if err != nil {
// log.Logger.Error(err.Error())
// return
// }
// if token != tokenStr {
// log1.Println("token not equal \n" + tk.Account + "\n" + tokenStr + "\n" + token)
// err = fmt.Errorf("access token not exists")
// return
// }
ctx.Input.SetData(CtxKeyLoginToken{}, tk)
}
}
... ...
... ... @@ -7,6 +7,6 @@ import (
func init() {
web.Router("/v1/web/system-setting/search", &web_client.SystemSettingController{}, "Post:SystemSettingSearch")
web.Router("/v1/web/syetem-setting/get", &web_client.SystemSettingController{}, "Post:SystemSettingGet")
web.Router("/v1/web/syetem-setting", &web_client.SystemSettingController{}, "Put:SystemSettingUpdate")
web.Router("/v1/web/system-setting/get", &web_client.SystemSettingController{}, "Post:SystemSettingGet")
web.Router("/v1/web/system-setting", &web_client.SystemSettingController{}, "Put:SystemSettingUpdate")
}
... ...