正在显示
23 个修改的文件
包含
968 行增加
和
23 行删除
| 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 CreateCooperationModeCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 模式编码,唯一确定 | ||
| 14 | + CooperationModeNumber string `json:"cooperationModeNumber" valid:"Required"` | ||
| 15 | + // 模式名称,唯一确定 | ||
| 16 | + CooperationModeName string `json:"cooperationModeName" valid:"Required"` | ||
| 17 | + // 备注 | ||
| 18 | + Remarks string `json:"remarks" valid:"Required"` | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func (createCooperationModeCommand *CreateCooperationModeCommand) Valid(validation *validation.Validation) { | ||
| 22 | + | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +func (createCooperationModeCommand *CreateCooperationModeCommand) ValidateCommand() error { | ||
| 26 | + valid := validation.Validation{} | ||
| 27 | + b, err := valid.Valid(createCooperationModeCommand) | ||
| 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 | +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 RemoveCooperationModeCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 共创模式ID | ||
| 14 | + CooperationModeId int `json:"cooperationModeId,string" valid:"Required"` | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +func (removeCooperationModeCommand *RemoveCooperationModeCommand) Valid(validation *validation.Validation) { | ||
| 18 | + | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func (removeCooperationModeCommand *RemoveCooperationModeCommand) ValidateCommand() error { | ||
| 22 | + valid := validation.Validation{} | ||
| 23 | + b, err := valid.Valid(removeCooperationModeCommand) | ||
| 24 | + if err != nil { | ||
| 25 | + return err | ||
| 26 | + } | ||
| 27 | + if !b { | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + return nil | ||
| 33 | +} |
| 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 UpdateCooperationModeCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 共创模式ID | ||
| 14 | + CooperationModeId int `json:"cooperationModeId,string," valid:"Required"` | ||
| 15 | + // 模式名称,唯一确定 | ||
| 16 | + CooperationModeName string `json:"cooperationModeName" valid:"Required"` | ||
| 17 | + // 备注 | ||
| 18 | + Remarks string `json:"remarks" valid:"Required"` | ||
| 19 | + // 共创模式状态,1启用,2禁用 | ||
| 20 | + Status int `json:"status" valid:"Required"` | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func (updateCooperationModeCommand *UpdateCooperationModeCommand) Valid(validation *validation.Validation) { | ||
| 24 | + | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +func (updateCooperationModeCommand *UpdateCooperationModeCommand) ValidateCommand() error { | ||
| 28 | + valid := validation.Validation{} | ||
| 29 | + b, err := valid.Valid(updateCooperationModeCommand) | ||
| 30 | + if err != nil { | ||
| 31 | + return err | ||
| 32 | + } | ||
| 33 | + if !b { | ||
| 34 | + for _, validErr := range valid.Errors { | ||
| 35 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + return nil | ||
| 39 | +} |
| 1 | +package dto | ||
| 2 | + | ||
| 3 | +type CooperationModeItem struct { | ||
| 4 | + // 共创模式ID | ||
| 5 | + CooperationModeId int `json:"cooperationModeId,string,"` | ||
| 6 | + // 模式名称,唯一确定 | ||
| 7 | + CooperationModeName string `json:"cooperationModeName"` | ||
| 8 | + // 备注 | ||
| 9 | + Remarks string `json:"remarks" ` | ||
| 10 | + // 共创模式状态,1启用,2禁用 | ||
| 11 | + Status int `json:"status" ` | ||
| 12 | + // 模式编码,唯一确定 | ||
| 13 | + CooperationModeNumber string `json:"cooperationModeNumber"` | ||
| 14 | + Org struct { | ||
| 15 | + // 组织机构ID | ||
| 16 | + OrgId int `json:"orgId,string"` | ||
| 17 | + // 组织名称 | ||
| 18 | + OrgName string `json:"orgName"` | ||
| 19 | + } `json:"org"` | ||
| 20 | +} |
| 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 GetCooperationModeQuery struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 共创模式ID | ||
| 14 | + CooperationModeId int `json:"cooperationModeId,string" valid:"Required"` | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +func (getCooperationModeQuery *GetCooperationModeQuery) Valid(validation *validation.Validation) { | ||
| 18 | + | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func (getCooperationModeQuery *GetCooperationModeQuery) ValidateQuery() error { | ||
| 22 | + valid := validation.Validation{} | ||
| 23 | + b, err := valid.Valid(getCooperationModeQuery) | ||
| 24 | + if err != nil { | ||
| 25 | + return err | ||
| 26 | + } | ||
| 27 | + if !b { | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + return nil | ||
| 33 | +} |
| 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 ListCooperationModeQuery 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 | + CooperationModeName string `json:"cooperationModeName"` | ||
| 19 | + //组织名称 | ||
| 20 | + OrganizationName string `json:"organizationName"` | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func (listCooperationModeQuery *ListCooperationModeQuery) Valid(validation *validation.Validation) { | ||
| 24 | + | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +func (listCooperationModeQuery *ListCooperationModeQuery) ValidateQuery() error { | ||
| 28 | + valid := validation.Validation{} | ||
| 29 | + b, err := valid.Valid(listCooperationModeQuery) | ||
| 30 | + if err != nil { | ||
| 31 | + return err | ||
| 32 | + } | ||
| 33 | + if !b { | ||
| 34 | + for _, validErr := range valid.Errors { | ||
| 35 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + return nil | ||
| 39 | +} |
| 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/cooperationMode/command" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/dto" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/query" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
| 9 | +) | ||
| 10 | + | ||
| 11 | +// 共创模式服务 | ||
| 12 | +type CooperationModeService struct { | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +//CreateCooperationMode 创建共创模式服务 | ||
| 16 | +func (cooperationModeService *CooperationModeService) CreateCooperationMode(createCooperationModeCommand *command.CreateCooperationModeCommand) (interface{}, error) { | ||
| 17 | + if err := createCooperationModeCommand.ValidateCommand(); err != nil { | ||
| 18 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 19 | + } | ||
| 20 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationModeCommand.Operator) | ||
| 21 | + result, err := creationCooperationGateway.CooperationModeAdd(allied_creation_cooperation.ReqCooperationModeAdd{ | ||
| 22 | + CooperationModeName: createCooperationModeCommand.CooperationModeName, | ||
| 23 | + CooperationModeNumber: createCooperationModeCommand.CooperationModeNumber, | ||
| 24 | + Remarks: createCooperationModeCommand.Remarks, | ||
| 25 | + }) | ||
| 26 | + if err != nil { | ||
| 27 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 28 | + } | ||
| 29 | + data := struct { | ||
| 30 | + CooperationModeId int `json:"cooperationModeId,string," valid:"Required"` | ||
| 31 | + command.CreateCooperationModeCommand | ||
| 32 | + }{ | ||
| 33 | + CooperationModeId: result.CooperationModeId, | ||
| 34 | + CreateCooperationModeCommand: *createCooperationModeCommand, | ||
| 35 | + } | ||
| 36 | + return data, nil | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +//GetCooperationMode 返回共创模式服务 | ||
| 40 | +func (cooperationModeService *CooperationModeService) GetCooperationMode(getCooperationModeQuery *query.GetCooperationModeQuery) (interface{}, error) { | ||
| 41 | + if err := getCooperationModeQuery.ValidateQuery(); err != nil { | ||
| 42 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationModeQuery.Operator) | ||
| 46 | + result, err := creationCooperationGateway.CooperationModeGet(allied_creation_cooperation.ReqCooperationModeGet{ | ||
| 47 | + CooperationModeId: getCooperationModeQuery.CooperationModeId, | ||
| 48 | + }) | ||
| 49 | + if err != nil { | ||
| 50 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 51 | + } | ||
| 52 | + data := dto.CooperationModeItem{ | ||
| 53 | + CooperationModeId: result.CooperationModeId, | ||
| 54 | + CooperationModeName: result.CooperationModeName, | ||
| 55 | + Remarks: result.Remarks, | ||
| 56 | + Status: result.Status, | ||
| 57 | + CooperationModeNumber: result.CooperationModeNumber, | ||
| 58 | + Org: result.Org, | ||
| 59 | + } | ||
| 60 | + return data, nil | ||
| 61 | +} | ||
| 62 | + | ||
| 63 | +//ListCooperationMode 返回共创模式服务列表 | ||
| 64 | +func (cooperationModeService *CooperationModeService) ListCooperationMode(listCooperationModeQuery *query.ListCooperationModeQuery) (int64, interface{}, error) { | ||
| 65 | + if err := listCooperationModeQuery.ValidateQuery(); err != nil { | ||
| 66 | + return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 67 | + } | ||
| 68 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationModeQuery.Operator) | ||
| 69 | + result, err := creationCooperationGateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{ | ||
| 70 | + PageNumber: listCooperationModeQuery.PageNumber, | ||
| 71 | + PageSize: listCooperationModeQuery.PageSize, | ||
| 72 | + CooperationModeName: listCooperationModeQuery.CooperationModeName, | ||
| 73 | + OrganizationName: listCooperationModeQuery.OrganizationName, | ||
| 74 | + }) | ||
| 75 | + if err != nil { | ||
| 76 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 77 | + } | ||
| 78 | + var ( | ||
| 79 | + listData []dto.CooperationModeItem | ||
| 80 | + item dto.CooperationModeItem | ||
| 81 | + ) | ||
| 82 | + for _, v := range result.List { | ||
| 83 | + item = dto.CooperationModeItem{ | ||
| 84 | + CooperationModeId: v.CooperationModeId, | ||
| 85 | + CooperationModeName: v.CooperationModeName, | ||
| 86 | + Remarks: v.Remarks, | ||
| 87 | + Status: v.Status, | ||
| 88 | + CooperationModeNumber: v.CooperationModeNumber, | ||
| 89 | + Org: v.Org, | ||
| 90 | + } | ||
| 91 | + listData = append(listData, item) | ||
| 92 | + } | ||
| 93 | + return int64(result.Total), listData, nil | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +//RemoveCooperationMode 移除共创模式服务 | ||
| 97 | +func (cooperationModeService *CooperationModeService) RemoveCooperationMode(removeCooperationModeCommand *command.RemoveCooperationModeCommand) (interface{}, error) { | ||
| 98 | + if err := removeCooperationModeCommand.ValidateCommand(); err != nil { | ||
| 99 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 100 | + } | ||
| 101 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeCooperationModeCommand.Operator) | ||
| 102 | + _, err := creationCooperationGateway.CooperationModeRemove(allied_creation_cooperation.ReqCooperationModeRemove{ | ||
| 103 | + CooperationModeId: removeCooperationModeCommand.CooperationModeId, | ||
| 104 | + }) | ||
| 105 | + //TODO 改为批量删除 | ||
| 106 | + if err != nil { | ||
| 107 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 108 | + } | ||
| 109 | + return removeCooperationModeCommand, nil | ||
| 110 | +} | ||
| 111 | + | ||
| 112 | +//UpdateCooperationMode 更新共创模式 | ||
| 113 | +func (cooperationModeService *CooperationModeService) UpdateCooperationMode(updateCooperationModeCommand *command.UpdateCooperationModeCommand) (interface{}, error) { | ||
| 114 | + if err := updateCooperationModeCommand.ValidateCommand(); err != nil { | ||
| 115 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 116 | + } | ||
| 117 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationModeCommand.Operator) | ||
| 118 | + _, err := creationCooperationGateway.CooperationModeUpdate(allied_creation_cooperation.ReqCooperationModeUpdate{ | ||
| 119 | + CooperationModeId: updateCooperationModeCommand.CooperationModeId, | ||
| 120 | + CooperationModeName: updateCooperationModeCommand.CooperationModeName, | ||
| 121 | + Remarks: updateCooperationModeCommand.Remarks, | ||
| 122 | + Status: updateCooperationModeCommand.Status, | ||
| 123 | + }) | ||
| 124 | + if err != nil { | ||
| 125 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 126 | + } | ||
| 127 | + return updateCooperationModeCommand, nil | ||
| 128 | +} | ||
| 129 | + | ||
| 130 | +// EnableCooperationMode 禁用启用共创模式 | ||
| 131 | +func (cooperationModeService *CooperationModeService) EnableCooperationMode(updateCooperationModeCommand *command.UpdateCooperationModeCommand) (interface{}, error) { | ||
| 132 | + if err := updateCooperationModeCommand.ValidateCommand(); err != nil { | ||
| 133 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 134 | + } | ||
| 135 | + //TODO gateway 待补充 | ||
| 136 | + return nil, nil | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +func NewCooperationModeService(options map[string]interface{}) *CooperationModeService { | ||
| 140 | + newCooperationModeService := &CooperationModeService{} | ||
| 141 | + return newCooperationModeService | ||
| 142 | +} |
| 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 CreateCooperationProjectCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 模式编码,唯一确定 | ||
| 14 | + CooperationModeNumber string `json:"cooperationModeNumber" valid:"Required"` | ||
| 15 | + // 发起组织ID | ||
| 16 | + OrgId int64 `json:"orgId,string," valid:"Required"` | ||
| 17 | + // 共创项目名称 | ||
| 18 | + CooperationProjectName string `json:"cooperationProjectName" valid:"Required"` | ||
| 19 | + // 共创发起人id | ||
| 20 | + CooperationProjectSponsor string `json:"cooperationProjectSponsor,string,"` | ||
| 21 | + // 项目承接对象 | ||
| 22 | + CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` | ||
| 23 | + // 共创项目描述 | ||
| 24 | + CooperationProjectDescription string `json:"cooperationProjectDescription" valid:"Required"` | ||
| 25 | + //图片 | ||
| 26 | + Images []string `json:"images"` | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (createCooperationProjectCommand *CreateCooperationProjectCommand) Valid(validation *validation.Validation) { | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +func (createCooperationProjectCommand *CreateCooperationProjectCommand) ValidateCommand() error { | ||
| 33 | + valid := validation.Validation{} | ||
| 34 | + b, err := valid.Valid(createCooperationProjectCommand) | ||
| 35 | + if err != nil { | ||
| 36 | + return err | ||
| 37 | + } | ||
| 38 | + if !b { | ||
| 39 | + for _, validErr := range valid.Errors { | ||
| 40 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + return nil | ||
| 44 | +} |
| 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 EndCooperationProjectCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 共创项目id | ||
| 14 | + CooperationProjectId []int64 `json:"cooperationProjectId,omitempty"` | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +func (endCooperationProjectCommand *EndCooperationProjectCommand) Valid(validation *validation.Validation) { | ||
| 18 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func (endCooperationProjectCommand *EndCooperationProjectCommand) ValidateCommand() error { | ||
| 22 | + valid := validation.Validation{} | ||
| 23 | + b, err := valid.Valid(endCooperationProjectCommand) | ||
| 24 | + if err != nil { | ||
| 25 | + return err | ||
| 26 | + } | ||
| 27 | + if !b { | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + return nil | ||
| 33 | +} |
| 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 ReleaseCooperationProjectCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 共创项目名称 | ||
| 14 | + CooperationProjectName string `json:"cooperationProjectName" valid:"Required"` | ||
| 15 | + // 共创模式ID | ||
| 16 | + CooperationModeId int64 `json:"cooperationModeId" valid:"Required"` | ||
| 17 | + // 手机号码 | ||
| 18 | + Phone string `json:"phone" valid:"Required"` | ||
| 19 | + // 共创模式状态,1启用,2禁用 | ||
| 20 | + Status int32 `json:"status" valid:"Required"` | ||
| 21 | + // 用户编号 | ||
| 22 | + UsersCode string `json:"usersCode" valid:"Required"` | ||
| 23 | + // 用户编号 | ||
| 24 | + UsersId int64 `json:"usersId" valid:"Required"` | ||
| 25 | + // 用户姓名 | ||
| 26 | + UsersName string `json:"usersName" valid:"Required"` | ||
| 27 | + // 邮箱 | ||
| 28 | + Email string `json:"email" valid:"Required"` | ||
| 29 | + // 共创公司 | ||
| 30 | + CooperationCompany string `json:"cooperationCompany" valid:"Required"` | ||
| 31 | + // 共创公司到期时间 | ||
| 32 | + CooperationDeadline string `json:"cooperationDeadline" valid:"Required"` | ||
| 33 | + // 共创项目承接对象,1员工,2共创用户,3公开,可以多选 | ||
| 34 | + CooperationProjectUndertakerType []int32 `json:"cooperationProjectUndertakerType" valid:"Required"` | ||
| 35 | + // 共创项目描述 | ||
| 36 | + CooperationProjectDescription string `json:"cooperationProjectDescription" valid:"Required"` | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) Valid(validation *validation.Validation) { | ||
| 40 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) ValidateCommand() error { | ||
| 44 | + valid := validation.Validation{} | ||
| 45 | + b, err := valid.Valid(releaseCooperationProjectCommand) | ||
| 46 | + if err != nil { | ||
| 47 | + return err | ||
| 48 | + } | ||
| 49 | + if !b { | ||
| 50 | + for _, validErr := range valid.Errors { | ||
| 51 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + return nil | ||
| 55 | +} |
| 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 RemoveCooperationProjectCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 共创项目ID | ||
| 14 | + CooperationProjectId int64 `json:"cooperationProjectId" valid:"Required"` | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +func (removeCooperationProjectCommand *RemoveCooperationProjectCommand) Valid(validation *validation.Validation) { | ||
| 18 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func (removeCooperationProjectCommand *RemoveCooperationProjectCommand) ValidateCommand() error { | ||
| 22 | + valid := validation.Validation{} | ||
| 23 | + b, err := valid.Valid(removeCooperationProjectCommand) | ||
| 24 | + if err != nil { | ||
| 25 | + return err | ||
| 26 | + } | ||
| 27 | + if !b { | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + return nil | ||
| 33 | +} |
| 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 UpdateCooperationProjectCommand struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 共创项目ID | ||
| 14 | + CooperationProjectId string `json:"cooperationProjectId" valid:"Required"` | ||
| 15 | + // 模式编码,唯一确定 | ||
| 16 | + CooperationModeNumber string `json:"cooperationModeNumber" valid:"Required"` | ||
| 17 | + // 组织ID | ||
| 18 | + OrgId string `json:"orgId" valid:"Required"` | ||
| 19 | + // 共创项目名称 | ||
| 20 | + CooperationProjectName string `json:"cooperationProjectName" valid:"Required"` | ||
| 21 | + // 共创发起人id | ||
| 22 | + CooperationProjectSponsor string `json:"cooperationProjectSponsor,omitempty"` | ||
| 23 | + // 项目承接对象 | ||
| 24 | + CooperationProjectUndertakerType []int32 `json:"cooperationProjectUndertakerType,omitempty"` | ||
| 25 | + // 共创项目描述 | ||
| 26 | + CooperationProjectDescription string `json:"cooperationProjectDescription" valid:"Required"` | ||
| 27 | + //图片 | ||
| 28 | + Images []string `json:"images"` | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) Valid(validation *validation.Validation) { | ||
| 32 | + validation.SetError("CustomValid", "未实现的自定义认证") | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) ValidateCommand() error { | ||
| 36 | + valid := validation.Validation{} | ||
| 37 | + b, err := valid.Valid(updateCooperationProjectCommand) | ||
| 38 | + if err != nil { | ||
| 39 | + return err | ||
| 40 | + } | ||
| 41 | + if !b { | ||
| 42 | + for _, validErr := range valid.Errors { | ||
| 43 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + return nil | ||
| 47 | +} |
| 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 GetCooperationProjectQuery struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 共创项目ID | ||
| 14 | + CooperationProjectId int `json:"cooperationProjectId,string" valid:"Required"` | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +func (getCooperationProjectQuery *GetCooperationProjectQuery) Valid(validation *validation.Validation) { | ||
| 18 | + | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func (getCooperationProjectQuery *GetCooperationProjectQuery) ValidateQuery() error { | ||
| 22 | + valid := validation.Validation{} | ||
| 23 | + b, err := valid.Valid(getCooperationProjectQuery) | ||
| 24 | + if err != nil { | ||
| 25 | + return err | ||
| 26 | + } | ||
| 27 | + if !b { | ||
| 28 | + for _, validErr := range valid.Errors { | ||
| 29 | + return fmt.Errorf("%s %s", validErr.Key, validErr.Message) | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + return nil | ||
| 33 | +} |
| 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 ListCooperationProjectQuery struct { | ||
| 11 | + //操作人 | ||
| 12 | + Operator domain.Operator `json:"-"` | ||
| 13 | + // 查询偏离量 | ||
| 14 | + PageNumber int `json:"pageNumber"` | ||
| 15 | + // 查询限制 | ||
| 16 | + PageSize int `json:"pageSize" valid:"Required"` | ||
| 17 | + // 项目状态 全部、招标中、已结束 | ||
| 18 | + // Status int32 `json:"status" valid:"Required"` | ||
| 19 | + //发起部门名称 | ||
| 20 | + DepartmentName string `json:"departmentName"` | ||
| 21 | + //项目名称 | ||
| 22 | + CooperationProjectName string `json:"cooperationProjectName"` | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +func (listCooperationProjectQuery *ListCooperationProjectQuery) Valid(validation *validation.Validation) { | ||
| 26 | + | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (listCooperationProjectQuery *ListCooperationProjectQuery) ValidateQuery() error { | ||
| 30 | + valid := validation.Validation{} | ||
| 31 | + b, err := valid.Valid(listCooperationProjectQuery) | ||
| 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 | + "strconv" | ||
| 5 | + | ||
| 6 | + "github.com/linmadan/egglib-go/core/application" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/command" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/query" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" | ||
| 10 | +) | ||
| 11 | + | ||
| 12 | +// 共创项目管理 | ||
| 13 | +type CooperationProjectService struct { | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +// 创建共创项目管理 | ||
| 17 | +func (cooperationProjectService *CooperationProjectService) CreateCooperationProject(createCooperationProjectCommand *command.CreateCooperationProjectCommand) (interface{}, error) { | ||
| 18 | + if err := createCooperationProjectCommand.ValidateCommand(); err != nil { | ||
| 19 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 20 | + } | ||
| 21 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationProjectCommand.Operator) | ||
| 22 | + result, err := creationCooperationGateway.CooperationProjectAdd(allied_creation_cooperation.ReqCooperationProjectAdd{ | ||
| 23 | + CooperationProjectDescription: createCooperationProjectCommand.CooperationProjectDescription, | ||
| 24 | + CooperationProjectName: createCooperationProjectCommand.CooperationProjectName, | ||
| 25 | + PublisherUid: strconv.Itoa(int(createCooperationProjectCommand.Operator.UserId)), | ||
| 26 | + SponsorUid: createCooperationProjectCommand.CooperationProjectSponsor, | ||
| 27 | + CooperationProjectUndertakerType: createCooperationProjectCommand.CooperationProjectUndertakerType, | ||
| 28 | + Images: createCooperationProjectCommand.Images, | ||
| 29 | + }) | ||
| 30 | + | ||
| 31 | + if err != nil { | ||
| 32 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 33 | + } | ||
| 34 | + data := struct { | ||
| 35 | + CooperationProjectId int `json:"cooperationProjectId"` | ||
| 36 | + command.CreateCooperationProjectCommand | ||
| 37 | + }{ | ||
| 38 | + CooperationProjectId: result.CooperationProjectId, | ||
| 39 | + CreateCooperationProjectCommand: *createCooperationProjectCommand, | ||
| 40 | + } | ||
| 41 | + return data, nil | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +// 结束共创项目管理 | ||
| 45 | +func (cooperationProjectService *CooperationProjectService) EndCooperationProject(endCooperationProjectCommand *command.EndCooperationProjectCommand) (interface{}, error) { | ||
| 46 | + if err := endCooperationProjectCommand.ValidateCommand(); err != nil { | ||
| 47 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 48 | + } | ||
| 49 | + //creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(endCooperationProjectCommand.Operator) | ||
| 50 | + return nil, nil | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +// 返回共创项目管理 | ||
| 54 | +func (cooperationProjectService *CooperationProjectService) GetCooperationProject(getCooperationProjectQuery *query.GetCooperationProjectQuery) (interface{}, error) { | ||
| 55 | + if err := getCooperationProjectQuery.ValidateQuery(); err != nil { | ||
| 56 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 57 | + } | ||
| 58 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationProjectQuery.Operator) | ||
| 59 | + result, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{ | ||
| 60 | + CooperationProjectId: getCooperationProjectQuery.CooperationProjectId, | ||
| 61 | + }) | ||
| 62 | + if err != nil { | ||
| 63 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 64 | + } | ||
| 65 | + return result, nil | ||
| 66 | + | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +// 返回共创项目管理列表 | ||
| 70 | +func (cooperationProjectService *CooperationProjectService) ListCooperationProject(listCooperationProjectQuery *query.ListCooperationProjectQuery) (int64, interface{}, error) { | ||
| 71 | + if err := listCooperationProjectQuery.ValidateQuery(); err != nil { | ||
| 72 | + return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 73 | + } | ||
| 74 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationProjectQuery.Operator) | ||
| 75 | + result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ | ||
| 76 | + PageNumber: listCooperationProjectQuery.PageNumber, | ||
| 77 | + PageSize: listCooperationProjectQuery.PageSize, | ||
| 78 | + //发起部门名称 | ||
| 79 | + DepartmentName: listCooperationProjectQuery.DepartmentName, | ||
| 80 | + //项目名 | ||
| 81 | + CooperationProjectName: listCooperationProjectQuery.CooperationProjectName, | ||
| 82 | + }) | ||
| 83 | + if err != nil { | ||
| 84 | + return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 85 | + } | ||
| 86 | + return result.Total, result.CooperationProjects, nil | ||
| 87 | +} | ||
| 88 | + | ||
| 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 | +// 更新共创项目管理 | ||
| 99 | +func (cooperationProjectService *CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) { | ||
| 100 | + if err := updateCooperationProjectCommand.ValidateCommand(); err != nil { | ||
| 101 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
| 102 | + } | ||
| 103 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator) | ||
| 104 | + _, err := creationCooperationGateway.CooperationProjectUpdate(allied_creation_cooperation.ReqCooperationProjectUpdate{ | ||
| 105 | + CooperationProjectId: updateCooperationProjectCommand.CooperationProjectId, | ||
| 106 | + CooperationProjectName: updateCooperationProjectCommand.CooperationProjectName, | ||
| 107 | + CooperationProjectUndertakerType: updateCooperationProjectCommand.CooperationProjectUndertakerType, | ||
| 108 | + SponsorUid: updateCooperationProjectCommand.CooperationProjectSponsor, | ||
| 109 | + PublisherUid: strconv.Itoa(int(updateCooperationProjectCommand.Operator.UserId)), | ||
| 110 | + CooperationProjectDescription: updateCooperationProjectCommand.CooperationProjectDescription, | ||
| 111 | + Images: updateCooperationProjectCommand.Images, | ||
| 112 | + }) | ||
| 113 | + if err != nil { | ||
| 114 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + return updateCooperationProjectCommand, nil | ||
| 118 | +} | ||
| 119 | + | ||
| 120 | +func NewCooperationProjectService(options map[string]interface{}) *CooperationProjectService { | ||
| 121 | + newCooperationProjectService := &CooperationProjectService{} | ||
| 122 | + return newCooperationProjectService | ||
| 123 | +} |
| @@ -212,7 +212,7 @@ func (rolesService *RolesService) RoleRemove(roleRemoveCommand *command.RoleRemo | @@ -212,7 +212,7 @@ func (rolesService *RolesService) RoleRemove(roleRemoveCommand *command.RoleRemo | ||
| 212 | } | 212 | } |
| 213 | } | 213 | } |
| 214 | _, err := creationUserGateway.RoleBatchRemove(allied_creation_user.ReqRoleBatchRemove{ | 214 | _, err := creationUserGateway.RoleBatchRemove(allied_creation_user.ReqRoleBatchRemove{ |
| 215 | - roleIds, | 215 | + RoleIds: roleIds, |
| 216 | }) | 216 | }) |
| 217 | if err != nil { | 217 | if err != nil { |
| 218 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 218 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
pkg/domain/attachment.go
0 → 100644
| @@ -12,7 +12,7 @@ import ( | @@ -12,7 +12,7 @@ import ( | ||
| 12 | 12 | ||
| 13 | // CooperationApplicationUpdaet 更新共创申请 | 13 | // CooperationApplicationUpdaet 更新共创申请 |
| 14 | func (gateway HttplibAlliedCreationCooperation) CooperationApplicationUpdaet(param ReqCooperationApplicationUpdate) (*DataCooperationApplicationUpdate, error) { | 14 | func (gateway HttplibAlliedCreationCooperation) CooperationApplicationUpdaet(param ReqCooperationApplicationUpdate) (*DataCooperationApplicationUpdate, error) { |
| 15 | - url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.ApplicationId) | 15 | + url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.CooperationApplicationId) |
| 16 | method := "PUT" | 16 | method := "PUT" |
| 17 | req := gateway.CreateRequest(url, method) | 17 | req := gateway.CreateRequest(url, method) |
| 18 | log.Logger.Debug("向基础模块请求数据:更新共创申请。", map[string]interface{}{ | 18 | log.Logger.Debug("向基础模块请求数据:更新共创申请。", map[string]interface{}{ |
| @@ -73,7 +73,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectList(param Req | @@ -73,7 +73,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectList(param Req | ||
| 73 | 73 | ||
| 74 | // Cooperation-projects[cooperationProjectId} 返回共创项目详情 | 74 | // Cooperation-projects[cooperationProjectId} 返回共创项目详情 |
| 75 | func (gateway HttplibAlliedCreationCooperation) CooperationProjectGet(param ReqCooperationProjectGet) (*DataCooperationProjectGet, error) { | 75 | func (gateway HttplibAlliedCreationCooperation) CooperationProjectGet(param ReqCooperationProjectGet) (*DataCooperationProjectGet, error) { |
| 76 | - url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.ProjectId) | 76 | + url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.CooperationProjectId) |
| 77 | method := "GET" | 77 | method := "GET" |
| 78 | req := gateway.CreateRequest(url, method) | 78 | req := gateway.CreateRequest(url, method) |
| 79 | log.Logger.Debug("向基础模块请求数据:返回共创项目详情。", map[string]interface{}{ | 79 | log.Logger.Debug("向基础模块请求数据:返回共创项目详情。", map[string]interface{}{ |
| @@ -135,7 +135,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectUpdate(param R | @@ -135,7 +135,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectUpdate(param R | ||
| 135 | 135 | ||
| 136 | //CooperationProjectRemove 移除共创项目 | 136 | //CooperationProjectRemove 移除共创项目 |
| 137 | func (gateway HttplibAlliedCreationCooperation) CooperationProjectRemove(param ReqCooperationProjectRemove) (*DataCooperationProjectRemove, error) { | 137 | func (gateway HttplibAlliedCreationCooperation) CooperationProjectRemove(param ReqCooperationProjectRemove) (*DataCooperationProjectRemove, error) { |
| 138 | - url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.ProjectId) | 138 | + url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.CooperationProjectID) |
| 139 | method := "DELETE" | 139 | method := "DELETE" |
| 140 | req := gateway.CreateRequest(url, method) | 140 | req := gateway.CreateRequest(url, method) |
| 141 | log.Logger.Debug("向基础模块请求数据:移除共创项目。", map[string]interface{}{ | 141 | 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" | ||
| 4 | + | ||
| 3 | //更新共创申请 | 5 | //更新共创申请 |
| 4 | type ( | 6 | type ( |
| 5 | ReqCooperationApplicationUpdate struct { | 7 | ReqCooperationApplicationUpdate struct { |
| 6 | - ApplicationId int | 8 | + CooperationApplicationId int |
| 7 | } | 9 | } |
| 8 | 10 | ||
| 9 | DataCooperationApplicationUpdate struct { | 11 | DataCooperationApplicationUpdate struct { |
| @@ -32,7 +34,7 @@ type ( | @@ -32,7 +34,7 @@ type ( | ||
| 32 | //审核-同意共创申请 | 34 | //审核-同意共创申请 |
| 33 | type ( | 35 | type ( |
| 34 | ReqCooperationApplicationAgree struct { | 36 | ReqCooperationApplicationAgree struct { |
| 35 | - ApplicationId int | 37 | + CooperationApplicationId int |
| 36 | } | 38 | } |
| 37 | 39 | ||
| 38 | DataCooperationApplicationAgree struct { | 40 | DataCooperationApplicationAgree struct { |
| @@ -42,7 +44,7 @@ type ( | @@ -42,7 +44,7 @@ type ( | ||
| 42 | //审核-拒绝共创申请 | 44 | //审核-拒绝共创申请 |
| 43 | type ( | 45 | type ( |
| 44 | ReqCooperationApplicationReject struct { | 46 | ReqCooperationApplicationReject struct { |
| 45 | - ApplicationId int | 47 | + CooperationApplicationId int |
| 46 | } | 48 | } |
| 47 | 49 | ||
| 48 | DataCooperationApplicationReject struct { | 50 | DataCooperationApplicationReject struct { |
| @@ -52,9 +54,18 @@ type ( | @@ -52,9 +54,18 @@ type ( | ||
| 52 | //创建共创申请 | 54 | //创建共创申请 |
| 53 | type ( | 55 | type ( |
| 54 | ReqCooperationApplicationAdd struct { | 56 | ReqCooperationApplicationAdd struct { |
| 57 | + // 共创申请人uid | ||
| 58 | + ApplicantUid string `json:"applicantUid" ` | ||
| 59 | + // 共创申请描述 | ||
| 60 | + CooperationApplicationDescription string ` json:"cooperationApplicationDescription"` | ||
| 61 | + // 共创申请描述附件 | ||
| 62 | + CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"` | ||
| 63 | + // 关联的共创项目编号 | ||
| 64 | + CooperationProjectNumber string `json:"cooperationProjectNumber"` | ||
| 55 | } | 65 | } |
| 56 | 66 | ||
| 57 | DataCooperationApplicationAdd struct { | 67 | DataCooperationApplicationAdd struct { |
| 68 | + CooperationApplicationId int `json:"cooperationApplicationId,string"` | ||
| 58 | } | 69 | } |
| 59 | ) | 70 | ) |
| 60 | 71 | ||
| @@ -98,7 +109,7 @@ type ( | @@ -98,7 +109,7 @@ type ( | ||
| 98 | //返回共创申请详情 | 109 | //返回共创申请详情 |
| 99 | type ( | 110 | type ( |
| 100 | ReqCooperationApplicationGet struct { | 111 | ReqCooperationApplicationGet struct { |
| 101 | - ApplicationId int | 112 | + CooperationApplicationId int |
| 102 | } | 113 | } |
| 103 | 114 | ||
| 104 | DataCooperationApplicationGet struct { | 115 | DataCooperationApplicationGet struct { |
| @@ -9,6 +9,31 @@ type ( | @@ -9,6 +9,31 @@ type ( | ||
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | DataCooperationModeAdd struct { | 11 | DataCooperationModeAdd struct { |
| 12 | + // 共创模式ID | ||
| 13 | + CooperationModeId int `json:"cooperationModeId,string"` | ||
| 14 | + // 共创模式编码, | ||
| 15 | + CooperationModeNumber string `json:"cooperationModeNumber"` | ||
| 16 | + // 模式名称, | ||
| 17 | + CooperationModeName string `json:"cooperationModeName"` | ||
| 18 | + // 共创模式状态,1启用,2禁用 | ||
| 19 | + Status int `json:"status"` | ||
| 20 | + // 备注 | ||
| 21 | + Remarks string `json:"remarks"` | ||
| 22 | + Company struct { | ||
| 23 | + // 公司ID, | ||
| 24 | + CompanyId int `json:"companyId,string"` | ||
| 25 | + // 公司logo | ||
| 26 | + CompanyLogo string `json:"companyLogo"` | ||
| 27 | + // 公司名称 | ||
| 28 | + CompanyName string `json:"companyName"` | ||
| 29 | + } `json:"company"` | ||
| 30 | + // 数据所属组织机构 | ||
| 31 | + Org struct { | ||
| 32 | + // 组织机构ID | ||
| 33 | + OrgId int `json:"orgId,string"` | ||
| 34 | + // 组织名称 | ||
| 35 | + OrgName string `json:"orgName"` | ||
| 36 | + } `json:"org"` | ||
| 12 | } | 37 | } |
| 13 | ) | 38 | ) |
| 14 | 39 | ||
| @@ -23,7 +48,7 @@ type ( | @@ -23,7 +48,7 @@ type ( | ||
| 23 | Total int `json:"total"` | 48 | Total int `json:"total"` |
| 24 | List []struct { | 49 | List []struct { |
| 25 | // 共创模式ID | 50 | // 共创模式ID |
| 26 | - CooperationModeId int `json:"cooperationModeId"` | 51 | + CooperationModeId int `json:"cooperationModeId,string"` |
| 27 | // 共创模式编码, | 52 | // 共创模式编码, |
| 28 | CooperationModeNumber string `json:"cooperationModeNumber"` | 53 | CooperationModeNumber string `json:"cooperationModeNumber"` |
| 29 | // 模式名称, | 54 | // 模式名称, |
| @@ -34,7 +59,7 @@ type ( | @@ -34,7 +59,7 @@ type ( | ||
| 34 | Remarks string `json:"remarks"` | 59 | Remarks string `json:"remarks"` |
| 35 | Company struct { | 60 | Company struct { |
| 36 | // 公司ID, | 61 | // 公司ID, |
| 37 | - CompanyId int `json:"companyId"` | 62 | + CompanyId int `json:"companyId,string"` |
| 38 | // 公司logo | 63 | // 公司logo |
| 39 | CompanyLogo string `json:"companyLogo"` | 64 | CompanyLogo string `json:"companyLogo"` |
| 40 | // 公司名称 | 65 | // 公司名称 |
| @@ -43,7 +68,7 @@ type ( | @@ -43,7 +68,7 @@ type ( | ||
| 43 | // 数据所属组织机构 | 68 | // 数据所属组织机构 |
| 44 | Org struct { | 69 | Org struct { |
| 45 | // 组织机构ID | 70 | // 组织机构ID |
| 46 | - OrgId int `json:"orgId"` | 71 | + OrgId int `json:"orgId,string"` |
| 47 | // 组织名称 | 72 | // 组织名称 |
| 48 | OrgName string `json:"orgName"` | 73 | OrgName string `json:"orgName"` |
| 49 | } `json:"org"` | 74 | } `json:"org"` |
| @@ -54,12 +79,12 @@ type ( | @@ -54,12 +79,12 @@ type ( | ||
| 54 | //返回共创模式详情 | 79 | //返回共创模式详情 |
| 55 | type ( | 80 | type ( |
| 56 | ReqCooperationModeGet struct { | 81 | ReqCooperationModeGet struct { |
| 57 | - CooperationModeId int `json:"modeId"` | 82 | + CooperationModeId int `json:"cooperationModeId"` |
| 58 | } | 83 | } |
| 59 | 84 | ||
| 60 | DataCooperationModeGet struct { | 85 | DataCooperationModeGet struct { |
| 61 | // 共创模式ID | 86 | // 共创模式ID |
| 62 | - CooperationModeId int `json:"cooperationModeId"` | 87 | + CooperationModeId int `json:"cooperationModeId,string"` |
| 63 | // 共创模式编码, | 88 | // 共创模式编码, |
| 64 | CooperationModeNumber string `json:"cooperationModeNumber"` | 89 | CooperationModeNumber string `json:"cooperationModeNumber"` |
| 65 | // 模式名称, | 90 | // 模式名称, |
| @@ -89,12 +114,10 @@ type ( | @@ -89,12 +114,10 @@ type ( | ||
| 89 | //更新共创模式 | 114 | //更新共创模式 |
| 90 | type ( | 115 | type ( |
| 91 | ReqCooperationModeUpdate struct { | 116 | ReqCooperationModeUpdate struct { |
| 92 | - // 共创模式ID | ||
| 93 | - CooperationModeId int `json:"cooperationModeId"` | 117 | + CooperationModeId int `json:"cooperationModeId"` // 共创模式ID |
| 94 | CooperationModeName string `json:"cooperationModeName"` | 118 | CooperationModeName string `json:"cooperationModeName"` |
| 95 | Remarks string `json:"remarks"` | 119 | Remarks string `json:"remarks"` |
| 96 | - // 共创模式状态,1启用,2禁用 | ||
| 97 | - Status int `json:"status"` | 120 | + Status int `json:"status"` // 共创模式状态,1启用,2禁用 |
| 98 | } | 121 | } |
| 99 | 122 | ||
| 100 | DataCooperationModeUpdate struct { | 123 | DataCooperationModeUpdate struct { |
| @@ -104,7 +127,7 @@ type ( | @@ -104,7 +127,7 @@ type ( | ||
| 104 | //移除共创模式 | 127 | //移除共创模式 |
| 105 | type ( | 128 | type ( |
| 106 | ReqCooperationModeRemove struct { | 129 | ReqCooperationModeRemove struct { |
| 107 | - CooperationModeId int `json:"modeId"` | 130 | + CooperationModeId int `json:"cooperationModeId"` |
| 108 | } | 131 | } |
| 109 | 132 | ||
| 110 | DataCooperationModeRemove struct { | 133 | DataCooperationModeRemove struct { |
| @@ -114,8 +137,44 @@ type ( | @@ -114,8 +137,44 @@ type ( | ||
| 114 | //查询共创模式 | 137 | //查询共创模式 |
| 115 | type ( | 138 | type ( |
| 116 | ReqCooperationModesSearch struct { | 139 | ReqCooperationModesSearch struct { |
| 140 | + // 页面大小 | ||
| 141 | + PageNumber int `json:"pageNumber,omitempty,"` | ||
| 142 | + // 页面大小 | ||
| 143 | + PageSize int `json:"pageSize,omitempty,"` | ||
| 144 | + //模式名称 | ||
| 145 | + CooperationModeName string `json:"cooperationModeName"` | ||
| 146 | + //组织名称 | ||
| 147 | + OrganizationName string `json:"organizationName"` | ||
| 117 | } | 148 | } |
| 118 | 149 | ||
| 119 | DataCooperationModesSearch struct { | 150 | DataCooperationModesSearch struct { |
| 151 | + Total int `json:"total"` | ||
| 152 | + List []struct { | ||
| 153 | + // 共创模式ID | ||
| 154 | + CooperationModeId int `json:"cooperationModeId,string"` | ||
| 155 | + // 共创模式编码, | ||
| 156 | + CooperationModeNumber string `json:"cooperationModeNumber"` | ||
| 157 | + // 模式名称, | ||
| 158 | + CooperationModeName string `json:"cooperationModeName"` | ||
| 159 | + // 共创模式状态,1启用,2禁用 | ||
| 160 | + Status int `json:"status"` | ||
| 161 | + // 备注 | ||
| 162 | + Remarks string `json:"remarks"` | ||
| 163 | + Company struct { | ||
| 164 | + // 公司ID, | ||
| 165 | + CompanyId int `json:"companyId,string"` | ||
| 166 | + // 公司logo | ||
| 167 | + CompanyLogo string `json:"companyLogo"` | ||
| 168 | + // 公司名称 | ||
| 169 | + CompanyName string `json:"companyName"` | ||
| 170 | + } `json:"company"` | ||
| 171 | + // 数据所属组织机构 | ||
| 172 | + Org struct { | ||
| 173 | + // 组织机构ID | ||
| 174 | + OrgId int `json:"orgId,string"` | ||
| 175 | + // 组织名称 | ||
| 176 | + OrgName string `json:"orgName"` | ||
| 177 | + } `json:"org"` | ||
| 178 | + } `json:"list"` | ||
| 120 | } | 179 | } |
| 121 | ) | 180 | ) |
| @@ -3,9 +3,16 @@ package allied_creation_cooperation | @@ -3,9 +3,16 @@ package allied_creation_cooperation | ||
| 3 | //创建共创项目 | 3 | //创建共创项目 |
| 4 | type ( | 4 | type ( |
| 5 | ReqCooperationProjectAdd struct { | 5 | ReqCooperationProjectAdd struct { |
| 6 | + CooperationProjectDescription string `json:"cooperationProjectDescription"` | ||
| 7 | + CooperationProjectName string `json:"cooperationProjectName"` | ||
| 8 | + PublisherUid string `json:"publisherUid"` | ||
| 9 | + SponsorUid string `json:"sponsorUid"` | ||
| 10 | + CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` | ||
| 11 | + Images []string `json:"images"` | ||
| 6 | } | 12 | } |
| 7 | 13 | ||
| 8 | DataCooperationProjectAdd struct { | 14 | DataCooperationProjectAdd struct { |
| 15 | + CooperationProjectId int `json:"cooperationProjectId"` | ||
| 9 | } | 16 | } |
| 10 | ) | 17 | ) |
| 11 | 18 | ||
| @@ -21,17 +28,70 @@ type ( | @@ -21,17 +28,70 @@ type ( | ||
| 21 | //返回共创项目详情 | 28 | //返回共创项目详情 |
| 22 | type ( | 29 | type ( |
| 23 | ReqCooperationProjectGet struct { | 30 | ReqCooperationProjectGet struct { |
| 24 | - ProjectId int | 31 | + CooperationProjectId int |
| 25 | } | 32 | } |
| 26 | 33 | ||
| 27 | DataCooperationProjectGet struct { | 34 | DataCooperationProjectGet struct { |
| 35 | + CooperationProject struct { | ||
| 36 | + CooperationMode struct { | ||
| 37 | + CooperationModeID int `json:"cooperationModeId,string"` | ||
| 38 | + CooperationModeName string `json:"cooperationModeName"` | ||
| 39 | + CooperationModeNumber string `json:"cooperationModeNumber"` | ||
| 40 | + } `json:"cooperationMode"` | ||
| 41 | + CooperationProjectDescription string `json:"cooperationProjectDescription"` | ||
| 42 | + Images []string `json:"images"` | ||
| 43 | + CooperationProjectID int `json:"cooperationProjectId,string"` | ||
| 44 | + CooperationProjectName string `json:"cooperationProjectName"` | ||
| 45 | + CooperationProjectNumber string `json:"cooperationProjectNumber"` | ||
| 46 | + CooperationProjectPublishTime string `json:"cooperationProjectPublishTime"` | ||
| 47 | + CooperationProjectPublisher struct { | ||
| 48 | + CooperationCompany string `json:"cooperationCompany"` | ||
| 49 | + CooperationDeadline string `json:"cooperationDeadline"` | ||
| 50 | + Email string `json:"email"` | ||
| 51 | + Phone string `json:"phone"` | ||
| 52 | + Status int `json:"status"` | ||
| 53 | + UsersCode string `json:"usersCode"` | ||
| 54 | + UsersID int `json:"usersId,string"` | ||
| 55 | + UsersName string `json:"usersName"` | ||
| 56 | + } `json:"cooperationProjectPublisher"` | ||
| 57 | + CooperationProjectSponsor struct { | ||
| 58 | + CooperationCompany string `json:"cooperationCompany"` | ||
| 59 | + CooperationDeadline string `json:"cooperationDeadline"` | ||
| 60 | + Email string `json:"email"` | ||
| 61 | + Phone string `json:"phone"` | ||
| 62 | + Status int `json:"status"` | ||
| 63 | + UsersCode string `json:"usersCode"` | ||
| 64 | + UsersID int `json:"usersId,string"` | ||
| 65 | + UsersName string `json:"usersName"` | ||
| 66 | + } `json:"cooperationProjectSponsor"` | ||
| 67 | + CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` | ||
| 68 | + Department struct { | ||
| 69 | + CompanyID int `json:"companyId,string"` | ||
| 70 | + OrgCode string `json:"orgCode"` | ||
| 71 | + OrgID int `json:"orgId,string"` | ||
| 72 | + OrgName string `json:"orgName"` | ||
| 73 | + } `json:"department"` | ||
| 74 | + Status int `json:"status"` | ||
| 75 | + } `json:"cooperationProject"` | ||
| 28 | } | 76 | } |
| 29 | ) | 77 | ) |
| 30 | 78 | ||
| 31 | //更新共创项目 | 79 | //更新共创项目 |
| 32 | type ( | 80 | type ( |
| 33 | ReqCooperationProjectUpdate struct { | 81 | ReqCooperationProjectUpdate struct { |
| 34 | - ProjectId int | 82 | + // 共创项目ID |
| 83 | + CooperationProjectId string `json:"cooperationProjectId" ` | ||
| 84 | + // 共创项目名称 | ||
| 85 | + CooperationProjectName string `json:"cooperationProjectName"` | ||
| 86 | + // 承接对象,1员工,2共创用户,3公开,可以多选 | ||
| 87 | + CooperationProjectUndertakerType []int32 `json:"cooperationProjectUndertakerType"` | ||
| 88 | + // 共创项目发起人uid | ||
| 89 | + SponsorUid string `json:"sponsorUid"` | ||
| 90 | + // 共创项目发布人uid | ||
| 91 | + PublisherUid string `json:"publisherUid"` | ||
| 92 | + // 共创项目描述 | ||
| 93 | + CooperationProjectDescription string `json:"cooperationProjectDescription"` | ||
| 94 | + Images []string `json:"images"` | ||
| 35 | } | 95 | } |
| 36 | 96 | ||
| 37 | DataCooperationProjectUpdate struct { | 97 | DataCooperationProjectUpdate struct { |
| @@ -41,7 +101,7 @@ type ( | @@ -41,7 +101,7 @@ type ( | ||
| 41 | //移除共创项目 | 101 | //移除共创项目 |
| 42 | type ( | 102 | type ( |
| 43 | ReqCooperationProjectRemove struct { | 103 | ReqCooperationProjectRemove struct { |
| 44 | - ProjectId int | 104 | + CooperationProjectID int |
| 45 | } | 105 | } |
| 46 | 106 | ||
| 47 | DataCooperationProjectRemove struct { | 107 | DataCooperationProjectRemove struct { |
| @@ -60,15 +120,66 @@ type ( | @@ -60,15 +120,66 @@ type ( | ||
| 60 | //查询共创项目 | 120 | //查询共创项目 |
| 61 | type ( | 121 | type ( |
| 62 | ReqCooperationProjectSearch struct { | 122 | ReqCooperationProjectSearch struct { |
| 123 | + PageNumber int `json:"pageNumber"` | ||
| 124 | + PageSize int `json:"pageSize"` | ||
| 125 | + //发起部门名称 | ||
| 126 | + DepartmentName string `json:"departmentName"` | ||
| 127 | + //项目名称 | ||
| 128 | + CooperationProjectName string `json:"cooperationProjectName"` | ||
| 129 | + Status int `json:"status"` | ||
| 63 | } | 130 | } |
| 64 | 131 | ||
| 65 | DataCooperationProjectSearch struct { | 132 | DataCooperationProjectSearch struct { |
| 133 | + Total int64 `json:"total"` | ||
| 134 | + CooperationProjects []struct { | ||
| 135 | + CooperationMode struct { | ||
| 136 | + CooperationModeID int `json:"cooperationModeId,string,"` | ||
| 137 | + CooperationModeName string `json:"cooperationModeName"` | ||
| 138 | + CooperationModeNumber string `json:"cooperationModeNumber"` | ||
| 139 | + } `json:"cooperationMode"` | ||
| 140 | + CooperationProjectDescription string `json:"cooperationProjectDescription"` | ||
| 141 | + Images []string `json:"images"` | ||
| 142 | + CooperationProjectID int `json:"cooperationProjectId,string,"` | ||
| 143 | + CooperationProjectName string `json:"cooperationProjectName"` | ||
| 144 | + CooperationProjectNumber string `json:"cooperationProjectNumber"` | ||
| 145 | + CooperationProjectPublishTime string `json:"cooperationProjectPublishTime"` | ||
| 146 | + CooperationProjectPublisher struct { | ||
| 147 | + CooperationCompany string `json:"cooperationCompany"` | ||
| 148 | + CooperationDeadline string `json:"cooperationDeadline"` | ||
| 149 | + Email string `json:"email"` | ||
| 150 | + Phone string `json:"phone"` | ||
| 151 | + Status int `json:"status"` | ||
| 152 | + UsersCode string `json:"usersCode"` | ||
| 153 | + UsersID int `json:"usersId,string,"` | ||
| 154 | + UsersName string `json:"usersName"` | ||
| 155 | + } `json:"cooperationProjectPublisher"` | ||
| 156 | + CooperationProjectSponsor struct { | ||
| 157 | + CooperationCompany string `json:"cooperationCompany"` | ||
| 158 | + CooperationDeadline string `json:"cooperationDeadline"` | ||
| 159 | + Email string `json:"email"` | ||
| 160 | + Phone string `json:"phone"` | ||
| 161 | + Status int `json:"status"` | ||
| 162 | + UsersCode string `json:"usersCode"` | ||
| 163 | + UsersID int `json:"usersId,string,"` | ||
| 164 | + UsersName string `json:"usersName"` | ||
| 165 | + } `json:"cooperationProjectSponsor"` | ||
| 166 | + CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` | ||
| 167 | + Department struct { | ||
| 168 | + CompanyID int `json:"companyId,string,"` | ||
| 169 | + OrgCode string `json:"orgCode"` | ||
| 170 | + OrgID int `json:"orgId,string,"` | ||
| 171 | + OrgName string `json:"orgName"` | ||
| 172 | + } `json:"department"` | ||
| 173 | + Status int `json:"status"` | ||
| 174 | + } `json:"cooperationProjects"` | ||
| 66 | } | 175 | } |
| 67 | ) | 176 | ) |
| 68 | 177 | ||
| 69 | //判断当前勾选的承接对象是否存在用户 | 178 | //判断当前勾选的承接对象是否存在用户 |
| 70 | type ( | 179 | type ( |
| 71 | ReqCooperationProjectsCheck struct { | 180 | ReqCooperationProjectsCheck struct { |
| 181 | + CooperationProjectId int | ||
| 182 | + CooperationProjectUndertakerTypes []int | ||
| 72 | } | 183 | } |
| 73 | 184 | ||
| 74 | DataCooperationProjectsCheck struct { | 185 | DataCooperationProjectsCheck struct { |
| @@ -13,8 +13,7 @@ func (controller *baseController) returnPageListData(count int64, data interface | @@ -13,8 +13,7 @@ func (controller *baseController) returnPageListData(count int64, data interface | ||
| 13 | dataMap := map[string]interface{}{ | 13 | dataMap := map[string]interface{}{ |
| 14 | "grid": map[string]interface{}{ | 14 | "grid": map[string]interface{}{ |
| 15 | "total": count, | 15 | "total": count, |
| 16 | - //"pageNumber": pageNumber, | ||
| 17 | - "list": data, | 16 | + "list": data, |
| 18 | }, | 17 | }, |
| 19 | } | 18 | } |
| 20 | controller.Response(dataMap, err) | 19 | controller.Response(dataMap, err) |
-
请 注册 或 登录 后发表评论