dividends_estimate_controller.go 12.1 KB
package controllers

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsEstimate/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsEstimate/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/application/dividendsEstimate/service"
)

type DividendsEstimateController struct {
	BaseController
}

// CreateDividendsEstimate 新增分红预算单(预留)
func (controller *DividendsEstimateController) CreateDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	createDividendsEstimateCommand := &command.CreateDividendsEstimateCommand{}
	_ = controller.Unmarshal(createDividendsEstimateCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	createDividendsEstimateCommand.CompanyId = header.CompanyId
	createDividendsEstimateCommand.OrgId = header.OrgId
	createDividendsEstimateCommand.UserId = header.UserId
	createDividendsEstimateCommand.UserBaseId = header.UserBaseId
	data, err := dividendsEstimateService.CreateDividendsEstimate(createDividendsEstimateCommand)
	controller.Response(data, err)
}

// UpdateDividendsEstimate 编辑分红预算单(预留)
func (controller *DividendsEstimateController) UpdateDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	updateDividendsEstimateCommand := &command.UpdateDividendsEstimateCommand{}
	_ = controller.Unmarshal(updateDividendsEstimateCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	updateDividendsEstimateCommand.CompanyId = header.CompanyId
	updateDividendsEstimateCommand.OrgId = header.OrgId
	updateDividendsEstimateCommand.UserId = header.UserId
	updateDividendsEstimateCommand.UserBaseId = header.UserBaseId
	dividendsEstimateId, _ := controller.GetInt64(":dividendsEstimateId")
	updateDividendsEstimateCommand.DividendsEstimateId = dividendsEstimateId
	data, err := dividendsEstimateService.UpdateDividendsEstimate(updateDividendsEstimateCommand)
	controller.Response(data, err)
}

// GetDividendsEstimate 获取分红预算单详情
func (controller *DividendsEstimateController) GetDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	getDividendsEstimateQuery := &query.GetDividendsEstimateQuery{}
	header := controller.GetRequestHeader(controller.Ctx)
	getDividendsEstimateQuery.CompanyId = header.CompanyId
	getDividendsEstimateQuery.OrgId = header.OrgId
	getDividendsEstimateQuery.UserId = header.UserId
	getDividendsEstimateQuery.UserBaseId = header.UserBaseId
	dividendsEstimateId := controller.GetString(":dividendsEstimateId")
	getDividendsEstimateQuery.DividendsEstimateId = dividendsEstimateId
	data, err := dividendsEstimateService.GetDividendsEstimate(getDividendsEstimateQuery)
	controller.Response(data, err)
}

// RemoveDividendsEstimate 移除分红预算单(预留)
func (controller *DividendsEstimateController) RemoveDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	removeDividendsEstimateCommand := &command.RemoveDividendsEstimateCommand{}
	_ = controller.Unmarshal(removeDividendsEstimateCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	removeDividendsEstimateCommand.CompanyId = header.CompanyId
	removeDividendsEstimateCommand.OrgId = header.OrgId
	removeDividendsEstimateCommand.UserId = header.UserId
	removeDividendsEstimateCommand.UserBaseId = header.UserBaseId
	dividendsEstimateId, _ := controller.GetInt64(":dividendsEstimateId")
	removeDividendsEstimateCommand.DividendsEstimateId = dividendsEstimateId
	data, err := dividendsEstimateService.RemoveDividendsEstimate(removeDividendsEstimateCommand)
	controller.Response(data, err)
}

// CancelDividendsEstimate 取消分红预算单
func (controller *DividendsEstimateController) CancelDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	cancelDividendsEstimateCommand := &command.CancelDividendsEstimateCommand{}
	_ = controller.Unmarshal(cancelDividendsEstimateCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	cancelDividendsEstimateCommand.CompanyId = header.CompanyId
	cancelDividendsEstimateCommand.OrgId = header.OrgId
	cancelDividendsEstimateCommand.UserId = header.UserId
	cancelDividendsEstimateCommand.UserBaseId = header.UserBaseId
	dividendsEstimateId, _ := controller.GetInt64(":dividendsEstimateId")
	cancelDividendsEstimateCommand.DividendsEstimateId = dividendsEstimateId
	data, err := dividendsEstimateService.CancelDividendsEstimate(cancelDividendsEstimateCommand)
	controller.Response(data, err)
}

// BatchCancelDividendsEstimate 批量取消分红预算单
func (controller *DividendsEstimateController) BatchCancelDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	batchCancelDividendsEstimateCommand := &command.BatchCancelDividendsEstimateCommand{}
	_ = controller.Unmarshal(batchCancelDividendsEstimateCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	batchCancelDividendsEstimateCommand.CompanyId = header.CompanyId
	batchCancelDividendsEstimateCommand.OrgId = header.OrgId
	batchCancelDividendsEstimateCommand.UserId = header.UserId
	batchCancelDividendsEstimateCommand.UserBaseId = header.UserBaseId
	data, err := dividendsEstimateService.BatchCancelDividendsEstimate(batchCancelDividendsEstimateCommand)
	controller.Response(data, err)
}

// SearchDividendsEstimate 搜索分红预算单
func (controller *DividendsEstimateController) SearchDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	searchDividendsEstimateQuery := &query.SearchDividendsEstimateQuery{}
	_ = controller.Unmarshal(searchDividendsEstimateQuery)
	data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery)
	controller.Response(data, err)
}

// ConfirmDividendsIncentivesEstimate 确定业绩激励分红预算
func (controller *DividendsEstimateController) ConfirmDividendsIncentivesEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	estimateDividendsIncentivesCommand := &command.ConfirmDividendsIncentivesEstimateCommand{}
	_ = controller.Unmarshal(estimateDividendsIncentivesCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	estimateDividendsIncentivesCommand.CompanyId = header.CompanyId
	estimateDividendsIncentivesCommand.OrgId = header.OrgId
	estimateDividendsIncentivesCommand.UserId = header.UserId
	estimateDividendsIncentivesCommand.UserBaseId = header.UserBaseId
	data, err := dividendsEstimateService.ConfirmDividendsIncentivesEstimate(estimateDividendsIncentivesCommand)
	controller.Response(data, err)
}

// ConfirmMoneyIncentivesEstimate 确定金额激励分红预算
func (controller *DividendsEstimateController) ConfirmMoneyIncentivesEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	confirmMoneyIncentivesEstimateCommand := &command.ConfirmMoneyIncentivesEstimateCommand{}
	_ = controller.Unmarshal(confirmMoneyIncentivesEstimateCommand)
	header := controller.GetRequestHeader(controller.Ctx)
	confirmMoneyIncentivesEstimateCommand.CompanyId = header.CompanyId
	confirmMoneyIncentivesEstimateCommand.OrgId = header.OrgId
	confirmMoneyIncentivesEstimateCommand.UserId = header.UserId
	confirmMoneyIncentivesEstimateCommand.UserBaseId = header.UserBaseId
	data, err := dividendsEstimateService.ConfirmMoneyIncentivesEstimate(confirmMoneyIncentivesEstimateCommand)
	controller.Response(data, err)
}

// ListMoneyIncentivesEstimate 返回金额激励分红预算信息列表
func (controller *DividendsEstimateController) ListMoneyIncentivesEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	listMoneyIncentivesEstimateQuery := &query.ListMoneyIncentivesEstimateQuery{}
	header := controller.GetRequestHeader(controller.Ctx)
	listMoneyIncentivesEstimateQuery.CompanyId = header.CompanyId
	listMoneyIncentivesEstimateQuery.OrgId = header.OrgId
	listMoneyIncentivesEstimateQuery.UserId = header.UserId
	listMoneyIncentivesEstimateQuery.UserBaseId = header.UserBaseId
	pageSize, _ := controller.GetInt64("pageSize")
	listMoneyIncentivesEstimateQuery.PageSize = pageSize
	pageNumber, _ := controller.GetInt64("pageNumber")
	listMoneyIncentivesEstimateQuery.PageNumber = pageNumber
	data, err := dividendsEstimateService.ListMoneyIncentivesEstimate(listMoneyIncentivesEstimateQuery)
	controller.Response(data, err)
}

// SearchMoneyIncentivesEstimate 搜索金额激励分红预算信息
func (controller *DividendsEstimateController) SearchMoneyIncentivesEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	searchMoneyIncentivesEstimateQuery := &query.SearchMoneyIncentivesEstimateQuery{}
	_ = controller.Unmarshal(searchMoneyIncentivesEstimateQuery)
	header := controller.GetRequestHeader(controller.Ctx)
	searchMoneyIncentivesEstimateQuery.CompanyId = header.CompanyId
	searchMoneyIncentivesEstimateQuery.OrgId = header.OrgId
	searchMoneyIncentivesEstimateQuery.UserId = header.UserId
	searchMoneyIncentivesEstimateQuery.UserBaseId = header.UserBaseId
	//pageSize, _ := controller.GetInt64("pageSize")
	//searchMoneyIncentivesEstimateQuery.PageSize = pageSize
	//pageNumber, _ := controller.GetInt64("pageNumber")
	//searchMoneyIncentivesEstimateQuery.PageNumber = pageNumber
	data, err := dividendsEstimateService.SearchMoneyIncentivesEstimate(searchMoneyIncentivesEstimateQuery)
	controller.Response(data, err)
}

// ListDividendsIncentivesEstimate 返回业绩激励分红预算信息列表
func (controller *DividendsEstimateController) ListDividendsIncentivesEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	listDividendsIncentivesQuery := &query.ListDividendsIncentivesEstimateQuery{}
	header := controller.GetRequestHeader(controller.Ctx)
	listDividendsIncentivesQuery.CompanyId = header.CompanyId
	listDividendsIncentivesQuery.OrgId = header.OrgId
	listDividendsIncentivesQuery.UserId = header.UserId
	listDividendsIncentivesQuery.UserBaseId = header.UserBaseId
	pageSize, _ := controller.GetInt64("pageSize")
	listDividendsIncentivesQuery.PageSize = pageSize
	pageNumber, _ := controller.GetInt64("pageNumber")
	listDividendsIncentivesQuery.PageNumber = pageNumber
	data, err := dividendsEstimateService.ListDividendsIncentivesEstimate(listDividendsIncentivesQuery)
	controller.Response(data, err)
}

// SearchDividendsIncentivesEstimate 搜索业绩激励分红预算信息
func (controller *DividendsEstimateController) SearchDividendsIncentivesEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	searchDividendsIncentivesQuery := &query.SearchDividendsIncentivesEstimateQuery{}
	_ = controller.Unmarshal(searchDividendsIncentivesQuery)
	header := controller.GetRequestHeader(controller.Ctx)
	searchDividendsIncentivesQuery.CompanyId = header.CompanyId
	searchDividendsIncentivesQuery.OrgId = header.OrgId
	searchDividendsIncentivesQuery.UserId = header.UserId
	searchDividendsIncentivesQuery.UserBaseId = header.UserBaseId
	//pageSize, _ := controller.GetInt64("pageSize")
	//searchDividendsIncentivesQuery.PageSize = pageSize
	//pageNumber, _ := controller.GetInt64("pageNumber")
	//searchDividendsIncentivesQuery.PageNumber = pageNumber
	data, err := dividendsEstimateService.SearchDividendsIncentivesEstimate(searchDividendsIncentivesQuery)
	controller.Response(data, err)
}

// ListDividendsEstimate 返回分红预算单列表
func (controller *DividendsEstimateController) ListDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	listDividendsEstimateQuery := &query.ListDividendsEstimateQuery{}
	header := controller.GetRequestHeader(controller.Ctx)
	listDividendsEstimateQuery.CompanyId = header.CompanyId
	listDividendsEstimateQuery.OrgId = header.OrgId
	listDividendsEstimateQuery.UserId = header.UserId
	listDividendsEstimateQuery.UserBaseId = header.UserBaseId
	pageSize, _ := controller.GetInt64("pageSize")
	listDividendsEstimateQuery.PageSize = pageSize
	pageNumber, _ := controller.GetInt64("pageNumber")
	listDividendsEstimateQuery.PageNumber = pageNumber
	data, err := dividendsEstimateService.ListDividendsEstimate(listDividendsEstimateQuery)
	controller.Response(data, err)
}