作者 yangfu
{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627899047152189500}
\ No newline at end of file
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628060696735619100}
\ No newline at end of file
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type AuditCooperationApplicationCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创申请ID
CooperationApplicationId []int `json:"cooperationApplicationId,string" valid:"Required"`
// 共创申请审核状态,1待审核,2已同意,3已拒绝
CooperationApplicationStatus int `json:"cooperationApplicationStatus" valid:"Required"`
// 共创申请审核描述
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription" valid:"Required"`
}
func (auditCooperationApplicationCommand *AuditCooperationApplicationCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (auditCooperationApplicationCommand *AuditCooperationApplicationCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(auditCooperationApplicationCommand)
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
// type CreateCooperationApplicationCommand struct {
// //操作人
// Operator domain.Operator `json:"-"`
// // 共创申请描述
// CooperationApplicationDescription string `json:"cooperationApplicationDescription" valid:"Required"`
// // 申请人的id
// UserId int64 `json:"userId,omitempty"`
// // 附件列表
// Attachment []domain.Attachment `json:"attachment"`
// }
// func (createCooperationApplicationCommand *CreateCooperationApplicationCommand) Valid(validation *validation.Validation) {
// validation.SetError("CustomValid", "未实现的自定义认证")
// }
// func (createCooperationApplicationCommand *CreateCooperationApplicationCommand) ValidateCommand() error {
// valid := validation.Validation{}
// b, err := valid.Valid(createCooperationApplicationCommand)
// 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
// type UpdateCooperationApplicationCommand struct {
//操作人
// Operator domain.Operator `json:"-"`
// 共创申请ID
// CooperationApplicationId int64 `json:"cooperationApplicationId" valid:"Required"`
// }
// func (updateCooperationApplicationCommand *UpdateCooperationApplicationCommand) Valid(validation *validation.Validation) {
// validation.SetError("CustomValid", "未实现的自定义认证")
// }
// func (updateCooperationApplicationCommand *UpdateCooperationApplicationCommand) ValidateCommand() error {
// valid := validation.Validation{}
// b, err := valid.Valid(updateCooperationApplicationCommand)
// 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 GetCooperationApplicationQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创申请ID
CooperationApplicationId int `json:"cooperationApplicationId,string" valid:"Required"`
}
func (getCooperationApplicationQuery *GetCooperationApplicationQuery) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (getCooperationApplicationQuery *GetCooperationApplicationQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(getCooperationApplicationQuery)
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 ListCooperationApplicationQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageNumber" valid:"Required"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
//共创项目名称
ProjectName string `json:"projectName"`
//申请人名称
ApplicantName string `json:"applicantName"`
//审核状态
VerifyStatus int `json:"verifyStatus"`
}
func (listCooperationApplicationQuery *ListCooperationApplicationQuery) Valid(validation *validation.Validation) {
}
func (listCooperationApplicationQuery *ListCooperationApplicationQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(listCooperationApplicationQuery)
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/cooperationApplication/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
// 共创申请管理
type CooperationApplicationService struct {
}
// 审核共创申请
func (cooperationApplicationService *CooperationApplicationService) AuditCooperationApplication(
auditCooperationApplicationCommand *command.AuditCooperationApplicationCommand) (interface{}, error) {
if err := auditCooperationApplicationCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
auditCooperationApplicationCommand.Operator)
if auditCooperationApplicationCommand.CooperationApplicationStatus == 2 {
_, err := creationCooperationGateway.CooperationApplicationsAgree(allied_creation_cooperation.ReqCooperationApplicationAgree{
CooperationApplicationId: auditCooperationApplicationCommand.CooperationApplicationId,
CooperationApplicationVerifyDescription: auditCooperationApplicationCommand.CooperationApplicationVerifyDescription,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
} else if auditCooperationApplicationCommand.CooperationApplicationStatus == 3 {
_, err := creationCooperationGateway.CooperationApplicationReject(allied_creation_cooperation.ReqCooperationApplicationReject{
CooperationApplicationId: auditCooperationApplicationCommand.CooperationApplicationId,
CooperationApplicationVerifyDescription: auditCooperationApplicationCommand.CooperationApplicationVerifyDescription,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
} else {
return nil, application.ThrowError(application.TRANSACTION_ERROR, "status 参数错误")
}
return auditCooperationApplicationCommand, nil
}
// 返回共创申请管理
func (cooperationApplicationService *CooperationApplicationService) GetCooperationApplication(getCooperationApplicationQuery *query.GetCooperationApplicationQuery) (interface{}, error) {
if err := getCooperationApplicationQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(getCooperationApplicationQuery.Operator)
result, err := creationCooperationGateway.CooperationApplicationGet(allied_creation_cooperation.ReqCooperationApplicationGet{
CooperationApplicationId: getCooperationApplicationQuery.CooperationApplicationId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
}
// 返回共创申请管理列表
func (cooperationApplicationService *CooperationApplicationService) ListCooperationApplication(
listCooperationApplicationQuery *query.ListCooperationApplicationQuery) (int64, interface{}, error) {
if err := listCooperationApplicationQuery.ValidateQuery(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(listCooperationApplicationQuery.Operator)
result, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
ApplicantName: listCooperationApplicationQuery.ApplicantName,
CooperationApplicationStatus: listCooperationApplicationQuery.VerifyStatus,
CooperationProjectName: listCooperationApplicationQuery.ProjectName,
PageNumber: listCooperationApplicationQuery.PageNumber,
PageSize: listCooperationApplicationQuery.PageSize,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return int64(result.Gride.Total), result.Gride.List, nil
}
func NewCooperationApplicationService(options map[string]interface{}) *CooperationApplicationService {
newCooperationApplicationService := &CooperationApplicationService{}
return newCooperationApplicationService
}
... ...
... ... @@ -11,7 +11,7 @@ type UpdateCooperationProjectCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创项目ID
CooperationProjectId string `json:"cooperationProjectId" valid:"Required"`
CooperationProjectId string `json:"cooperationProjectId,string" valid:"Required"`
// 模式编码,唯一确定
CooperationModeNumber string `json:"cooperationModeNumber" valid:"Required"`
// 组织ID
... ...
... ... @@ -47,6 +47,7 @@ func (cooperationProjectService *CooperationProjectService) EndCooperationProjec
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
//creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(endCooperationProjectCommand.Operator)
//TODO
return nil, nil
}
... ... @@ -86,15 +87,6 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
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 {
... ...
... ... @@ -322,7 +322,7 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationList(param
// CooperationApplicationGet 返回共创申请详情
func (gateway HttplibAlliedCreationCooperation) CooperationApplicationGet(param ReqCooperationApplicationGet) (*DataCooperationApplicationGet, error) {
url := gateway.baseUrL + "/cooperation-applications/{cooperationApplicationId}"
url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.CooperationApplicationId)
method := "GET"
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"
import (
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
//共创实体
//更新共创申请
type (
... ... @@ -34,7 +40,8 @@ type (
//审核-同意共创申请
type (
ReqCooperationApplicationAgree struct {
CooperationApplicationId int
CooperationApplicationId []int `json:"cooperationApplicationId"`
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
}
DataCooperationApplicationAgree struct {
... ... @@ -44,7 +51,8 @@ type (
//审核-拒绝共创申请
type (
ReqCooperationApplicationReject struct {
CooperationApplicationId int
CooperationApplicationId []int `json:"cooperationApplicationId"`
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
}
DataCooperationApplicationReject struct {
... ... @@ -72,9 +80,75 @@ type (
//查询共创申请
type (
ReqCooperationApplicationSearch struct {
ApplicantName string `json:"applicantName"` //申请人姓名
CooperationApplicationStatus int `json:"cooperationApplicationStatus"` //共创申请审核状态,1待审核,2已同意,3已拒绝
CooperationProjectName string `json:"cooperationProjectName"` //共创项目名称
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
}
DataCooperationApplicationSearch struct {
Gride struct {
Total int
List []struct {
//公司
Company struct {
CompanyID int `json:"companyId"`
CompanyName string `json:"companyName"`
} `json:"company"`
//申请人
CooperationApplicationApplicant struct {
//申请人部门
Department struct {
DepartmentID int `json:"departmentId"`
DepartmentName string `json:"departmentName"`
DepartmentNumber string `json:"departmentNumber"`
} `json:"department"`
//申请人组织
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
UserBaseID int `json:"userBaseId"`
UserID int `json:"userId"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserAvatar string `json:"userAvatar"`
UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
UserPhone string `json:"userPhone"`
} `json:"userInfo"`
UserType int `json:"userType"`
} `json:"cooperationApplicationApplicant"`
//附件信息
CooperationApplicationAttachment []struct {
FileSize int `json:"fileSize"`
FileType string `json:"fileType"`
Name string `json:"name"`
URL string `json:"url"`
} `json:"cooperationApplicationAttachment"`
//申请描述
CooperationApplicationDescription string `json:"cooperationApplicationDescription"`
//id
CooperationApplicationID int `json:"cooperationApplicationId"`
//申请单状态 ,共创申请审核状态,1待审核,2已同意,3已拒绝
CooperationApplicationStatus int `json:"cooperationApplicationStatus"`
//是否已取消
IsCanceled bool `json:"isCanceled"`
//描述
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
//审核时间
CooperationApplicationVerifyTime time.Time `json:"cooperationApplicationVerifyTime"`
//申请时间
CooperationApplyTime time.Time `json:"cooperationApplyTime"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
} `json:"list"`
}
}
)
... ... @@ -90,7 +164,7 @@ type (
//移除共创申请
type (
ReqCooperationApplicationRemove struct {
ApplicationId int
ApplicationId int `json:"applicationId"`
}
DataCooperationApplicationRemove struct {
... ... @@ -109,9 +183,139 @@ type (
//返回共创申请详情
type (
ReqCooperationApplicationGet struct {
CooperationApplicationId int
CooperationApplicationId int `json:"cooperationApplicationId"`
}
DataCooperationApplicationGet struct {
Company struct {
CompanyID float64 `json:"companyId"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
} `json:"company"`
//申请人
CooperationApplicationApplicant struct {
Department struct {
DepartmentID float64 `json:"departmentId"`
DepartmentName string `json:"departmentName"`
DepartmentNumber string `json:"departmentNumber"`
IsOrganization bool `json:"isOrganization"`
} `json:"department"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
UserBaseID int `json:"userBaseId"`
UserID int `json:"userId"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserAvatar string `json:"userAvatar"`
UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
UserPhone string `json:"userPhone"`
} `json:"userInfo"`
UserType float64 `json:"userType"`
} `json:"cooperationApplicationApplicant"`
//附件
CooperationApplicationAttachment []struct {
FileSize float64 `json:"fileSize"`
FileType string `json:"fileType"`
Name string `json:"name"`
URL string `json:"url"`
} `json:"cooperationApplicationAttachment"`
CooperationApplicationDescription string `json:"cooperationApplicationDescription"`
CooperationApplicationID float64 `json:"cooperationApplicationId"`
CooperationApplicationStatus float64 `json:"cooperationApplicationStatus"`
//审核人
CooperationApplicationVerifier struct {
Department struct {
DepartmentID float64 `json:"departmentId"`
DepartmentName string `json:"departmentName"`
DepartmentNumber string `json:"departmentNumber"`
IsOrganization bool `json:"isOrganization"`
} `json:"department"`
Org struct {
OrgID float64 `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
UserBaseID float64 `json:"userBaseId"`
UserID float64 `json:"userId"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserAvatar string `json:"userAvatar"`
UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
UserPhone string `json:"userPhone"`
} `json:"userInfo"`
UserType float64 `json:"userType"`
} `json:"cooperationApplicationVerifier"`
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"`
//审核时间
CooperationApplicationVerifyTime string `json:"cooperationApplicationVerifyTime"`
// 共创申请时间
CooperationApplyTime string `json:"cooperationApplyTime"`
CreatedAt string `json:"createdAt"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
UpdatedAt string `json:"updatedAt"`
//共创项目
CooperationProject struct {
CooperationProjectDescription string `json:"cooperationProjectDescription"`
CooperationProjectID float64 `json:"cooperationProjectId"`
CooperationProjectName string `json:"cooperationProjectName"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
CooperationProjectPublishTime string `json:"cooperationProjectPublishTime"`
CooperationProjectPublisher struct {
Department struct {
DepartmentID float64 `json:"departmentId"`
DepartmentName string `json:"departmentName"`
DepartmentNumber string `json:"departmentNumber"`
} `json:"department"`
Org struct {
OrgID float64 `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
UserBaseID float64 `json:"userBaseId"`
UserID float64 `json:"userId"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserAvatar string `json:"userAvatar"`
UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
UserPhone string `json:"userPhone"`
} `json:"userInfo"`
UserType float64 `json:"userType"`
} `json:"cooperationProjectPublisher"`
//项目发起人
CooperationProjectSponsor struct {
Department struct {
DepartmentID float64 `json:"departmentId"`
DepartmentName string `json:"departmentName"`
DepartmentNumber string `json:"departmentNumber"`
} `json:"department"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
UserBaseID int `json:"userBaseId"`
UserID int `json:"userId"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserAvatar string `json:"userAvatar"`
UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
UserPhone string `json:"userPhone"`
} `json:"userInfo"`
UserType float64 `json:"userType"`
} `json:"cooperationProjectSponsor"`
CooperationProjectUndertakerType []float64 `json:"cooperationProjectUndertakerType"`
CreatedAt time.Time `json:"createdAt"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
Status float64 `json:"status"`
} `json:"cooperationProject"`
}
)
... ...
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationApplication/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type CooperationApplicationController struct {
baseController
}
func (controller *CooperationApplicationController) GetCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
getCooperationApplicationQuery := &query.GetCooperationApplicationQuery{}
applicationId, _ := controller.GetInt(":applicationId")
getCooperationApplicationQuery.CooperationApplicationId = applicationId
data, err := cooperationApplicationService.GetCooperationApplication(getCooperationApplicationQuery)
controller.Response(data, err)
}
func (controller *CooperationApplicationController) ListCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
listCooperationApplicationQuery := &query.ListCooperationApplicationQuery{}
err := controller.Unmarshal(listCooperationApplicationQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
listCooperationApplicationQuery.Operator = controller.GetOperator()
cnt, data, err := cooperationApplicationService.ListCooperationApplication(listCooperationApplicationQuery)
controller.returnPageListData(cnt, data, err, listCooperationApplicationQuery.PageNumber)
}
func (controller *CooperationApplicationController) AuditCooperationApplication() {
cooperationApplicationService := service.NewCooperationApplicationService(nil)
auditCooperationApplicationCommand := &command.AuditCooperationApplicationCommand{}
err := controller.Unmarshal(auditCooperationApplicationCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
auditCooperationApplicationCommand.Operator = controller.GetOperator()
data, err := cooperationApplicationService.AuditCooperationApplication(auditCooperationApplicationCommand)
controller.Response(data, err)
}
... ...
package web_client
import (
"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/application/web/cooperationProject/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type CooperationProjectController struct {
baseController
}
func (controller *CooperationProjectController) CreateCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
createCooperationProjectCommand := &command.CreateCooperationProjectCommand{}
err := controller.Unmarshal(createCooperationProjectCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
data, err := cooperationProjectService.CreateCooperationProject(createCooperationProjectCommand)
controller.Response(data, err)
}
func (controller *CooperationProjectController) UpdateCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
updateCooperationProjectCommand := &command.UpdateCooperationProjectCommand{}
err := controller.Unmarshal(updateCooperationProjectCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
projectId := controller.GetString(":projectId")
updateCooperationProjectCommand.CooperationProjectId = projectId
data, err := cooperationProjectService.UpdateCooperationProject(updateCooperationProjectCommand)
controller.Response(data, err)
}
func (controller *CooperationProjectController) GetCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
getCooperationProjectQuery := &query.GetCooperationProjectQuery{}
projectId, _ := controller.GetInt(":projectId")
getCooperationProjectQuery.CooperationProjectId = projectId
data, err := cooperationProjectService.GetCooperationProject(getCooperationProjectQuery)
controller.Response(data, err)
}
func (controller *CooperationProjectController) ListCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
listCooperationProjectQuery := &query.ListCooperationProjectQuery{}
err := controller.Unmarshal(listCooperationProjectQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
cnt, data, err := cooperationProjectService.ListCooperationProject(listCooperationProjectQuery)
controller.returnPageListData(cnt, data, err, listCooperationProjectQuery.PageNumber)
}
func (controller *CooperationProjectController) EndCooperationProject() {
cooperationProjectService := service.NewCooperationProjectService(nil)
endCooperationProjectCommand := &command.EndCooperationProjectCommand{}
controller.Unmarshal(endCooperationProjectCommand)
//TODO
data, err := cooperationProjectService.EndCooperationProject(endCooperationProjectCommand)
controller.Response(data, err)
}
... ...
package web_client
import (
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/service"
"strconv"
)
type UsersController struct {
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
)
func init() {
web.Router("/v1/web/cooperation-applications/:applicationId", &web_client.CooperationApplicationController{}, "Get:GetCooperationApplication")
web.Router("/v1/web/cooperation-applications/search", &web_client.CooperationApplicationController{}, "Get:ListCooperationApplication")
web.Router("/v1/web/cooperation-applications/audit", &web_client.CooperationApplicationController{}, "Put:AuditCooperationApplication")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
)
func init() {
web.Router("/v1/web/cooperation-projects/", &web_client.CooperationProjectController{}, "Post:CreateCooperationProject")
web.Router("/v1/web/cooperation-projects/:projectId", &web_client.CooperationProjectController{}, "Put:UpdateCooperationProject")
web.Router("/v1/web/cooperation-projects/:projectId", &web_client.CooperationProjectController{}, "Get:GetCooperationProject")
web.Router("/v1/web/cooperation-projects/search", &web_client.CooperationProjectController{}, "Post:ListCooperationProject")
web.Router("/v1/web/cooperation-projects/end", &web_client.CooperationProjectController{}, "Put:EndCooperationProject")
}
... ...