作者 tangxuhui

添加共创项目管理,共创模式管理

正在显示 23 个修改的文件 包含 968 行增加23 行删除
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type CreateCooperationModeCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 模式编码,唯一确定
CooperationModeNumber string `json:"cooperationModeNumber" valid:"Required"`
// 模式名称,唯一确定
CooperationModeName string `json:"cooperationModeName" valid:"Required"`
// 备注
Remarks string `json:"remarks" valid:"Required"`
}
func (createCooperationModeCommand *CreateCooperationModeCommand) Valid(validation *validation.Validation) {
}
func (createCooperationModeCommand *CreateCooperationModeCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(createCooperationModeCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type RemoveCooperationModeCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创模式ID
CooperationModeId int `json:"cooperationModeId,string" valid:"Required"`
}
func (removeCooperationModeCommand *RemoveCooperationModeCommand) Valid(validation *validation.Validation) {
}
func (removeCooperationModeCommand *RemoveCooperationModeCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(removeCooperationModeCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type UpdateCooperationModeCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创模式ID
CooperationModeId int `json:"cooperationModeId,string," valid:"Required"`
// 模式名称,唯一确定
CooperationModeName string `json:"cooperationModeName" valid:"Required"`
// 备注
Remarks string `json:"remarks" valid:"Required"`
// 共创模式状态,1启用,2禁用
Status int `json:"status" valid:"Required"`
}
func (updateCooperationModeCommand *UpdateCooperationModeCommand) Valid(validation *validation.Validation) {
}
func (updateCooperationModeCommand *UpdateCooperationModeCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(updateCooperationModeCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package dto
type CooperationModeItem struct {
// 共创模式ID
CooperationModeId int `json:"cooperationModeId,string,"`
// 模式名称,唯一确定
CooperationModeName string `json:"cooperationModeName"`
// 备注
Remarks string `json:"remarks" `
// 共创模式状态,1启用,2禁用
Status int `json:"status" `
// 模式编码,唯一确定
CooperationModeNumber string `json:"cooperationModeNumber"`
Org struct {
// 组织机构ID
OrgId int `json:"orgId,string"`
// 组织名称
OrgName string `json:"orgName"`
} `json:"org"`
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type GetCooperationModeQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创模式ID
CooperationModeId int `json:"cooperationModeId,string" valid:"Required"`
}
func (getCooperationModeQuery *GetCooperationModeQuery) Valid(validation *validation.Validation) {
}
func (getCooperationModeQuery *GetCooperationModeQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(getCooperationModeQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type ListCooperationModeQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageNumber" valid:"Required"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
//模式名称
CooperationModeName string `json:"cooperationModeName"`
//组织名称
OrganizationName string `json:"organizationName"`
}
func (listCooperationModeQuery *ListCooperationModeQuery) Valid(validation *validation.Validation) {
}
func (listCooperationModeQuery *ListCooperationModeQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(listCooperationModeQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package service
import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
// 共创模式服务
type CooperationModeService struct {
}
//CreateCooperationMode 创建共创模式服务
func (cooperationModeService *CooperationModeService) CreateCooperationMode(createCooperationModeCommand *command.CreateCooperationModeCommand) (interface{}, error) {
if err := createCooperationModeCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationModeCommand.Operator)
result, err := creationCooperationGateway.CooperationModeAdd(allied_creation_cooperation.ReqCooperationModeAdd{
CooperationModeName: createCooperationModeCommand.CooperationModeName,
CooperationModeNumber: createCooperationModeCommand.CooperationModeNumber,
Remarks: createCooperationModeCommand.Remarks,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
data := struct {
CooperationModeId int `json:"cooperationModeId,string," valid:"Required"`
command.CreateCooperationModeCommand
}{
CooperationModeId: result.CooperationModeId,
CreateCooperationModeCommand: *createCooperationModeCommand,
}
return data, nil
}
//GetCooperationMode 返回共创模式服务
func (cooperationModeService *CooperationModeService) GetCooperationMode(getCooperationModeQuery *query.GetCooperationModeQuery) (interface{}, error) {
if err := getCooperationModeQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationModeQuery.Operator)
result, err := creationCooperationGateway.CooperationModeGet(allied_creation_cooperation.ReqCooperationModeGet{
CooperationModeId: getCooperationModeQuery.CooperationModeId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
data := dto.CooperationModeItem{
CooperationModeId: result.CooperationModeId,
CooperationModeName: result.CooperationModeName,
Remarks: result.Remarks,
Status: result.Status,
CooperationModeNumber: result.CooperationModeNumber,
Org: result.Org,
}
return data, nil
}
//ListCooperationMode 返回共创模式服务列表
func (cooperationModeService *CooperationModeService) ListCooperationMode(listCooperationModeQuery *query.ListCooperationModeQuery) (int64, interface{}, error) {
if err := listCooperationModeQuery.ValidateQuery(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationModeQuery.Operator)
result, err := creationCooperationGateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{
PageNumber: listCooperationModeQuery.PageNumber,
PageSize: listCooperationModeQuery.PageSize,
CooperationModeName: listCooperationModeQuery.CooperationModeName,
OrganizationName: listCooperationModeQuery.OrganizationName,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
var (
listData []dto.CooperationModeItem
item dto.CooperationModeItem
)
for _, v := range result.List {
item = dto.CooperationModeItem{
CooperationModeId: v.CooperationModeId,
CooperationModeName: v.CooperationModeName,
Remarks: v.Remarks,
Status: v.Status,
CooperationModeNumber: v.CooperationModeNumber,
Org: v.Org,
}
listData = append(listData, item)
}
return int64(result.Total), listData, nil
}
//RemoveCooperationMode 移除共创模式服务
func (cooperationModeService *CooperationModeService) RemoveCooperationMode(removeCooperationModeCommand *command.RemoveCooperationModeCommand) (interface{}, error) {
if err := removeCooperationModeCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeCooperationModeCommand.Operator)
_, err := creationCooperationGateway.CooperationModeRemove(allied_creation_cooperation.ReqCooperationModeRemove{
CooperationModeId: removeCooperationModeCommand.CooperationModeId,
})
//TODO 改为批量删除
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return removeCooperationModeCommand, nil
}
//UpdateCooperationMode 更新共创模式
func (cooperationModeService *CooperationModeService) UpdateCooperationMode(updateCooperationModeCommand *command.UpdateCooperationModeCommand) (interface{}, error) {
if err := updateCooperationModeCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationModeCommand.Operator)
_, err := creationCooperationGateway.CooperationModeUpdate(allied_creation_cooperation.ReqCooperationModeUpdate{
CooperationModeId: updateCooperationModeCommand.CooperationModeId,
CooperationModeName: updateCooperationModeCommand.CooperationModeName,
Remarks: updateCooperationModeCommand.Remarks,
Status: updateCooperationModeCommand.Status,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return updateCooperationModeCommand, nil
}
// EnableCooperationMode 禁用启用共创模式
func (cooperationModeService *CooperationModeService) EnableCooperationMode(updateCooperationModeCommand *command.UpdateCooperationModeCommand) (interface{}, error) {
if err := updateCooperationModeCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
//TODO gateway 待补充
return nil, nil
}
func NewCooperationModeService(options map[string]interface{}) *CooperationModeService {
newCooperationModeService := &CooperationModeService{}
return newCooperationModeService
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type CreateCooperationProjectCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 模式编码,唯一确定
CooperationModeNumber string `json:"cooperationModeNumber" valid:"Required"`
// 发起组织ID
OrgId int64 `json:"orgId,string," valid:"Required"`
// 共创项目名称
CooperationProjectName string `json:"cooperationProjectName" valid:"Required"`
// 共创发起人id
CooperationProjectSponsor string `json:"cooperationProjectSponsor,string,"`
// 项目承接对象
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"`
// 共创项目描述
CooperationProjectDescription string `json:"cooperationProjectDescription" valid:"Required"`
//图片
Images []string `json:"images"`
}
func (createCooperationProjectCommand *CreateCooperationProjectCommand) Valid(validation *validation.Validation) {
}
func (createCooperationProjectCommand *CreateCooperationProjectCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(createCooperationProjectCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type EndCooperationProjectCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目id
CooperationProjectId []int64 `json:"cooperationProjectId,omitempty"`
}
func (endCooperationProjectCommand *EndCooperationProjectCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (endCooperationProjectCommand *EndCooperationProjectCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(endCooperationProjectCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type ReleaseCooperationProjectCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目名称
CooperationProjectName string `json:"cooperationProjectName" valid:"Required"`
// 共创模式ID
CooperationModeId int64 `json:"cooperationModeId" valid:"Required"`
// 手机号码
Phone string `json:"phone" valid:"Required"`
// 共创模式状态,1启用,2禁用
Status int32 `json:"status" valid:"Required"`
// 用户编号
UsersCode string `json:"usersCode" valid:"Required"`
// 用户编号
UsersId int64 `json:"usersId" valid:"Required"`
// 用户姓名
UsersName string `json:"usersName" valid:"Required"`
// 邮箱
Email string `json:"email" valid:"Required"`
// 共创公司
CooperationCompany string `json:"cooperationCompany" valid:"Required"`
// 共创公司到期时间
CooperationDeadline string `json:"cooperationDeadline" valid:"Required"`
// 共创项目承接对象,1员工,2共创用户,3公开,可以多选
CooperationProjectUndertakerType []int32 `json:"cooperationProjectUndertakerType" valid:"Required"`
// 共创项目描述
CooperationProjectDescription string `json:"cooperationProjectDescription" valid:"Required"`
}
func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (releaseCooperationProjectCommand *ReleaseCooperationProjectCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(releaseCooperationProjectCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type RemoveCooperationProjectCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目ID
CooperationProjectId int64 `json:"cooperationProjectId" valid:"Required"`
}
func (removeCooperationProjectCommand *RemoveCooperationProjectCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (removeCooperationProjectCommand *RemoveCooperationProjectCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(removeCooperationProjectCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type UpdateCooperationProjectCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目ID
CooperationProjectId string `json:"cooperationProjectId" valid:"Required"`
// 模式编码,唯一确定
CooperationModeNumber string `json:"cooperationModeNumber" valid:"Required"`
// 组织ID
OrgId string `json:"orgId" valid:"Required"`
// 共创项目名称
CooperationProjectName string `json:"cooperationProjectName" valid:"Required"`
// 共创发起人id
CooperationProjectSponsor string `json:"cooperationProjectSponsor,omitempty"`
// 项目承接对象
CooperationProjectUndertakerType []int32 `json:"cooperationProjectUndertakerType,omitempty"`
// 共创项目描述
CooperationProjectDescription string `json:"cooperationProjectDescription" valid:"Required"`
//图片
Images []string `json:"images"`
}
func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (updateCooperationProjectCommand *UpdateCooperationProjectCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(updateCooperationProjectCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type GetCooperationProjectQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目ID
CooperationProjectId int `json:"cooperationProjectId,string" valid:"Required"`
}
func (getCooperationProjectQuery *GetCooperationProjectQuery) Valid(validation *validation.Validation) {
}
func (getCooperationProjectQuery *GetCooperationProjectQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(getCooperationProjectQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type ListCooperationProjectQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageNumber"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
// 项目状态 全部、招标中、已结束
// Status int32 `json:"status" valid:"Required"`
//发起部门名称
DepartmentName string `json:"departmentName"`
//项目名称
CooperationProjectName string `json:"cooperationProjectName"`
}
func (listCooperationProjectQuery *ListCooperationProjectQuery) Valid(validation *validation.Validation) {
}
func (listCooperationProjectQuery *ListCooperationProjectQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(listCooperationProjectQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package service
import (
"strconv"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationProject/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
// 共创项目管理
type CooperationProjectService struct {
}
// 创建共创项目管理
func (cooperationProjectService *CooperationProjectService) CreateCooperationProject(createCooperationProjectCommand *command.CreateCooperationProjectCommand) (interface{}, error) {
if err := createCooperationProjectCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createCooperationProjectCommand.Operator)
result, err := creationCooperationGateway.CooperationProjectAdd(allied_creation_cooperation.ReqCooperationProjectAdd{
CooperationProjectDescription: createCooperationProjectCommand.CooperationProjectDescription,
CooperationProjectName: createCooperationProjectCommand.CooperationProjectName,
PublisherUid: strconv.Itoa(int(createCooperationProjectCommand.Operator.UserId)),
SponsorUid: createCooperationProjectCommand.CooperationProjectSponsor,
CooperationProjectUndertakerType: createCooperationProjectCommand.CooperationProjectUndertakerType,
Images: createCooperationProjectCommand.Images,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
data := struct {
CooperationProjectId int `json:"cooperationProjectId"`
command.CreateCooperationProjectCommand
}{
CooperationProjectId: result.CooperationProjectId,
CreateCooperationProjectCommand: *createCooperationProjectCommand,
}
return data, nil
}
// 结束共创项目管理
func (cooperationProjectService *CooperationProjectService) EndCooperationProject(endCooperationProjectCommand *command.EndCooperationProjectCommand) (interface{}, error) {
if err := endCooperationProjectCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
//creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(endCooperationProjectCommand.Operator)
return nil, nil
}
// 返回共创项目管理
func (cooperationProjectService *CooperationProjectService) GetCooperationProject(getCooperationProjectQuery *query.GetCooperationProjectQuery) (interface{}, error) {
if err := getCooperationProjectQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationProjectQuery.Operator)
result, err := creationCooperationGateway.CooperationProjectGet(allied_creation_cooperation.ReqCooperationProjectGet{
CooperationProjectId: getCooperationProjectQuery.CooperationProjectId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
}
// 返回共创项目管理列表
func (cooperationProjectService *CooperationProjectService) ListCooperationProject(listCooperationProjectQuery *query.ListCooperationProjectQuery) (int64, interface{}, error) {
if err := listCooperationProjectQuery.ValidateQuery(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationProjectQuery.Operator)
result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
PageNumber: listCooperationProjectQuery.PageNumber,
PageSize: listCooperationProjectQuery.PageSize,
//发起部门名称
DepartmentName: listCooperationProjectQuery.DepartmentName,
//项目名
CooperationProjectName: listCooperationProjectQuery.CooperationProjectName,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result.Total, result.CooperationProjects, nil
}
// 发布共创项目
// func (cooperationProjectService *CooperationProjectService) ReleaseCooperationProject(releaseCooperationProjectCommand *command.ReleaseCooperationProjectCommand) (interface{}, error) {
// if err := releaseCooperationProjectCommand.ValidateCommand(); err != nil {
// return nil, application.ThrowError(application.ARG_ERROR, err.Error())
// }
// creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(releaseCooperationProjectCommand.Operator)
// return nil, nil
// }
// 更新共创项目管理
func (cooperationProjectService *CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) {
if err := updateCooperationProjectCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator)
_, err := creationCooperationGateway.CooperationProjectUpdate(allied_creation_cooperation.ReqCooperationProjectUpdate{
CooperationProjectId: updateCooperationProjectCommand.CooperationProjectId,
CooperationProjectName: updateCooperationProjectCommand.CooperationProjectName,
CooperationProjectUndertakerType: updateCooperationProjectCommand.CooperationProjectUndertakerType,
SponsorUid: updateCooperationProjectCommand.CooperationProjectSponsor,
PublisherUid: strconv.Itoa(int(updateCooperationProjectCommand.Operator.UserId)),
CooperationProjectDescription: updateCooperationProjectCommand.CooperationProjectDescription,
Images: updateCooperationProjectCommand.Images,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return updateCooperationProjectCommand, nil
}
func NewCooperationProjectService(options map[string]interface{}) *CooperationProjectService {
newCooperationProjectService := &CooperationProjectService{}
return newCooperationProjectService
}
... ...
... ... @@ -212,7 +212,7 @@ func (rolesService *RolesService) RoleRemove(roleRemoveCommand *command.RoleRemo
}
}
_, err := creationUserGateway.RoleBatchRemove(allied_creation_user.ReqRoleBatchRemove{
roleIds,
RoleIds: roleIds,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
package domain
// Attachment 附件对象
type Attachment struct {
// 附件文件类型,jpg,pdf
FileType string `json:"fileType"`
// 附件名称
Name string `json:"name"`
// 附件地址
Url string `json:"url"`
// 附件文件大小
FileSize int64 `json:"fileSize,string"`
}
... ...
... ... @@ -12,7 +12,7 @@ import (
// CooperationApplicationUpdaet 更新共创申请
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationUpdaet(param ReqCooperationApplicationUpdate) (*DataCooperationApplicationUpdate, error) {
url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.ApplicationId)
url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.CooperationApplicationId)
method := "PUT"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:更新共创申请。", map[string]interface{}{
... ...
... ... @@ -73,7 +73,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectList(param Req
// Cooperation-projects[cooperationProjectId} 返回共创项目详情
func (gateway HttplibAlliedCreationCooperation) CooperationProjectGet(param ReqCooperationProjectGet) (*DataCooperationProjectGet, error) {
url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.ProjectId)
url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.CooperationProjectId)
method := "GET"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:返回共创项目详情。", map[string]interface{}{
... ... @@ -135,7 +135,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationProjectUpdate(param R
//CooperationProjectRemove 移除共创项目
func (gateway HttplibAlliedCreationCooperation) CooperationProjectRemove(param ReqCooperationProjectRemove) (*DataCooperationProjectRemove, error) {
url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.ProjectId)
url := gateway.baseUrL + "/cooperation-projects/" + strconv.Itoa(param.CooperationProjectID)
method := "DELETE"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:移除共创项目。", map[string]interface{}{
... ...
package allied_creation_cooperation
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
//更新共创申请
type (
ReqCooperationApplicationUpdate struct {
ApplicationId int
CooperationApplicationId int
}
DataCooperationApplicationUpdate struct {
... ... @@ -32,7 +34,7 @@ type (
//审核-同意共创申请
type (
ReqCooperationApplicationAgree struct {
ApplicationId int
CooperationApplicationId int
}
DataCooperationApplicationAgree struct {
... ... @@ -42,7 +44,7 @@ type (
//审核-拒绝共创申请
type (
ReqCooperationApplicationReject struct {
ApplicationId int
CooperationApplicationId int
}
DataCooperationApplicationReject struct {
... ... @@ -52,9 +54,18 @@ type (
//创建共创申请
type (
ReqCooperationApplicationAdd struct {
// 共创申请人uid
ApplicantUid string `json:"applicantUid" `
// 共创申请描述
CooperationApplicationDescription string ` json:"cooperationApplicationDescription"`
// 共创申请描述附件
CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"`
// 关联的共创项目编号
CooperationProjectNumber string `json:"cooperationProjectNumber"`
}
DataCooperationApplicationAdd struct {
CooperationApplicationId int `json:"cooperationApplicationId,string"`
}
)
... ... @@ -98,7 +109,7 @@ type (
//返回共创申请详情
type (
ReqCooperationApplicationGet struct {
ApplicationId int
CooperationApplicationId int
}
DataCooperationApplicationGet struct {
... ...
... ... @@ -9,6 +9,31 @@ type (
}
DataCooperationModeAdd struct {
// 共创模式ID
CooperationModeId int `json:"cooperationModeId,string"`
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 模式名称,
CooperationModeName string `json:"cooperationModeName"`
// 共创模式状态,1启用,2禁用
Status int `json:"status"`
// 备注
Remarks string `json:"remarks"`
Company struct {
// 公司ID,
CompanyId int `json:"companyId,string"`
// 公司logo
CompanyLogo string `json:"companyLogo"`
// 公司名称
CompanyName string `json:"companyName"`
} `json:"company"`
// 数据所属组织机构
Org struct {
// 组织机构ID
OrgId int `json:"orgId,string"`
// 组织名称
OrgName string `json:"orgName"`
} `json:"org"`
}
)
... ... @@ -23,7 +48,7 @@ type (
Total int `json:"total"`
List []struct {
// 共创模式ID
CooperationModeId int `json:"cooperationModeId"`
CooperationModeId int `json:"cooperationModeId,string"`
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 模式名称,
... ... @@ -34,7 +59,7 @@ type (
Remarks string `json:"remarks"`
Company struct {
// 公司ID,
CompanyId int `json:"companyId"`
CompanyId int `json:"companyId,string"`
// 公司logo
CompanyLogo string `json:"companyLogo"`
// 公司名称
... ... @@ -43,7 +68,7 @@ type (
// 数据所属组织机构
Org struct {
// 组织机构ID
OrgId int `json:"orgId"`
OrgId int `json:"orgId,string"`
// 组织名称
OrgName string `json:"orgName"`
} `json:"org"`
... ... @@ -54,12 +79,12 @@ type (
//返回共创模式详情
type (
ReqCooperationModeGet struct {
CooperationModeId int `json:"modeId"`
CooperationModeId int `json:"cooperationModeId"`
}
DataCooperationModeGet struct {
// 共创模式ID
CooperationModeId int `json:"cooperationModeId"`
CooperationModeId int `json:"cooperationModeId,string"`
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 模式名称,
... ... @@ -89,12 +114,10 @@ type (
//更新共创模式
type (
ReqCooperationModeUpdate struct {
// 共创模式ID
CooperationModeId int `json:"cooperationModeId"`
CooperationModeId int `json:"cooperationModeId"` // 共创模式ID
CooperationModeName string `json:"cooperationModeName"`
Remarks string `json:"remarks"`
// 共创模式状态,1启用,2禁用
Status int `json:"status"`
Status int `json:"status"` // 共创模式状态,1启用,2禁用
}
DataCooperationModeUpdate struct {
... ... @@ -104,7 +127,7 @@ type (
//移除共创模式
type (
ReqCooperationModeRemove struct {
CooperationModeId int `json:"modeId"`
CooperationModeId int `json:"cooperationModeId"`
}
DataCooperationModeRemove struct {
... ... @@ -114,8 +137,44 @@ type (
//查询共创模式
type (
ReqCooperationModesSearch struct {
// 页面大小
PageNumber int `json:"pageNumber,omitempty,"`
// 页面大小
PageSize int `json:"pageSize,omitempty,"`
//模式名称
CooperationModeName string `json:"cooperationModeName"`
//组织名称
OrganizationName string `json:"organizationName"`
}
DataCooperationModesSearch struct {
Total int `json:"total"`
List []struct {
// 共创模式ID
CooperationModeId int `json:"cooperationModeId,string"`
// 共创模式编码,
CooperationModeNumber string `json:"cooperationModeNumber"`
// 模式名称,
CooperationModeName string `json:"cooperationModeName"`
// 共创模式状态,1启用,2禁用
Status int `json:"status"`
// 备注
Remarks string `json:"remarks"`
Company struct {
// 公司ID,
CompanyId int `json:"companyId,string"`
// 公司logo
CompanyLogo string `json:"companyLogo"`
// 公司名称
CompanyName string `json:"companyName"`
} `json:"company"`
// 数据所属组织机构
Org struct {
// 组织机构ID
OrgId int `json:"orgId,string"`
// 组织名称
OrgName string `json:"orgName"`
} `json:"org"`
} `json:"list"`
}
)
... ...
... ... @@ -3,9 +3,16 @@ package allied_creation_cooperation
//创建共创项目
type (
ReqCooperationProjectAdd struct {
CooperationProjectDescription string `json:"cooperationProjectDescription"`
CooperationProjectName string `json:"cooperationProjectName"`
PublisherUid string `json:"publisherUid"`
SponsorUid string `json:"sponsorUid"`
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"`
Images []string `json:"images"`
}
DataCooperationProjectAdd struct {
CooperationProjectId int `json:"cooperationProjectId"`
}
)
... ... @@ -21,17 +28,70 @@ type (
//返回共创项目详情
type (
ReqCooperationProjectGet struct {
ProjectId int
CooperationProjectId int
}
DataCooperationProjectGet struct {
CooperationProject struct {
CooperationMode struct {
CooperationModeID int `json:"cooperationModeId,string"`
CooperationModeName string `json:"cooperationModeName"`
CooperationModeNumber string `json:"cooperationModeNumber"`
} `json:"cooperationMode"`
CooperationProjectDescription string `json:"cooperationProjectDescription"`
Images []string `json:"images"`
CooperationProjectID int `json:"cooperationProjectId,string"`
CooperationProjectName string `json:"cooperationProjectName"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
CooperationProjectPublishTime string `json:"cooperationProjectPublishTime"`
CooperationProjectPublisher struct {
CooperationCompany string `json:"cooperationCompany"`
CooperationDeadline string `json:"cooperationDeadline"`
Email string `json:"email"`
Phone string `json:"phone"`
Status int `json:"status"`
UsersCode string `json:"usersCode"`
UsersID int `json:"usersId,string"`
UsersName string `json:"usersName"`
} `json:"cooperationProjectPublisher"`
CooperationProjectSponsor struct {
CooperationCompany string `json:"cooperationCompany"`
CooperationDeadline string `json:"cooperationDeadline"`
Email string `json:"email"`
Phone string `json:"phone"`
Status int `json:"status"`
UsersCode string `json:"usersCode"`
UsersID int `json:"usersId,string"`
UsersName string `json:"usersName"`
} `json:"cooperationProjectSponsor"`
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"`
Department struct {
CompanyID int `json:"companyId,string"`
OrgCode string `json:"orgCode"`
OrgID int `json:"orgId,string"`
OrgName string `json:"orgName"`
} `json:"department"`
Status int `json:"status"`
} `json:"cooperationProject"`
}
)
//更新共创项目
type (
ReqCooperationProjectUpdate struct {
ProjectId int
// 共创项目ID
CooperationProjectId string `json:"cooperationProjectId" `
// 共创项目名称
CooperationProjectName string `json:"cooperationProjectName"`
// 承接对象,1员工,2共创用户,3公开,可以多选
CooperationProjectUndertakerType []int32 `json:"cooperationProjectUndertakerType"`
// 共创项目发起人uid
SponsorUid string `json:"sponsorUid"`
// 共创项目发布人uid
PublisherUid string `json:"publisherUid"`
// 共创项目描述
CooperationProjectDescription string `json:"cooperationProjectDescription"`
Images []string `json:"images"`
}
DataCooperationProjectUpdate struct {
... ... @@ -41,7 +101,7 @@ type (
//移除共创项目
type (
ReqCooperationProjectRemove struct {
ProjectId int
CooperationProjectID int
}
DataCooperationProjectRemove struct {
... ... @@ -60,15 +120,66 @@ type (
//查询共创项目
type (
ReqCooperationProjectSearch struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
//发起部门名称
DepartmentName string `json:"departmentName"`
//项目名称
CooperationProjectName string `json:"cooperationProjectName"`
Status int `json:"status"`
}
DataCooperationProjectSearch struct {
Total int64 `json:"total"`
CooperationProjects []struct {
CooperationMode struct {
CooperationModeID int `json:"cooperationModeId,string,"`
CooperationModeName string `json:"cooperationModeName"`
CooperationModeNumber string `json:"cooperationModeNumber"`
} `json:"cooperationMode"`
CooperationProjectDescription string `json:"cooperationProjectDescription"`
Images []string `json:"images"`
CooperationProjectID int `json:"cooperationProjectId,string,"`
CooperationProjectName string `json:"cooperationProjectName"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
CooperationProjectPublishTime string `json:"cooperationProjectPublishTime"`
CooperationProjectPublisher struct {
CooperationCompany string `json:"cooperationCompany"`
CooperationDeadline string `json:"cooperationDeadline"`
Email string `json:"email"`
Phone string `json:"phone"`
Status int `json:"status"`
UsersCode string `json:"usersCode"`
UsersID int `json:"usersId,string,"`
UsersName string `json:"usersName"`
} `json:"cooperationProjectPublisher"`
CooperationProjectSponsor struct {
CooperationCompany string `json:"cooperationCompany"`
CooperationDeadline string `json:"cooperationDeadline"`
Email string `json:"email"`
Phone string `json:"phone"`
Status int `json:"status"`
UsersCode string `json:"usersCode"`
UsersID int `json:"usersId,string,"`
UsersName string `json:"usersName"`
} `json:"cooperationProjectSponsor"`
CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"`
Department struct {
CompanyID int `json:"companyId,string,"`
OrgCode string `json:"orgCode"`
OrgID int `json:"orgId,string,"`
OrgName string `json:"orgName"`
} `json:"department"`
Status int `json:"status"`
} `json:"cooperationProjects"`
}
)
//判断当前勾选的承接对象是否存在用户
type (
ReqCooperationProjectsCheck struct {
CooperationProjectId int
CooperationProjectUndertakerTypes []int
}
DataCooperationProjectsCheck struct {
... ...
... ... @@ -13,8 +13,7 @@ func (controller *baseController) returnPageListData(count int64, data interface
dataMap := map[string]interface{}{
"grid": map[string]interface{}{
"total": count,
//"pageNumber": pageNumber,
"list": data,
"list": data,
},
}
controller.Response(dataMap, err)
... ...