作者 yangfu
... ... @@ -4,10 +4,9 @@ import (
"github.com/beego/beego/v2/server/web"
"github.com/linmadan/egglib-go/log/logrus"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego"
)
... ...
... ... @@ -48,23 +48,49 @@ type CooperationProjectInfo struct {
DepartmentName string `json:"departmentName"`
} `json:"department"` //项目发起部门
Status int `json:"status"` // 共创项目状态,1招标中,2结束
// 可以去除勾选的共创项目承接对象列表
UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"`
// 承接人
Applicants []struct {
UserId int64 `json:"userId,string"`
UserBaseId int64 `json:"userBaseId,string"` // 用户基本id
Org struct {
OrgId int64 `json:"orgId,string"` // 组织机构ID
OrgName string `json:"orgName"` // 组织名称
} `json:"org"` // 用户所属组织机构
Department struct {
DepartmentId int64 `json:"departmentId,string"` // 部门ID,
DepartmentName string `json:"departmentName"` // 部门名称
DepartmentNumber string `json:"departmentNumber"` // 部门编码
} `json:"department"` // 用户所属的部门
UserInfo struct {
UserAvatar string `json:"userAvatar"` // 用户头像
UserEmail string `json:"userEmail"` // 用户邮箱
UserName string `json:"userName"` // 共创人员姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserAccount string `json:"userAccount"` // 用户账号,
UserCode string `json:"userCode"` // 用户编码
} `json:"userInfo,omitempty"`
} `json:"applicants"`
}
func ToCooperationProjectInfo(param *allied_creation_cooperation.CooperationProject) *CooperationProjectInfo {
data := CooperationProjectInfo{
Company: param.Company,
Org: param.Org,
CooperationMode: param.CooperationMode,
CooperationProjectDescription: param.CooperationProjectDescription,
CooperationProjectId: param.CooperationProjectId,
CooperationProjectName: param.CooperationProjectName,
CooperationProjectNumber: param.CooperationProjectNumber,
CooperationProjectPublishTime: param.CooperationProjectPublishTime,
CreatedAt: param.CreatedAt,
CooperationProjectUndertakerType: param.CooperationProjectUndertakerType,
Department: param.Department,
Status: param.Status,
Images: param.Attachment,
Company: param.Company,
Org: param.Org,
CooperationMode: param.CooperationMode,
CooperationProjectDescription: param.CooperationProjectDescription,
CooperationProjectId: param.CooperationProjectId,
CooperationProjectName: param.CooperationProjectName,
CooperationProjectNumber: param.CooperationProjectNumber,
CooperationProjectPublishTime: param.CooperationProjectPublishTime,
CreatedAt: param.CreatedAt,
CooperationProjectUndertakerType: param.CooperationProjectUndertakerType,
Department: param.Department,
Status: param.Status,
Images: param.Attachment,
UndertakerTypesUncheckedAvailable: param.UndertakerTypesUncheckedAvailable,
Applicants: param.Applicants,
}
data.CooperationProjectSponsor.UsersCode = param.CooperationProjectSponsor.UserInfo.UsersCode
... ...
... ... @@ -3,6 +3,7 @@ package pg
import (
"context"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
... ...
... ... @@ -152,6 +152,7 @@ func (repository *LoginAccessRepository) Find(queryOptions map[string]interface{
}
return int64(count), loginAccesss, nil
}
}
func NewLoginAccessRepository(transactionContext *pgTransaction.TransactionContext) (*LoginAccessRepository, error) {
if transactionContext == nil {
... ...
... ... @@ -387,26 +387,26 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsOneclickA
url := gateway.baseUrL + "/cooperation-applications/oneclick-approval"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:共创申请批量审核。", map[string]interface{}{
log.Logger.Debug("向业务模块请求数据:共创申请一键审核。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求共创申请批量审核失败:%w", err)
return nil, fmt.Errorf("请求共创申请一键审核失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取共创申请批量审核失败:%w", err)
return nil, fmt.Errorf("获取共创申请一键审核失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:共创申请批量审核。", map[string]interface{}{
log.Logger.Debug("获取业务模块请求数据:共创申请一键审核。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析共创申请批量审核:%w", err)
return nil, fmt.Errorf("解析共创申请一键审核:%w", err)
}
var data DataCooperationApplicationOneclickApproval
err = gateway.GetResponseData(result, &data)
... ... @@ -418,26 +418,26 @@ func (gateway HttplibAlliedCreationCooperation) ApplyForCooperation(param ReqApp
url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.CooperationProjectId) + "/apply-for-cooperation"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:创建共创申请。", map[string]interface{}{
log.Logger.Debug("向业务模块请求数据:申请共创项目。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求创建共创申请失败:%w", err)
return nil, fmt.Errorf("请求申请共创项目失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取创建共创申请失败:%w", err)
return nil, fmt.Errorf("获取申请共创项目失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:创建共创申请。", map[string]interface{}{
log.Logger.Debug("获取业务模块请求数据:申请共创项目。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析创建共创申请:%w", err)
return nil, fmt.Errorf("解析申请共创项目:%w", err)
}
var data DataApplyForCooperation
err = gateway.GetResponseData(result, &data)
... ...
... ... @@ -60,6 +60,30 @@ type CooperationProject struct {
DepartmentName string `json:"departmentName"`
} `json:"department"` //项目发起部门
Status int `json:"status"` // 共创项目状态,1招标中,2结束
// 可以去除勾选的共创项目承接对象列表
UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"`
// 承接人
Applicants []struct {
UserId int64 `json:"userId,string"`
UserBaseId int64 `json:"userBaseId,string"` // 用户基本id
Org struct {
OrgId int64 `json:"orgId,string"` // 组织机构ID
OrgName string `json:"orgName"` // 组织名称
} `json:"org"` // 用户所属组织机构
Department struct {
DepartmentId int64 `json:"departmentId,string"` // 部门ID,
DepartmentName string `json:"departmentName"` // 部门名称
DepartmentNumber string `json:"departmentNumber"` // 部门编码
} `json:"department"` // 用户所属的部门
UserInfo struct {
UserAvatar string `json:"userAvatar"` // 用户头像
UserEmail string `json:"userEmail"` // 用户邮箱
UserName string `json:"userName"` // 共创人员姓名
UserPhone string `json:"userPhone"` // 用户手机号
UserAccount string `json:"userAccount"` // 用户账号,
UserCode string `json:"userCode"` // 用户编码
} `json:"userInfo,omitempty"`
} `json:"applicants"`
}
//创建共创项目
... ...