作者 tangxuhui

接口调整

... ... @@ -15,7 +15,8 @@ type CreateCooperationApplicationCommand struct {
// 申请人的id
//ApplicantUid int `json:"userId"`
//
CooperationProjectNumber string `json:"cooperationProjectNumber"`
CooperationProjectId int `json:"cooperationProjectId"`
// CooperationProjectNumber string `json:"cooperationProjectNumber"`
// 附件列表
Attachment []domain.Attachment `json:"attachment"`
}
... ...
... ... @@ -95,11 +95,10 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat
func (srv CooperationApplicationsService) CreateCooperationApplications(createApplicationsCommand *command.CreateCooperationApplicationCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
createApplicationsCommand.Operator)
result, err := creationCooperationGateway.CooperationApplicationAdd(allied_creation_cooperation.ReqCooperationApplicationAdd{
ApplicantUid: strconv.Itoa(int(createApplicationsCommand.Operator.UserId)),
result, err := creationCooperationGateway.ApplyForCooperation(allied_creation_cooperation.ReqApplyForCooperation{
CooperationApplicationDescription: createApplicationsCommand.CooperationApplicationDescription,
CooperationProjectId: createApplicationsCommand.CooperationProjectId,
CooperationApplicationAttachment: createApplicationsCommand.Attachment,
CooperationProjectNumber: createApplicationsCommand.CooperationProjectNumber,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -412,3 +412,34 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsOneclickA
err = gateway.GetResponseData(result, &data)
return &data, err
}
// ApplyForCooperation 申请共创项目
func (gateway HttplibAlliedCreationCooperation) ApplyForCooperation(param ReqApplyForCooperation) (*DataApplyForCooperation, error) {
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{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求创建共创申请失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取创建共创申请失败:%w", err)
}
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)
}
var data DataApplyForCooperation
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -233,3 +233,20 @@ type (
DataCooperationApplicationOneclickApproval struct {
}
)
//申请共创项目
type (
ReqApplyForCooperation struct {
// 共创申请人uid
// ApplicantUid string `json:"-" `
// 共创申请描述
CooperationApplicationDescription string ` json:"cooperationApplicationDescription"`
// 共创申请描述附件
CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"`
// 关联的共创项目id
CooperationProjectId int `json:"cooperationProjectId"`
}
DataApplyForCooperation struct {
CooperationApplicationId int `json:"cooperationApplicationId,string"`
}
)
... ...