cooperation_controller.go 11.3 KB
package mobile_client

import (
	"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/service"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)

// Controller
type CooperationController struct {
	baseController
}

/*****    CooperationApplicationsService 共创申请服务 *****/
//SearchFeedback 承接人反馈
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)
}

// SearchFeedback 创建承接人反馈
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)
}

//AuditAllCooperationApplication 公司一键审核申请
func (controller *CooperationController) AuditAllCooperationApplication() {
	svr := service.CooperationApplicationsService{}
	cmd := &command.AuditAllCooperationApplicationCommand{}
	err := controller.Unmarshal(cmd)
	if err != nil {
		controller.Response(nil, err)
		return
	}
	cmd.Operator = controller.GetOperator()
	data, err := svr.CooperationApplicationsOneclickApproval(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 {
		log.Logger.Error(err.Error())
	}
	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()
	cmd.CooperationApplicationId, _ = controller.GetInt64(":applicationId")
	data, err := svr.PersonGetCooperationApplications(cmd)
	controller.Response(data, err)
}

func (controller *CooperationController) PersonCancelCooperationApplication() {
	svr := service.CooperationApplicationsService{}
	cmd := &command.CancelCooperationApplicationCommand{}
	applicationId, _ := controller.GetInt(":applicationId")
	cmd.Operator = controller.GetOperator()
	cmd.CooperationApplicationId = applicationId
	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()
	projectId, _ := controller.GetInt(":projectId")
	cmd.CooperationProjectId = projectId
	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.CooperationProjectId = controller.GetString(":projectId")
	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()
	total, data, err := svr.SearchCooperationProject(cmd)
	controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
}

func (controller *CooperationController) PersonSearchCooperationProject() {
	svr := service.CooperationProjectService{}
	cmd := &command.PersonSearchCooperationProjectQuery{}
	err := controller.Unmarshal(cmd)
	if err != nil {
		controller.Response(nil, err)
		return
	}
	cmd.Operator = controller.GetOperator()
	total, data, err := svr.PersonSearchCooperationProject(cmd)
	controller.ReturnPageListData(int64(total), data, err, cmd.PageNumber)
}

/*****   CompanyCreditAccountService 企业端账期结算  *****/
func (controller *CooperationController) CreditAccountSearch() {
	svr := service.CompanyCreditAccountService{}
	cmd := &command.CreditAccountSearchCommand{}
	err := controller.Unmarshal(cmd)
	if err != nil {
		log.Logger.Error(err.Error())
	}
	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 {
		log.Logger.Error(err.Error())
	}
	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 {
		log.Logger.Error(err.Error())
	}
	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 {
		log.Logger.Error(err.Error())
	}
	cmd.Operator = controller.GetOperator()
	data, err := svr.CreditAccountPaySearch(cmd)
	controller.Response(data, err)
}

/*****   CompanyDividends 企业端分红  *****/
func (controller *CooperationController) GetDividendContracts() {
	svr := service.CompanyStatisticsService{}
	cmd := &command.GetDividendContractsCommand{}
	err := controller.Unmarshal(cmd)
	if err != nil {
		controller.Response(nil, err)
		return
	}
	cmd.Operator = controller.GetOperator()
	data, err := svr.GetDividendContracts(cmd)
	controller.Response(data, err)
}

func (controller *CooperationController) DividendsStatistics() {
	svr := service.CompanyStatisticsService{}
	cmd := &command.DividendsStatisticsCommand{}
	err := controller.Unmarshal(cmd)
	if err != nil {
		controller.Response(nil, err)
		return
	}
	cmd.Operator = controller.GetOperator()
	data, err := svr.DividendsStatistics(cmd)
	controller.Response(data, err)
}

func (controller *CooperationController) SearchDividendsEstimates() {
	svr := service.CompanyStatisticsService{}
	cmd := &command.SearchDividendsEstimatesCommand{}
	err := controller.Unmarshal(cmd)
	if err != nil {
		controller.Response(nil, err)
		return
	}
	cmd.Operator = controller.GetOperator()
	data, err := svr.SearchDividendsEstimates(cmd)
	controller.Response(data, err)
}

/*****   CompanyStatistics 企业端统计  *****/

func (controller *CooperationController) IndexStatistics() {
	svr := service.CompanyStatisticsService{}
	cmd := &command.IndexStatisticsCommand{}
	err := controller.Unmarshal(cmd)
	if err != nil {
		controller.Response(nil, err)
		return
	}
	cmd.Operator = controller.GetOperator()
	data, err := svr.IndexStatistics(cmd)
	controller.Response(data, err)
}

func (controller *CooperationController) CooperationPersonStatistics() {
	svr := service.CompanyStatisticsService{}
	cmd := &command.CooperationPersonStatisticsCommand{}
	err := controller.Unmarshal(cmd)
	if err != nil {
		controller.Response(nil, err)
		return
	}
	cmd.Operator = controller.GetOperator()
	data, err := svr.CooperationPersonStatistics(cmd)
	controller.Response(data, err)
}

func (controller *CooperationController) GoodsStatistics() {
	svr := service.CompanyStatisticsService{}
	cmd := &command.GoodsStatisticsCommand{}
	err := controller.Unmarshal(cmd)
	if err != nil {
		controller.Response(nil, err)
		return
	}
	cmd.Operator = controller.GetOperator()
	data, err := svr.GoodsStatistics(cmd)
	controller.Response(data, err)
}

func (controller *CooperationController) CooperationDividendsStatistics() {
	svr := service.CompanyStatisticsService{}
	cmd := &command.CooperationDividendsStatisticsCommand{}
	err := controller.Unmarshal(cmd)
	if err != nil {
		controller.Response(nil, err)
		return
	}
	cmd.Operator = controller.GetOperator()
	data, err := svr.CooperationDividendsStatistics(cmd)
	controller.Response(data, err)
}