cooperation_application_controller.go 2.4 KB
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
	getCooperationApplicationQuery.Operator = controller.GetOperator()
	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())
		controller.Response(nil, err)
		return
	}
	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())
		controller.Response(nil, err)
		return
	}
	auditCooperationApplicationCommand.Operator = controller.GetOperator()
	data, err := cooperationApplicationService.AuditCooperationApplication(auditCooperationApplicationCommand)
	controller.Response(data, err)
}