作者 tangxuhui

更新

@@ -7,19 +7,16 @@ import ( @@ -7,19 +7,16 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 ) 8 )
9 9
  10 +//取消申请
10 type CancelCooperationApplicationCommand struct { 11 type CancelCooperationApplicationCommand struct {
11 //操作人 12 //操作人
12 Operator domain.Operator `json:"-"` 13 Operator domain.Operator `json:"-"`
13 // 共创申请ID 14 // 共创申请ID
14 - CooperationApplicationId []int `json:"cooperationApplicationId,string" valid:"Required"`  
15 - // 共创申请审核状态,1待审核,2已同意,3已拒绝  
16 - CooperationApplicationStatus int `json:"cooperationApplicationStatus" valid:"Required"`  
17 - // 共创申请审核描述  
18 - CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription" valid:"Required"` 15 + CooperationApplicationId int `json:"cooperationApplicationId" valid:"Required"`
19 } 16 }
20 17
21 func (auditCooperationApplicationCommand *CancelCooperationApplicationCommand) Valid(validation *validation.Validation) { 18 func (auditCooperationApplicationCommand *CancelCooperationApplicationCommand) Valid(validation *validation.Validation) {
22 - validation.SetError("CustomValid", "未实现的自定义认证") 19 +
23 } 20 }
24 21
25 func (auditCooperationApplicationCommand *CancelCooperationApplicationCommand) ValidateCommand() error { 22 func (auditCooperationApplicationCommand *CancelCooperationApplicationCommand) ValidateCommand() error {
@@ -123,8 +123,16 @@ func (srv CooperationApplicationsService) PersonGetCooperationApplications(appli @@ -123,8 +123,16 @@ func (srv CooperationApplicationsService) PersonGetCooperationApplications(appli
123 } 123 }
124 124
125 // PersonCancelCooperationApplications 共创用户取消共创申请 125 // PersonCancelCooperationApplications 共创用户取消共创申请
126 -func (srv CooperationApplicationsService) PersonCancelCooperationApplications(userMenusCommand *command.CancelCooperationApplicationCommand) (interface{}, error) {  
127 - return nil, nil 126 +func (srv CooperationApplicationsService) PersonCancelCooperationApplications(cancelCommand *command.CancelCooperationApplicationCommand) (interface{}, error) {
  127 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  128 + cancelCommand.Operator)
  129 + _, err := creationCooperationGateway.CooperationApplicationCancel(allied_creation_cooperation.ReqCooperationApplicationCancel{
  130 + ApplicationId: cancelCommand.CooperationApplicationId,
  131 + })
  132 + if err != nil {
  133 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  134 + }
  135 + return cancelCommand, nil
128 } 136 }
129 137
130 // PersonSearchCooperationApplications 共创用户获取共创申请列表 138 // PersonSearchCooperationApplications 共创用户获取共创申请列表
@@ -107,12 +107,9 @@ func (controller *CooperationController) PersonGetCooperationApplication() { @@ -107,12 +107,9 @@ func (controller *CooperationController) PersonGetCooperationApplication() {
107 func (controller *CooperationController) PersonCancelCooperationApplication() { 107 func (controller *CooperationController) PersonCancelCooperationApplication() {
108 svr := service.CooperationApplicationsService{} 108 svr := service.CooperationApplicationsService{}
109 cmd := &command.CancelCooperationApplicationCommand{} 109 cmd := &command.CancelCooperationApplicationCommand{}
110 - err := controller.Unmarshal(cmd)  
111 - if err != nil {  
112 - controller.Response(nil, err)  
113 - return  
114 - } 110 + applicationId, _ := controller.GetInt(":applicationId")
115 cmd.Operator = controller.GetOperator() 111 cmd.Operator = controller.GetOperator()
  112 + cmd.CooperationApplicationId = applicationId
116 data, err := svr.PersonCancelCooperationApplications(cmd) 113 data, err := svr.PersonCancelCooperationApplications(cmd)
117 controller.Response(data, err) 114 controller.Response(data, err)
118 } 115 }