|
|
package service
|
|
|
|
|
|
import (
|
|
|
"strconv"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
|
|
|
)
|
|
|
|
|
|
// CooperationApplicationsService 共创申请服务
|
...
|
...
|
@@ -13,41 +15,45 @@ type CooperationApplicationsService struct { |
|
|
|
|
|
/***** 企业端 *****/
|
|
|
|
|
|
// GetCooperationApplications TODO:企业获取共创申请详情
|
|
|
func (srv CooperationApplicationsService) GetCooperationApplications(userMenusCommand *command.GetCooperationApplicationQuery) (interface{}, error) {
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
userMenusCommand.Operator)
|
|
|
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
|
|
|
UserId: int(userMenusCommand.Operator.UserId),
|
|
|
// GetCooperationApplications 企业获取共创申请详情
|
|
|
func (srv CooperationApplicationsService) GetCooperationApplications(applicationQuery *command.GetCooperationApplicationQuery) (interface{}, error) {
|
|
|
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
applicationQuery.Operator)
|
|
|
result, err := creationCooperationGateway.CooperationApplicationGet(allied_creation_cooperation.ReqCooperationApplicationGet{
|
|
|
CooperationApplicationId: applicationQuery.CooperationApplicationId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"accessMenus": resultMenu.Menus,
|
|
|
}, nil
|
|
|
data := dto.ToCooperationApplication(&result.CooperationApplication)
|
|
|
return data, nil
|
|
|
}
|
|
|
|
|
|
// GetCooperationApplications TODO:企业审核共创申请
|
|
|
func (srv CooperationApplicationsService) AuditCooperationApplications(userMenusCommand *command.AuditCooperationApplicationCommand) (interface{}, error) {
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
userMenusCommand.Operator)
|
|
|
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
|
|
|
UserId: int(userMenusCommand.Operator.UserId),
|
|
|
// AuditCooperationApplications 企业审核共创申请
|
|
|
func (srv CooperationApplicationsService) AuditCooperationApplications(auditCommand *command.AuditCooperationApplicationCommand) (interface{}, error) {
|
|
|
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
auditCommand.Operator)
|
|
|
applicationIds := []string{}
|
|
|
for _, v := range auditCommand.CooperationApplicationId {
|
|
|
idStr := strconv.Itoa(v)
|
|
|
applicationIds = append(applicationIds, idStr)
|
|
|
}
|
|
|
_, err := creationCooperationGateway.CooperationApplicationsBatchApproval(allied_creation_cooperation.ReqCooperationApplicationBatchApproval{
|
|
|
CooperationApplicationIds: applicationIds,
|
|
|
CooperationApplicationDescription: auditCommand.CooperationApplicationVerifyDescription,
|
|
|
Action: auditCommand.CooperationApplicationStatus,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"accessMenus": resultMenu.Menus,
|
|
|
}, nil
|
|
|
return auditCommand, nil
|
|
|
}
|
|
|
|
|
|
// GetCooperationApplications TODO:企业获取共创申请列表
|
|
|
// SearchCooperationApplications 企业获取共创申请列表
|
|
|
func (srv CooperationApplicationsService) SearchCooperationApplications(applicationQuery *command.ListCooperationApplicationQuery) (interface{}, error) {
|
|
|
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
applicationQuery.Operator)
|
|
|
resultMenu, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
|
|
|
resultApplications, err := creationCooperationGateway.CooperationApplicationsSearch(allied_creation_cooperation.ReqCooperationApplicationSearch{
|
|
|
PageNumber: applicationQuery.PageNumber,
|
|
|
PageSize: applicationQuery.PageSize,
|
|
|
CompanyId: int(applicationQuery.Operator.CompanyId),
|
...
|
...
|
@@ -56,67 +62,45 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return resultMenu, nil
|
|
|
return resultApplications, nil
|
|
|
}
|
|
|
|
|
|
/***** 共创用户端 *****/
|
|
|
|
|
|
// GetCooperationApplications TODO:创建共创申请管理
|
|
|
func (srv CooperationApplicationsService) CreateCooperationApplications(userMenusCommand *command.CreateCooperationApplicationCommand) (interface{}, error) {
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
userMenusCommand.Operator)
|
|
|
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
|
|
|
UserId: int(userMenusCommand.Operator.UserId),
|
|
|
// CreateCooperationApplications 创建共创申请管理
|
|
|
func (srv CooperationApplicationsService) CreateCooperationApplications(createApplicationsCommand *command.CreateCooperationApplicationCommand) (interface{}, error) {
|
|
|
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
createApplicationsCommand.Operator)
|
|
|
result, err := creationCooperationGateway.CooperationApplicationAdd(allied_creation_cooperation.ReqCooperationApplicationAdd{
|
|
|
ApplicantUid: strconv.Itoa(createApplicationsCommand.UserId),
|
|
|
CooperationApplicationDescription: createApplicationsCommand.CooperationApplicationDescription,
|
|
|
CooperationApplicationAttachment: createApplicationsCommand.Attachment,
|
|
|
CooperationProjectNumber: createApplicationsCommand.CooperationProjectNumber,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"accessMenus": resultMenu.Menus,
|
|
|
}, nil
|
|
|
data := struct {
|
|
|
CooperationApplicationId int `json:"cooperationApplicationId"`
|
|
|
command.CreateCooperationApplicationCommand
|
|
|
}{
|
|
|
CooperationApplicationId: result.CooperationApplicationId,
|
|
|
CreateCooperationApplicationCommand: *createApplicationsCommand,
|
|
|
}
|
|
|
return data, err
|
|
|
}
|
|
|
|
|
|
//PersonGetCooperationApplications TODO:共创用户获取共创申请详情
|
|
|
//PersonGetCooperationApplications 共创用户获取共创申请详情
|
|
|
func (srv CooperationApplicationsService) PersonGetCooperationApplications(userMenusCommand *command.GetCooperationApplicationQuery) (interface{}, error) {
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
userMenusCommand.Operator)
|
|
|
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
|
|
|
UserId: int(userMenusCommand.Operator.UserId),
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"accessMenus": resultMenu.Menus,
|
|
|
}, nil
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
// GetCooperationApplications TODO:共创用户取消共创申请
|
|
|
// PersonCancelCooperationApplications 共创用户取消共创申请
|
|
|
func (srv CooperationApplicationsService) PersonCancelCooperationApplications(userMenusCommand *command.CancelCooperationApplicationCommand) (interface{}, error) {
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
userMenusCommand.Operator)
|
|
|
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
|
|
|
UserId: int(userMenusCommand.Operator.UserId),
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"accessMenus": resultMenu.Menus,
|
|
|
}, nil
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
// GetCooperationApplications TODO:共创用户获取共创申请列表
|
|
|
// PersonSearchCooperationApplications 共创用户获取共创申请列表
|
|
|
func (srv CooperationApplicationsService) PersonSearchCooperationApplications(userMenusCommand *command.ListCooperationApplicationQuery) (interface{}, error) {
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
userMenusCommand.Operator)
|
|
|
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
|
|
|
UserId: int(userMenusCommand.Operator.UserId),
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"accessMenus": resultMenu.Menus,
|
|
|
}, nil
|
|
|
return nil, nil
|
|
|
} |
...
|
...
|
|