作者 tangxuhui

新增 ,合约申请管理,合约项目管理

1 -{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627899047152189500}  
  1 +{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628060696735619100}
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
  9 +
  10 +type AuditCooperationApplicationCommand struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + // 共创申请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"`
  19 +}
  20 +
  21 +func (auditCooperationApplicationCommand *AuditCooperationApplicationCommand) Valid(validation *validation.Validation) {
  22 + validation.SetError("CustomValid", "未实现的自定义认证")
  23 +}
  24 +
  25 +func (auditCooperationApplicationCommand *AuditCooperationApplicationCommand) ValidateCommand() error {
  26 + valid := validation.Validation{}
  27 + b, err := valid.Valid(auditCooperationApplicationCommand)
  28 + if err != nil {
  29 + return err
  30 + }
  31 + if !b {
  32 + for _, validErr := range valid.Errors {
  33 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  34 + }
  35 + }
  36 + return nil
  37 +}
  1 +package command
  2 +
  3 +// type CreateCooperationApplicationCommand struct {
  4 +// //操作人
  5 +// Operator domain.Operator `json:"-"`
  6 +// // 共创申请描述
  7 +// CooperationApplicationDescription string `json:"cooperationApplicationDescription" valid:"Required"`
  8 +// // 申请人的id
  9 +// UserId int64 `json:"userId,omitempty"`
  10 +// // 附件列表
  11 +// Attachment []domain.Attachment `json:"attachment"`
  12 +// }
  13 +
  14 +// func (createCooperationApplicationCommand *CreateCooperationApplicationCommand) Valid(validation *validation.Validation) {
  15 +// validation.SetError("CustomValid", "未实现的自定义认证")
  16 +// }
  17 +
  18 +// func (createCooperationApplicationCommand *CreateCooperationApplicationCommand) ValidateCommand() error {
  19 +// valid := validation.Validation{}
  20 +// b, err := valid.Valid(createCooperationApplicationCommand)
  21 +// if err != nil {
  22 +// return err
  23 +// }
  24 +// if !b {
  25 +// for _, validErr := range valid.Errors {
  26 +// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  27 +// }
  28 +// }
  29 +// return nil
  30 +// }
  1 +package command
  2 +
  3 +// type UpdateCooperationApplicationCommand struct {
  4 +//操作人
  5 +// Operator domain.Operator `json:"-"`
  6 +// 共创申请ID
  7 +// CooperationApplicationId int64 `json:"cooperationApplicationId" valid:"Required"`
  8 +// }
  9 +
  10 +// func (updateCooperationApplicationCommand *UpdateCooperationApplicationCommand) Valid(validation *validation.Validation) {
  11 +// validation.SetError("CustomValid", "未实现的自定义认证")
  12 +// }
  13 +
  14 +// func (updateCooperationApplicationCommand *UpdateCooperationApplicationCommand) ValidateCommand() error {
  15 +// valid := validation.Validation{}
  16 +// b, err := valid.Valid(updateCooperationApplicationCommand)
  17 +// if err != nil {
  18 +// return err
  19 +// }
  20 +// if !b {
  21 +// for _, validErr := range valid.Errors {
  22 +// return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  23 +// }
  24 +// }
  25 +// return nil
  26 +// }
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
  9 +
  10 +type GetCooperationApplicationQuery struct {
  11 +
  12 + //操作人
  13 + Operator domain.Operator `json:"-"`
  14 + // 共创申请ID
  15 + CooperationApplicationId int `json:"cooperationApplicationId,string" valid:"Required"`
  16 +}
  17 +
  18 +func (getCooperationApplicationQuery *GetCooperationApplicationQuery) Valid(validation *validation.Validation) {
  19 + validation.SetError("CustomValid", "未实现的自定义认证")
  20 +}
  21 +
  22 +func (getCooperationApplicationQuery *GetCooperationApplicationQuery) ValidateQuery() error {
  23 + valid := validation.Validation{}
  24 + b, err := valid.Valid(getCooperationApplicationQuery)
  25 + if err != nil {
  26 + return err
  27 + }
  28 + if !b {
  29 + for _, validErr := range valid.Errors {
  30 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  31 + }
  32 + }
  33 + return nil
  34 +}
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
  9 +
  10 +type ListCooperationApplicationQuery struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + // 查询偏离量
  14 + PageNumber int `json:"pageNumber" valid:"Required"`
  15 + // 查询限制
  16 + PageSize int `json:"pageSize" valid:"Required"`
  17 + //共创项目名称
  18 + ProjectName string `json:"projectName"`
  19 + //申请人名称
  20 + ApplicantName string `json:"applicantName"`
  21 + //审核状态
  22 + VerifyStatus int `json:"verifyStatus"`
  23 +}
  24 +
  25 +func (listCooperationApplicationQuery *ListCooperationApplicationQuery) Valid(validation *validation.Validation) {
  26 +
  27 +}
  28 +
  29 +func (listCooperationApplicationQuery *ListCooperationApplicationQuery) ValidateQuery() error {
  30 + valid := validation.Validation{}
  31 + b, err := valid.Valid(listCooperationApplicationQuery)
  32 + if err != nil {
  33 + return err
  34 + }
  35 + if !b {
  36 + for _, validErr := range valid.Errors {
  37 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  38 + }
  39 + }
  40 + return nil
  41 +}
  1 +package service
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/core/application"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/command"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/query"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
  8 +)
  9 +
  10 +// 共创申请管理
  11 +type CooperationApplicationService struct {
  12 +}
  13 +
  14 +// 审核共创申请
  15 +func (cooperationApplicationService *CooperationApplicationService) AuditCooperationApplication(
  16 + auditCooperationApplicationCommand *command.AuditCooperationApplicationCommand) (interface{}, error) {
  17 + if err := auditCooperationApplicationCommand.ValidateCommand(); err != nil {
  18 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  19 + }
  20 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
  21 + auditCooperationApplicationCommand.Operator)
  22 +
  23 + if auditCooperationApplicationCommand.CooperationApplicationStatus == 2 {
  24 + _, err := creationCooperationGateway.CooperationApplicationsAgree(allied_creation_cooperation.ReqCooperationApplicationAgree{
  25 + CooperationApplicationId: auditCooperationApplicationCommand.CooperationApplicationId,
  26 + CooperationApplicationVerifyDescription: auditCooperationApplicationCommand.CooperationApplicationVerifyDescription,
  27 + })
  28 + if err != nil {
  29 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  30 + }
  31 + } else if auditCooperationApplicationCommand.CooperationApplicationStatus == 3 {
  32 + _, err := creationCooperationGateway.CooperationApplicationReject(allied_creation_cooperation.ReqCooperationApplicationReject{
  33 + CooperationApplicationId: auditCooperationApplicationCommand.CooperationApplicationId,
  34 + CooperationApplicationVerifyDescription: auditCooperationApplicationCommand.CooperationApplicationVerifyDescription,
  35 + })
  36 + if err != nil {
  37 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  38 + }
  39 + } else {
  40 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "status 参数错误")
  41 + }
  42 +
  43 + return auditCooperationApplicationCommand, nil
  44 +}
  45 +
  46 +// 返回共创申请管理
  47 +func (cooperationApplicationService *CooperationApplicationService) GetCooperationApplication(getCooperationApplicationQuery *query.GetCooperationApplicationQuery) (interface{}, error) {
  48 + if err := getCooperationApplicationQuery.ValidateQuery(); err != nil {
  49 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  50 + }
  51 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationApplicationQuery.Operator)
  52 + result, err := creationCooperationGateway.CooperationApplicationGet(allied_creation_cooperation.ReqCooperationApplicationGet{
  53 + CooperationApplicationId: getCooperationApplicationQuery.CooperationApplicationId,
  54 + })
  55 + if err != nil {
  56 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  57 + }
  58 + return result, nil
  59 +}
  60 +
  61 +// 返回共创申请管理列表
  62 +func (cooperationApplicationService *CooperationApplicationService) ListCooperationApplication(
  63 + listCooperationApplicationQuery *query.ListCooperationApplicationQuery) (int64, interface{}, error) {
  64 + if err := listCooperationApplicationQuery.ValidateQuery(); err != nil {
  65 + return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
  66 + }
  67 + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationApplicationQuery.Operator)
  68 + result, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
  69 + ApplicantName: listCooperationApplicationQuery.ApplicantName,
  70 + CooperationApplicationStatus: listCooperationApplicationQuery.VerifyStatus,
  71 + CooperationProjectName: listCooperationApplicationQuery.ProjectName,
  72 + PageNumber: listCooperationApplicationQuery.PageNumber,
  73 + PageSize: listCooperationApplicationQuery.PageSize,
  74 + })
  75 + if err != nil {
  76 + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  77 + }
  78 +
  79 + return int64(result.Gride.Total), result.Gride.List, nil
  80 +}
  81 +
  82 +func NewCooperationApplicationService(options map[string]interface{}) *CooperationApplicationService {
  83 + newCooperationApplicationService := &CooperationApplicationService{}
  84 + return newCooperationApplicationService
  85 +}
@@ -11,7 +11,7 @@ type UpdateCooperationProjectCommand struct { @@ -11,7 +11,7 @@ type UpdateCooperationProjectCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 // 共创项目ID 13 // 共创项目ID
14 - CooperationProjectId string `json:"cooperationProjectId" valid:"Required"` 14 + CooperationProjectId string `json:"cooperationProjectId,string" valid:"Required"`
15 // 模式编码,唯一确定 15 // 模式编码,唯一确定
16 CooperationModeNumber string `json:"cooperationModeNumber" valid:"Required"` 16 CooperationModeNumber string `json:"cooperationModeNumber" valid:"Required"`
17 // 组织ID 17 // 组织ID
@@ -47,6 +47,7 @@ func (cooperationProjectService *CooperationProjectService) EndCooperationProjec @@ -47,6 +47,7 @@ func (cooperationProjectService *CooperationProjectService) EndCooperationProjec
47 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 47 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
48 } 48 }
49 //creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(endCooperationProjectCommand.Operator) 49 //creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(endCooperationProjectCommand.Operator)
  50 + //TODO
50 return nil, nil 51 return nil, nil
51 } 52 }
52 53
@@ -86,15 +87,6 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje @@ -86,15 +87,6 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
86 return result.Total, result.CooperationProjects, nil 87 return result.Total, result.CooperationProjects, nil
87 } 88 }
88 89
89 -// 发布共创项目  
90 -// func (cooperationProjectService *CooperationProjectService) ReleaseCooperationProject(releaseCooperationProjectCommand *command.ReleaseCooperationProjectCommand) (interface{}, error) {  
91 -// if err := releaseCooperationProjectCommand.ValidateCommand(); err != nil {  
92 -// return nil, application.ThrowError(application.ARG_ERROR, err.Error())  
93 -// }  
94 -// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(releaseCooperationProjectCommand.Operator)  
95 -// return nil, nil  
96 -// }  
97 -  
98 // 更新共创项目管理 90 // 更新共创项目管理
99 func (cooperationProjectService *CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) { 91 func (cooperationProjectService *CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) {
100 if err := updateCooperationProjectCommand.ValidateCommand(); err != nil { 92 if err := updateCooperationProjectCommand.ValidateCommand(); err != nil {
@@ -322,7 +322,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationList(param @@ -322,7 +322,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationList(param
322 322
323 // CooperationApplicationGet 返回共创申请详情 323 // CooperationApplicationGet 返回共创申请详情
324 func (gateway HttplibAlliedCreationCooperation) CooperationApplicationGet(param ReqCooperationApplicationGet) (*DataCooperationApplicationGet, error) { 324 func (gateway HttplibAlliedCreationCooperation) CooperationApplicationGet(param ReqCooperationApplicationGet) (*DataCooperationApplicationGet, error) {
325 - url := gateway.baseUrL + "/cooperation-applications/{cooperationApplicationId}" 325 + url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.CooperationApplicationId)
326 method := "GET" 326 method := "GET"
327 req := gateway.CreateRequest(url, method) 327 req := gateway.CreateRequest(url, method)
328 log.Logger.Debug("向业务模块请求数据:返回共创申请详情。", map[string]interface{}{ 328 log.Logger.Debug("向业务模块请求数据:返回共创申请详情。", map[string]interface{}{
1 package allied_creation_cooperation 1 package allied_creation_cooperation
2 2
3 -import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 3 +import (
  4 + "time"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  7 +)
  8 +
  9 +//共创实体
4 10
5 //更新共创申请 11 //更新共创申请
6 type ( 12 type (
@@ -34,7 +40,8 @@ type ( @@ -34,7 +40,8 @@ type (
34 //审核-同意共创申请 40 //审核-同意共创申请
35 type ( 41 type (
36 ReqCooperationApplicationAgree struct { 42 ReqCooperationApplicationAgree struct {
37 - CooperationApplicationId int 43 + CooperationApplicationId []int `json:"cooperationApplicationId"`
  44 + CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
38 } 45 }
39 46
40 DataCooperationApplicationAgree struct { 47 DataCooperationApplicationAgree struct {
@@ -44,7 +51,8 @@ type ( @@ -44,7 +51,8 @@ type (
44 //审核-拒绝共创申请 51 //审核-拒绝共创申请
45 type ( 52 type (
46 ReqCooperationApplicationReject struct { 53 ReqCooperationApplicationReject struct {
47 - CooperationApplicationId int 54 + CooperationApplicationId []int `json:"cooperationApplicationId"`
  55 + CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
48 } 56 }
49 57
50 DataCooperationApplicationReject struct { 58 DataCooperationApplicationReject struct {
@@ -72,9 +80,75 @@ type ( @@ -72,9 +80,75 @@ type (
72 //查询共创申请 80 //查询共创申请
73 type ( 81 type (
74 ReqCooperationApplicationSearch struct { 82 ReqCooperationApplicationSearch struct {
  83 + ApplicantName string `json:"applicantName"` //申请人姓名
  84 + CooperationApplicationStatus int `json:"cooperationApplicationStatus"` //共创申请审核状态,1待审核,2已同意,3已拒绝
  85 + CooperationProjectName string `json:"cooperationProjectName"` //共创项目名称
  86 + PageNumber int `json:"pageNumber"`
  87 + PageSize int `json:"pageSize"`
75 } 88 }
76 89
77 DataCooperationApplicationSearch struct { 90 DataCooperationApplicationSearch struct {
  91 + Gride struct {
  92 + Total int
  93 + List []struct {
  94 + //公司
  95 + Company struct {
  96 + CompanyID int `json:"companyId"`
  97 + CompanyName string `json:"companyName"`
  98 + } `json:"company"`
  99 + //申请人
  100 + CooperationApplicationApplicant struct {
  101 + //申请人部门
  102 + Department struct {
  103 + DepartmentID int `json:"departmentId"`
  104 + DepartmentName string `json:"departmentName"`
  105 + DepartmentNumber string `json:"departmentNumber"`
  106 + } `json:"department"`
  107 + //申请人组织
  108 + Org struct {
  109 + OrgID int `json:"orgId"`
  110 + OrgName string `json:"orgName"`
  111 + } `json:"org"`
  112 + UserBaseID int `json:"userBaseId"`
  113 + UserID int `json:"userId"`
  114 + UserInfo struct {
  115 + UserAccount string `json:"userAccount"`
  116 + UserAvatar string `json:"userAvatar"`
  117 + UserEmail string `json:"userEmail"`
  118 + UserName string `json:"userName"`
  119 + UserPhone string `json:"userPhone"`
  120 + } `json:"userInfo"`
  121 + UserType int `json:"userType"`
  122 + } `json:"cooperationApplicationApplicant"`
  123 + //附件信息
  124 + CooperationApplicationAttachment []struct {
  125 + FileSize int `json:"fileSize"`
  126 + FileType string `json:"fileType"`
  127 + Name string `json:"name"`
  128 + URL string `json:"url"`
  129 + } `json:"cooperationApplicationAttachment"`
  130 + //申请描述
  131 + CooperationApplicationDescription string `json:"cooperationApplicationDescription"`
  132 + //id
  133 + CooperationApplicationID int `json:"cooperationApplicationId"`
  134 + //申请单状态 ,共创申请审核状态,1待审核,2已同意,3已拒绝
  135 + CooperationApplicationStatus int `json:"cooperationApplicationStatus"`
  136 + //是否已取消
  137 + IsCanceled bool `json:"isCanceled"`
  138 + //描述
  139 + CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
  140 + //审核时间
  141 + CooperationApplicationVerifyTime time.Time `json:"cooperationApplicationVerifyTime"`
  142 + //申请时间
  143 + CooperationApplyTime time.Time `json:"cooperationApplyTime"`
  144 + Org struct {
  145 + OrgID int `json:"orgId"`
  146 + OrgName string `json:"orgName"`
  147 + } `json:"org"`
  148 + UpdatedAt time.Time `json:"updatedAt"`
  149 + CreatedAt time.Time `json:"createdAt"`
  150 + } `json:"list"`
  151 + }
78 } 152 }
79 ) 153 )
80 154
@@ -90,7 +164,7 @@ type ( @@ -90,7 +164,7 @@ type (
90 //移除共创申请 164 //移除共创申请
91 type ( 165 type (
92 ReqCooperationApplicationRemove struct { 166 ReqCooperationApplicationRemove struct {
93 - ApplicationId int 167 + ApplicationId int `json:"applicationId"`
94 } 168 }
95 169
96 DataCooperationApplicationRemove struct { 170 DataCooperationApplicationRemove struct {
@@ -109,9 +183,139 @@ type ( @@ -109,9 +183,139 @@ type (
109 //返回共创申请详情 183 //返回共创申请详情
110 type ( 184 type (
111 ReqCooperationApplicationGet struct { 185 ReqCooperationApplicationGet struct {
112 - CooperationApplicationId int 186 + CooperationApplicationId int `json:"cooperationApplicationId"`
113 } 187 }
114 188
115 DataCooperationApplicationGet struct { 189 DataCooperationApplicationGet struct {
  190 + Company struct {
  191 + CompanyID float64 `json:"companyId"`
  192 + CompanyLogo string `json:"companyLogo"`
  193 + CompanyName string `json:"companyName"`
  194 + } `json:"company"`
  195 + //申请人
  196 + CooperationApplicationApplicant struct {
  197 + Department struct {
  198 + DepartmentID float64 `json:"departmentId"`
  199 + DepartmentName string `json:"departmentName"`
  200 + DepartmentNumber string `json:"departmentNumber"`
  201 + IsOrganization bool `json:"isOrganization"`
  202 + } `json:"department"`
  203 + Org struct {
  204 + OrgID int `json:"orgId"`
  205 + OrgName string `json:"orgName"`
  206 + } `json:"org"`
  207 + UserBaseID int `json:"userBaseId"`
  208 + UserID int `json:"userId"`
  209 + UserInfo struct {
  210 + UserAccount string `json:"userAccount"`
  211 + UserAvatar string `json:"userAvatar"`
  212 + UserEmail string `json:"userEmail"`
  213 + UserName string `json:"userName"`
  214 + UserPhone string `json:"userPhone"`
  215 + } `json:"userInfo"`
  216 + UserType float64 `json:"userType"`
  217 + } `json:"cooperationApplicationApplicant"`
  218 + //附件
  219 + CooperationApplicationAttachment []struct {
  220 + FileSize float64 `json:"fileSize"`
  221 + FileType string `json:"fileType"`
  222 + Name string `json:"name"`
  223 + URL string `json:"url"`
  224 + } `json:"cooperationApplicationAttachment"`
  225 + CooperationApplicationDescription string `json:"cooperationApplicationDescription"`
  226 + CooperationApplicationID float64 `json:"cooperationApplicationId"`
  227 + CooperationApplicationStatus float64 `json:"cooperationApplicationStatus"`
  228 + //审核人
  229 + CooperationApplicationVerifier struct {
  230 + Department struct {
  231 + DepartmentID float64 `json:"departmentId"`
  232 + DepartmentName string `json:"departmentName"`
  233 + DepartmentNumber string `json:"departmentNumber"`
  234 + IsOrganization bool `json:"isOrganization"`
  235 + } `json:"department"`
  236 + Org struct {
  237 + OrgID float64 `json:"orgId"`
  238 + OrgName string `json:"orgName"`
  239 + } `json:"org"`
  240 + UserBaseID float64 `json:"userBaseId"`
  241 + UserID float64 `json:"userId"`
  242 + UserInfo struct {
  243 + UserAccount string `json:"userAccount"`
  244 + UserAvatar string `json:"userAvatar"`
  245 + UserEmail string `json:"userEmail"`
  246 + UserName string `json:"userName"`
  247 + UserPhone string `json:"userPhone"`
  248 + } `json:"userInfo"`
  249 + UserType float64 `json:"userType"`
  250 + } `json:"cooperationApplicationVerifier"`
  251 + CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
  252 + //审核时间
  253 + CooperationApplicationVerifyTime string `json:"cooperationApplicationVerifyTime"`
  254 + // 共创申请时间
  255 + CooperationApplyTime string `json:"cooperationApplyTime"`
  256 + CreatedAt string `json:"createdAt"`
  257 + Org struct {
  258 + OrgID int `json:"orgId"`
  259 + OrgName string `json:"orgName"`
  260 + } `json:"org"`
  261 + UpdatedAt string `json:"updatedAt"`
  262 + //共创项目
  263 + CooperationProject struct {
  264 + CooperationProjectDescription string `json:"cooperationProjectDescription"`
  265 + CooperationProjectID float64 `json:"cooperationProjectId"`
  266 + CooperationProjectName string `json:"cooperationProjectName"`
  267 + CooperationProjectNumber string `json:"cooperationProjectNumber"`
  268 + CooperationProjectPublishTime string `json:"cooperationProjectPublishTime"`
  269 + CooperationProjectPublisher struct {
  270 + Department struct {
  271 + DepartmentID float64 `json:"departmentId"`
  272 + DepartmentName string `json:"departmentName"`
  273 + DepartmentNumber string `json:"departmentNumber"`
  274 + } `json:"department"`
  275 + Org struct {
  276 + OrgID float64 `json:"orgId"`
  277 + OrgName string `json:"orgName"`
  278 + } `json:"org"`
  279 + UserBaseID float64 `json:"userBaseId"`
  280 + UserID float64 `json:"userId"`
  281 + UserInfo struct {
  282 + UserAccount string `json:"userAccount"`
  283 + UserAvatar string `json:"userAvatar"`
  284 + UserEmail string `json:"userEmail"`
  285 + UserName string `json:"userName"`
  286 + UserPhone string `json:"userPhone"`
  287 + } `json:"userInfo"`
  288 + UserType float64 `json:"userType"`
  289 + } `json:"cooperationProjectPublisher"`
  290 + //项目发起人
  291 + CooperationProjectSponsor struct {
  292 + Department struct {
  293 + DepartmentID float64 `json:"departmentId"`
  294 + DepartmentName string `json:"departmentName"`
  295 + DepartmentNumber string `json:"departmentNumber"`
  296 + } `json:"department"`
  297 + Org struct {
  298 + OrgID int `json:"orgId"`
  299 + OrgName string `json:"orgName"`
  300 + } `json:"org"`
  301 + UserBaseID int `json:"userBaseId"`
  302 + UserID int `json:"userId"`
  303 + UserInfo struct {
  304 + UserAccount string `json:"userAccount"`
  305 + UserAvatar string `json:"userAvatar"`
  306 + UserEmail string `json:"userEmail"`
  307 + UserName string `json:"userName"`
  308 + UserPhone string `json:"userPhone"`
  309 + } `json:"userInfo"`
  310 + UserType float64 `json:"userType"`
  311 + } `json:"cooperationProjectSponsor"`
  312 + CooperationProjectUndertakerType []float64 `json:"cooperationProjectUndertakerType"`
  313 + CreatedAt time.Time `json:"createdAt"`
  314 + Org struct {
  315 + OrgID int `json:"orgId"`
  316 + OrgName string `json:"orgName"`
  317 + } `json:"org"`
  318 + Status float64 `json:"status"`
  319 + } `json:"cooperationProject"`
116 } 320 }
117 ) 321 )
  1 +package web_client
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/command"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/query"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/service"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  8 +)
  9 +
  10 +type CooperationApplicationController struct {
  11 + baseController
  12 +}
  13 +
  14 +func (controller *CooperationApplicationController) GetCooperationApplication() {
  15 + cooperationApplicationService := service.NewCooperationApplicationService(nil)
  16 + getCooperationApplicationQuery := &query.GetCooperationApplicationQuery{}
  17 + applicationId, _ := controller.GetInt(":applicationId")
  18 + getCooperationApplicationQuery.CooperationApplicationId = applicationId
  19 + data, err := cooperationApplicationService.GetCooperationApplication(getCooperationApplicationQuery)
  20 + controller.Response(data, err)
  21 +}
  22 +
  23 +func (controller *CooperationApplicationController) ListCooperationApplication() {
  24 + cooperationApplicationService := service.NewCooperationApplicationService(nil)
  25 + listCooperationApplicationQuery := &query.ListCooperationApplicationQuery{}
  26 + err := controller.Unmarshal(listCooperationApplicationQuery)
  27 + if err != nil {
  28 + log.Logger.Debug("json err:" + err.Error())
  29 + }
  30 + listCooperationApplicationQuery.Operator = controller.GetOperator()
  31 + cnt, data, err := cooperationApplicationService.ListCooperationApplication(listCooperationApplicationQuery)
  32 + controller.returnPageListData(cnt, data, err, listCooperationApplicationQuery.PageNumber)
  33 +}
  34 +
  35 +func (controller *CooperationApplicationController) AuditCooperationApplication() {
  36 + cooperationApplicationService := service.NewCooperationApplicationService(nil)
  37 + auditCooperationApplicationCommand := &command.AuditCooperationApplicationCommand{}
  38 + err := controller.Unmarshal(auditCooperationApplicationCommand)
  39 + if err != nil {
  40 + log.Logger.Debug("json err:" + err.Error())
  41 + }
  42 + auditCooperationApplicationCommand.Operator = controller.GetOperator()
  43 + data, err := cooperationApplicationService.AuditCooperationApplication(auditCooperationApplicationCommand)
  44 + controller.Response(data, err)
  45 +}
  1 +package web_client
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/command"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/query"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/service"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  8 +)
  9 +
  10 +type CooperationProjectController struct {
  11 + baseController
  12 +}
  13 +
  14 +func (controller *CooperationProjectController) CreateCooperationProject() {
  15 + cooperationProjectService := service.NewCooperationProjectService(nil)
  16 + createCooperationProjectCommand := &command.CreateCooperationProjectCommand{}
  17 + err := controller.Unmarshal(createCooperationProjectCommand)
  18 + if err != nil {
  19 + log.Logger.Debug("json err:" + err.Error())
  20 + }
  21 + data, err := cooperationProjectService.CreateCooperationProject(createCooperationProjectCommand)
  22 + controller.Response(data, err)
  23 +}
  24 +
  25 +func (controller *CooperationProjectController) UpdateCooperationProject() {
  26 + cooperationProjectService := service.NewCooperationProjectService(nil)
  27 + updateCooperationProjectCommand := &command.UpdateCooperationProjectCommand{}
  28 + err := controller.Unmarshal(updateCooperationProjectCommand)
  29 + if err != nil {
  30 + log.Logger.Debug("json err:" + err.Error())
  31 + }
  32 + projectId := controller.GetString(":projectId")
  33 + updateCooperationProjectCommand.CooperationProjectId = projectId
  34 + data, err := cooperationProjectService.UpdateCooperationProject(updateCooperationProjectCommand)
  35 + controller.Response(data, err)
  36 +}
  37 +
  38 +func (controller *CooperationProjectController) GetCooperationProject() {
  39 + cooperationProjectService := service.NewCooperationProjectService(nil)
  40 + getCooperationProjectQuery := &query.GetCooperationProjectQuery{}
  41 + projectId, _ := controller.GetInt(":projectId")
  42 + getCooperationProjectQuery.CooperationProjectId = projectId
  43 + data, err := cooperationProjectService.GetCooperationProject(getCooperationProjectQuery)
  44 + controller.Response(data, err)
  45 +}
  46 +
  47 +func (controller *CooperationProjectController) ListCooperationProject() {
  48 + cooperationProjectService := service.NewCooperationProjectService(nil)
  49 + listCooperationProjectQuery := &query.ListCooperationProjectQuery{}
  50 + err := controller.Unmarshal(listCooperationProjectQuery)
  51 + if err != nil {
  52 + log.Logger.Debug("json err:" + err.Error())
  53 + }
  54 + cnt, data, err := cooperationProjectService.ListCooperationProject(listCooperationProjectQuery)
  55 + controller.returnPageListData(cnt, data, err, listCooperationProjectQuery.PageNumber)
  56 +}
  57 +
  58 +func (controller *CooperationProjectController) EndCooperationProject() {
  59 + cooperationProjectService := service.NewCooperationProjectService(nil)
  60 + endCooperationProjectCommand := &command.EndCooperationProjectCommand{}
  61 + controller.Unmarshal(endCooperationProjectCommand)
  62 + //TODO
  63 + data, err := cooperationProjectService.EndCooperationProject(endCooperationProjectCommand)
  64 + controller.Response(data, err)
  65 +}
1 package web_client 1 package web_client
2 2
3 import ( 3 import (
  4 + "strconv"
  5 +
4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/service" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/service"
7 - "strconv"  
8 ) 9 )
9 10
10 type UsersController struct { 11 type UsersController struct {
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/v1/web/cooperation-applications/:applicationId", &web_client.CooperationApplicationController{}, "Get:GetCooperationApplication")
  10 + web.Router("/v1/web/cooperation-applications/search", &web_client.CooperationApplicationController{}, "Get:ListCooperationApplication")
  11 + web.Router("/v1/web/cooperation-applications/audit", &web_client.CooperationApplicationController{}, "Put:AuditCooperationApplication")
  12 +}
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/v1/web/cooperation-projects/", &web_client.CooperationProjectController{}, "Post:CreateCooperationProject")
  10 + web.Router("/v1/web/cooperation-projects/:projectId", &web_client.CooperationProjectController{}, "Put:UpdateCooperationProject")
  11 + web.Router("/v1/web/cooperation-projects/:projectId", &web_client.CooperationProjectController{}, "Get:GetCooperationProject")
  12 + web.Router("/v1/web/cooperation-projects/search", &web_client.CooperationProjectController{}, "Post:ListCooperationProject")
  13 + web.Router("/v1/web/cooperation-projects/end", &web_client.CooperationProjectController{}, "Put:EndCooperationProject")
  14 +}