正在显示
6 个修改的文件
包含
22 行增加
和
16 行删除
@@ -13,20 +13,16 @@ type ApplyForCooperationCommand struct { | @@ -13,20 +13,16 @@ type ApplyForCooperationCommand struct { | ||
13 | CooperationApplicationAttachment []*domain.Attachment `cname:"共创申请描述附件" json:"cooperationApplicationAttachment" valid:"Required"` | 13 | CooperationApplicationAttachment []*domain.Attachment `cname:"共创申请描述附件" json:"cooperationApplicationAttachment" valid:"Required"` |
14 | // 共创申请描述 | 14 | // 共创申请描述 |
15 | CooperationApplicationDescription string `cname:"共创申请描述" json:"cooperationApplicationDescription,omitempty"` | 15 | CooperationApplicationDescription string `cname:"共创申请描述" json:"cooperationApplicationDescription,omitempty"` |
16 | - // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
17 | - UserId int64 `cname:"用户ID" json:"userId" valid:"Required"` | 16 | + // 申请人ID |
17 | + UserId int64 `cname:"申请人ID" json:"userId" valid:"Required"` | ||
18 | // 用户基本id | 18 | // 用户基本id |
19 | UserBaseId int64 `cname:"用户基本数据ID" json:"userBaseId" valid:"Required"` | 19 | UserBaseId int64 `cname:"用户基本数据ID" json:"userBaseId" valid:"Required"` |
20 | // 组织机构ID | 20 | // 组织机构ID |
21 | OrgId int64 `cname:"组织机构ID" json:"orgId" valid:"Required"` | 21 | OrgId int64 `cname:"组织机构ID" json:"orgId" valid:"Required"` |
22 | // 公司ID,通过集成REST上下文获取 | 22 | // 公司ID,通过集成REST上下文获取 |
23 | CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` | 23 | CompanyId int64 `cname:"公司ID" json:"companyId" valid:"Required"` |
24 | - // 部门ID,通过REST集成上下文获取 | ||
25 | - DepartmentId int64 `cname:"部门ID" json:"departmentId" valid:"Required"` | ||
26 | - // 共创申请ID | ||
27 | - CooperationApplicationId string `cname:"共创申请ID" json:"cooperationApplicationId" valid:"Required"` | ||
28 | - // 共创项目编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001 | ||
29 | - CooperationProjectNumber string `cname:"共创项目编号" json:"cooperationProjectNumber" valid:"Required"` | 24 | + // 共创项目ID |
25 | + CooperationProjectId int64 `cname:"共创项目ID" json:"cooperationProjectId" valid:"Required"` | ||
30 | } | 26 | } |
31 | 27 | ||
32 | func (applyForCooperationCommand *ApplyForCooperationCommand) Valid(validation *validation.Validation) { | 28 | func (applyForCooperationCommand *ApplyForCooperationCommand) Valid(validation *validation.Validation) { |
@@ -10,7 +10,7 @@ import ( | @@ -10,7 +10,7 @@ import ( | ||
10 | 10 | ||
11 | type ApprovalCooperationApplicationCommand struct { | 11 | type ApprovalCooperationApplicationCommand struct { |
12 | // 共创申请ID | 12 | // 共创申请ID |
13 | - CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId" valid:"Required"` | 13 | + CooperationApplicationId string `cname:"共创申请ID" json:"cooperationApplicationId" valid:"Required"` |
14 | // 共创申请审核描述 | 14 | // 共创申请审核描述 |
15 | CooperationApplicationVerifyDescription string `cname:"共创申请审核描述" json:"cooperationApplicationVerifyDescription,omitempty"` | 15 | CooperationApplicationVerifyDescription string `cname:"共创申请审核描述" json:"cooperationApplicationVerifyDescription,omitempty"` |
16 | // 公司ID,通过集成REST上下文获取 | 16 | // 公司ID,通过集成REST上下文获取 |
@@ -11,7 +11,7 @@ import ( | @@ -11,7 +11,7 @@ import ( | ||
11 | 11 | ||
12 | type UpdateCooperationApplicationCommand struct { | 12 | type UpdateCooperationApplicationCommand struct { |
13 | // 共创申请id | 13 | // 共创申请id |
14 | - CooperationApplicationId string `cname:"共创申请ID" json:"cooperationApplicationId" valid:"Required"` | 14 | + CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId" valid:"Required"` |
15 | // 共创申请人uid | 15 | // 共创申请人uid |
16 | ApplicantUid string `cname:"共创申请人UID" json:"applicantUid" valid:"Required"` | 16 | ApplicantUid string `cname:"共创申请人UID" json:"applicantUid" valid:"Required"` |
17 | // 共创申请描述 | 17 | // 共创申请描述 |
@@ -33,6 +33,8 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop | @@ -33,6 +33,8 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop | ||
33 | defer func() { | 33 | defer func() { |
34 | _ = transactionContext.RollbackTransaction() | 34 | _ = transactionContext.RollbackTransaction() |
35 | }() | 35 | }() |
36 | + | ||
37 | + // 共创项目仓储初始化 | ||
36 | var cooperationProjectRepository domain.CooperationProjectRepository | 38 | var cooperationProjectRepository domain.CooperationProjectRepository |
37 | if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{ | 39 | if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{ |
38 | "transactionContext": transactionContext, | 40 | "transactionContext": transactionContext, |
@@ -41,12 +43,14 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop | @@ -41,12 +43,14 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop | ||
41 | } else { | 43 | } else { |
42 | cooperationProjectRepository = value | 44 | cooperationProjectRepository = value |
43 | } | 45 | } |
44 | - cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{"cooperationProjectNumber": applyForCooperationCommand.CooperationProjectNumber}) | 46 | + |
47 | + // 获取共创项目 | ||
48 | + cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{"cooperationProjectId": applyForCooperationCommand.CooperationProjectId}) | ||
45 | if err != nil { | 49 | if err != nil { |
46 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 50 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
47 | } | 51 | } |
48 | if cooperationProject == nil { | 52 | if cooperationProject == nil { |
49 | - return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", applyForCooperationCommand.CooperationProjectNumber)) | 53 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(applyForCooperationCommand.CooperationProjectId, 10))) |
50 | } | 54 | } |
51 | 55 | ||
52 | // 用户REST服务初始化 | 56 | // 用户REST服务初始化 |
@@ -156,12 +160,16 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop | @@ -156,12 +160,16 @@ func (cooperationApplicationService *CooperationApplicationService) ApprovalCoop | ||
156 | } else { | 160 | } else { |
157 | cooperationApplicationRepository = value | 161 | cooperationApplicationRepository = value |
158 | } | 162 | } |
163 | + cooperationApplicationId, err := strconv.ParseInt(approvalCooperationApplicationCommand.CooperationApplicationId, 10, 64) | ||
164 | + if err != nil { | ||
165 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "共创申请ID类型错误") | ||
166 | + } | ||
159 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": approvalCooperationApplicationCommand.CooperationApplicationId}) | 167 | cooperationApplication, err := cooperationApplicationRepository.FindOne(map[string]interface{}{"cooperationApplicationId": approvalCooperationApplicationCommand.CooperationApplicationId}) |
160 | if err != nil { | 168 | if err != nil { |
161 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 169 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
162 | } | 170 | } |
163 | if cooperationApplication == nil { | 171 | if cooperationApplication == nil { |
164 | - return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(approvalCooperationApplicationCommand.CooperationApplicationId, 10))) | 172 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(cooperationApplicationId, 10))) |
165 | } | 173 | } |
166 | if err := cooperationApplication.Update(tool_funs.SimpleStructToMap(approvalCooperationApplicationCommand)); err != nil { | 174 | if err := cooperationApplication.Update(tool_funs.SimpleStructToMap(approvalCooperationApplicationCommand)); err != nil { |
167 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 175 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
@@ -19,6 +19,8 @@ func (controller *CooperationApplicationController) ApplyForCooperation() { | @@ -19,6 +19,8 @@ func (controller *CooperationApplicationController) ApplyForCooperation() { | ||
19 | applyForCooperationCommand.OrgId = header.OrgId | 19 | applyForCooperationCommand.OrgId = header.OrgId |
20 | applyForCooperationCommand.UserId = header.UserId | 20 | applyForCooperationCommand.UserId = header.UserId |
21 | applyForCooperationCommand.UserBaseId = header.UserBaseId | 21 | applyForCooperationCommand.UserBaseId = header.UserBaseId |
22 | + cooperationProjectId, _ := controller.GetInt64(":cooperationProjectId") | ||
23 | + applyForCooperationCommand.CooperationProjectId = cooperationProjectId | ||
22 | data, err := cooperationApplicationService.ApplyForCooperation(applyForCooperationCommand) | 24 | data, err := cooperationApplicationService.ApplyForCooperation(applyForCooperationCommand) |
23 | controller.Response(data, err) | 25 | controller.Response(data, err) |
24 | } | 26 | } |
@@ -97,7 +99,7 @@ func (controller *CooperationApplicationController) UpdateCooperationApplication | @@ -97,7 +99,7 @@ func (controller *CooperationApplicationController) UpdateCooperationApplication | ||
97 | updateCooperationApplicationCommand.OrgId = header.OrgId | 99 | updateCooperationApplicationCommand.OrgId = header.OrgId |
98 | updateCooperationApplicationCommand.UserId = header.UserId | 100 | updateCooperationApplicationCommand.UserId = header.UserId |
99 | updateCooperationApplicationCommand.UserBaseId = header.UserBaseId | 101 | updateCooperationApplicationCommand.UserBaseId = header.UserBaseId |
100 | - cooperationApplicationId := controller.GetString(":cooperationApplicationId") | 102 | + cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId") |
101 | updateCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId | 103 | updateCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId |
102 | data, err := cooperationApplicationService.UpdateCooperationApplication(updateCooperationApplicationCommand) | 104 | data, err := cooperationApplicationService.UpdateCooperationApplication(updateCooperationApplicationCommand) |
103 | controller.Response(data, err) | 105 | controller.Response(data, err) |
@@ -6,12 +6,12 @@ import ( | @@ -6,12 +6,12 @@ import ( | ||
6 | ) | 6 | ) |
7 | 7 | ||
8 | func init() { | 8 | func init() { |
9 | - web.Router("/cooperation-applications/apply-for-cooperation", &controllers.CooperationApplicationController{}, "Post:ApplyForCooperation") // 申请共创 | 9 | + web.Router("/cooperation-applications/:cooperationProjectId/apply-for-cooperation", &controllers.CooperationApplicationController{}, "Post:ApplyForCooperation") // 申请共创 |
10 | web.Router("/cooperation-applications/cancel-application", &controllers.CooperationApplicationController{}, "Post:CancelCooperationApplication") // 取消共创申请 | 10 | web.Router("/cooperation-applications/cancel-application", &controllers.CooperationApplicationController{}, "Post:CancelCooperationApplication") // 取消共创申请 |
11 | web.Router("/cooperation-applications/approval-cooperation-application", &controllers.CooperationApplicationController{}, "Post:ApprovalCooperationApplication") // 同意共创申请 | 11 | web.Router("/cooperation-applications/approval-cooperation-application", &controllers.CooperationApplicationController{}, "Post:ApprovalCooperationApplication") // 同意共创申请 |
12 | web.Router("/cooperation-applications/batch-approval", &controllers.CooperationContractController{}, "Post:BatchApprovalCooperationApplication") // 批量审核共创申请 | 12 | web.Router("/cooperation-applications/batch-approval", &controllers.CooperationContractController{}, "Post:BatchApprovalCooperationApplication") // 批量审核共创申请 |
13 | web.Router("/cooperation-applications/oneclick-approval", &controllers.CooperationApplicationController{}, "Post:OneClickApprovalCooperationApplication") // 一键审核共创申请 | 13 | web.Router("/cooperation-applications/oneclick-approval", &controllers.CooperationApplicationController{}, "Post:OneClickApprovalCooperationApplication") // 一键审核共创申请 |
14 | - web.Router("/cooperation-applications/", &controllers.CooperationApplicationController{}, "Post:CreateCooperationApplication") // 新增共创申请 | 14 | + web.Router("/cooperation-applications/", &controllers.CooperationApplicationController{}, "Post:CreateCooperationApplication") // 新增共创申请(预留) |
15 | web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Put:UpdateCooperationApplication") // 编辑共创申请 | 15 | web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Put:UpdateCooperationApplication") // 编辑共创申请 |
16 | web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Get:GetCooperationApplication") // 获取共创申请详情 | 16 | web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Get:GetCooperationApplication") // 获取共创申请详情 |
17 | web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Delete:RemoveCooperationApplication") // 移除共创申请 | 17 | web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Delete:RemoveCooperationApplication") // 移除共创申请 |
-
请 注册 或 登录 后发表评论