作者 yangfu

增加app端天联共创路由、服务

正在显示 23 个修改的文件 包含 1180 行增加0 行删除
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
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type CancelCooperationApplicationCommand 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 *CancelCooperationApplicationCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (auditCooperationApplicationCommand *CancelCooperationApplicationCommand) 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
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
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
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 command
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 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 command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
// Command
type CreditAccountGetCommand struct {
//操作人
Operator domain.Operator `json:"-"`
}
func (cmd *CreditAccountGetCommand) Valid(validation *validation.Validation) {
}
func (cmd *CreditAccountGetCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cmd)
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"
)
// Command
type CreditAccountPayCommand struct {
//操作人
Operator domain.Operator `json:"-"`
}
func (cmd *CreditAccountPayCommand) Valid(validation *validation.Validation) {
}
func (cmd *CreditAccountPayCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cmd)
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"
)
// Command
type CreditAccountPaySearchCommand struct {
//操作人
Operator domain.Operator `json:"-"`
}
func (cmd *CreditAccountPaySearchCommand) Valid(validation *validation.Validation) {
}
func (cmd *CreditAccountPaySearchCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cmd)
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"
)
// Command
type CreditAccountSearchCommand struct {
//操作人
Operator domain.Operator `json:"-"`
}
func (cmd *CreditAccountSearchCommand) Valid(validation *validation.Validation) {
}
func (cmd *CreditAccountSearchCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cmd)
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 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 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 command
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 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,string" 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 command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
// Command
type CreateFeedbackCommand struct {
//操作人
Operator domain.Operator `json:"-"`
}
func (cmd *CreateFeedbackCommand) Valid(validation *validation.Validation) {
}
func (cmd *CreateFeedbackCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cmd)
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"
)
// Command
type SearchFeedbackCommand struct {
//操作人
Operator domain.Operator `json:"-"`
}
func (cmd *SearchFeedbackCommand) Valid(validation *validation.Validation) {
}
func (cmd *SearchFeedbackCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(cmd)
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/mobile/cooperation/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
// CompanyCreditAccountService 企业端账期结算
type CompanyCreditAccountService struct {
}
// IndexStatistics TODO:企业的账期结算列表(分红信息按合约划分)
func (srv CompanyCreditAccountService) CreditAccountSearch(userMenusCommand *command.CreditAccountSearchCommand) (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
}
// IndexStatistics TODO:企业的账期结算明细
func (srv CompanyCreditAccountService) CreditAccountGet(userMenusCommand *command.CreditAccountGetCommand) (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
}
// IndexStatistics TODO:企业的账期结算支付
func (srv CompanyCreditAccountService) CreditAccountPay(userMenusCommand *command.CreditAccountPayCommand) (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
}
// IndexStatistics TODO:企业分红结算支付记录
func (srv CompanyCreditAccountService) CreditAccountPaySearch(userMenusCommand *command.CreditAccountPaySearchCommand) (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
}
... ...
package service
import (
"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/infrastructure/service_gateway/allied_creation_user"
)
// CooperationApplicationsService 共创申请服务
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),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return map[string]interface{}{
"accessMenus": resultMenu.Menus,
}, 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),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return map[string]interface{}{
"accessMenus": resultMenu.Menus,
}, nil
}
// GetCooperationApplications TODO:企业获取共创申请列表
func (srv CooperationApplicationsService) SearchCooperationApplications(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
}
/***** 共创用户端 *****/
// 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),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return map[string]interface{}{
"accessMenus": resultMenu.Menus,
}, nil
}
//PersonGetCooperationApplications TODO:共创用户获取共创申请详情
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
}
// GetCooperationApplications TODO:共创用户取消共创申请
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
}
// GetCooperationApplications TODO:共创用户获取共创申请列表
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
}
... ...
package service
import (
"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/infrastructure/service_gateway/allied_creation_user"
)
// CooperationProjectService 共创项目服务
type CooperationProjectService struct {
}
// CreateCooperationProject TODO:创建共创项目
func (srv CooperationProjectService) CreateCooperationProject(userMenusCommand *command.CreateCooperationProjectCommand) (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
}
// GetCooperationProject TODO:返回共创项目明细
func (srv CooperationProjectService) GetCooperationProject(userMenusCommand *command.GetCooperationProjectQuery) (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
}
// UpdateCooperationProject TODO:企业更新共创项目
func (srv CooperationProjectService) UpdateCooperationProject(userMenusCommand *command.UpdateCooperationProjectCommand) (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
}
// EndCooperationProject TODO:企业结束共创项目
func (srv CooperationProjectService) EndCooperationProject(userMenusCommand *command.EndCooperationProjectCommand) (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
}
// SearchCooperationProject TODO:获取共创项目列表
func (srv CooperationProjectService) SearchCooperationProject(userMenusCommand *command.ListCooperationProjectQuery) (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
}
... ...
package service
import (
"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/infrastructure/service_gateway/allied_creation_user"
)
// UndertakerFeedbackService 承接反馈服务
type UndertakerFeedbackService struct {
}
// CreateCooperationProject TODO:承接反馈列表
func (srv UndertakerFeedbackService) SearchFeedback(userMenusCommand *command.SearchFeedbackCommand) (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
}
// CreateCooperationProject TODO:创建承接反馈
func (srv UndertakerFeedbackService) CreateFeedback(userMenusCommand *command.CreateFeedbackCommand) (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
}
... ...
... ... @@ -10,6 +10,245 @@ type CooperationController struct {
baseController
}
/***** CooperationApplicationsService 共创申请服务 *****/
func (controller *CooperationController) SearchFeedback() {
svr := service.UndertakerFeedbackService{}
cmd := &command.SearchFeedbackCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.SearchFeedback(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) CreateFeedback() {
svr := service.UndertakerFeedbackService{}
cmd := &command.CreateFeedbackCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CreateFeedback(cmd)
controller.Response(data, err)
}
/***** CooperationApplicationsService 共创申请服务 - 企业端 *****/
func (controller *CooperationController) GetCooperationApplication() {
svr := service.CooperationApplicationsService{}
cmd := &command.GetCooperationApplicationQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.GetCooperationApplications(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) AuditCooperationApplication() {
svr := service.CooperationApplicationsService{}
cmd := &command.AuditCooperationApplicationCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.AuditCooperationApplications(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) SearchCooperationApplication() {
svr := service.CooperationApplicationsService{}
cmd := &command.ListCooperationApplicationQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.SearchCooperationApplications(cmd)
controller.Response(data, err)
}
/***** CooperationApplicationsService 共创申请服务 - 共创用户端 *****/
func (controller *CooperationController) CreateCooperationApplication() {
svr := service.CooperationApplicationsService{}
cmd := &command.CreateCooperationApplicationCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CreateCooperationApplications(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) PersonGetCooperationApplication() {
svr := service.CooperationApplicationsService{}
cmd := &command.GetCooperationApplicationQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.PersonGetCooperationApplications(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) PersonCancelCooperationApplication() {
svr := service.CooperationApplicationsService{}
cmd := &command.CancelCooperationApplicationCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.PersonCancelCooperationApplications(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) PersonSearchCooperationApplication() {
svr := service.CooperationApplicationsService{}
cmd := &command.ListCooperationApplicationQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.PersonSearchCooperationApplications(cmd)
controller.Response(data, err)
}
/***** CooperationProjectService 共创项目服务 *****/
func (controller *CooperationController) CreateCooperationProject() {
svr := service.CooperationProjectService{}
cmd := &command.CreateCooperationProjectCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CreateCooperationProject(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) GetCooperationProject() {
svr := service.CooperationProjectService{}
cmd := &command.GetCooperationProjectQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.GetCooperationProject(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) UpdateCooperationProject() {
svr := service.CooperationProjectService{}
cmd := &command.UpdateCooperationProjectCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.UpdateCooperationProject(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) EndCooperationProject() {
svr := service.CooperationProjectService{}
cmd := &command.EndCooperationProjectCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.EndCooperationProject(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) SearchCooperationProject() {
svr := service.CooperationProjectService{}
cmd := &command.ListCooperationProjectQuery{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.SearchCooperationProject(cmd)
controller.Response(data, err)
}
/***** CompanyCreditAccountService 企业端账期结算 *****/
func (controller *CooperationController) CreditAccountSearch() {
svr := service.CompanyCreditAccountService{}
cmd := &command.CreditAccountSearchCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CreditAccountSearch(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) CreditAccountGet() {
svr := service.CompanyCreditAccountService{}
cmd := &command.CreditAccountGetCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CreditAccountGet(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) CreditAccountPay() {
svr := service.CompanyCreditAccountService{}
cmd := &command.CreditAccountPayCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CreditAccountPay(cmd)
controller.Response(data, err)
}
func (controller *CooperationController) CreditAccountPaySearch() {
svr := service.CompanyCreditAccountService{}
cmd := &command.CreditAccountPaySearchCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
cmd.Operator = controller.GetOperator()
data, err := svr.CreditAccountPaySearch(cmd)
controller.Response(data, err)
}
/***** CompanyDividends 企业端分红 *****/
func (controller *CooperationController) GetDividendContracts() {
svr := service.CompanyStatisticsService{}
... ...
... ... @@ -9,6 +9,34 @@ import (
func init() {
/***** 共创申请服务 企业端 *****/
web.Router("/v1/app/cooperation-applications/:applicationId", &mobile_client.CooperationController{}, "Get:GetCooperationApplication")
web.Router("/v1/app/cooperation-applications/audit", &mobile_client.CooperationController{}, "Put:AuditCooperationApplication")
web.Router("/v1/app/cooperation-applications/search", &mobile_client.CooperationController{}, "Post:SearchCooperationApplication")
/***** 共创申请服务 共创用户端 *****/
web.Router("/v1/app/cooperation-applications", &mobile_client.CooperationController{}, "Post:CreateCooperationApplication")
web.Router("/v1/app/cooperation-applications/person/:applicationId", &mobile_client.CooperationController{}, "Get:PersonGetCooperationApplication")
web.Router("/v1/app/cooperation-applications/cancel/:applicationId", &mobile_client.CooperationController{}, "Delete:PersonCancelCooperationApplication")
web.Router("/v1/app/cooperation-applications/person/search", &mobile_client.CooperationController{}, "Post:PersonSearchCooperationApplication")
/***** 承接反馈 *****/
web.Router("/v1/app/contract-undertaker-feedbacks", &mobile_client.CooperationController{}, "Post:CreateFeedback")
web.Router("/v1/app/contract-undertaker-feedbacks/search", &mobile_client.CooperationController{}, "Get:SearchFeedback")
/***** CompanyDividends 共创项目 *****/
web.Router("/v1/app/cooperation-projects", &mobile_client.CooperationController{}, "Post:CreateCooperationProject")
web.Router("/v1/app/cooperation-projects/:projectId", &mobile_client.CooperationController{}, "Get:GetCooperationProject")
web.Router("/v1/app/cooperation-projects/:projectId", &mobile_client.CooperationController{}, "Put:UpdateCooperationProject")
web.Router("/v1/app/cooperation-projects/end", &mobile_client.CooperationController{}, "Post:EndCooperationProject")
web.Router("/v1/app/cooperation-projects/search", &mobile_client.CooperationController{}, "Post:SearchCooperationProject")
/***** CompanyDividends 账期结算 *****/
web.Router("/v1/app/company/credit-accounts/search", &mobile_client.CooperationController{}, "Post:CreditAccountSearch")
web.Router("/v1/app/company/credit-accounts/:creditId", &mobile_client.CooperationController{}, "Get:CreditAccountGet")
web.Router("/v1/app/company/credit-accounts/pay", &mobile_client.CooperationController{}, "Post:CreditAccountPay")
web.Router("/v1/app/company/credit-accounts/pay/search", &mobile_client.CooperationController{}, "Post:CreditAccountPaySearch")
/***** CompanyDividends 企业端分红 *****/
web.Router("/v1/app/cooperation/company/dividends/contracts", &mobile_client.CooperationController{}, "Get:GetDividendContracts")
web.Router("/v1/app/cooperation/company/dividends/sum", &mobile_client.CooperationController{}, "Post:DividendsStatistics")
... ...