dividends_estimate_controller.go 5.6 KB
package web_client

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

type DividendsEstimateController struct {
	baseController
}

//CancelDividendsEstimate 取消分红预算
func (controller *DividendsEstimateController) CancelDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	cancelDividendsEstimateCommand := &command.CancelDividendsEstimateCommand{}
	err := controller.Unmarshal(cancelDividendsEstimateCommand)
	if err != nil {
		log.Logger.Debug("json err:" + err.Error())
		controller.Response(nil, err)
		return
	}
	cancelDividendsEstimateCommand.Operator = controller.GetOperator()
	data, err := dividendsEstimateService.CancelDividendsEstimate(cancelDividendsEstimateCommand)
	controller.Response(data, err)
}

//SearchDividendsEstimate 查询分红预算单列表
func (controller *DividendsEstimateController) SearchDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	searchDividendsEstimateQuery := &query.SearchDividendsEstimateQuery{}
	err := controller.Unmarshal(searchDividendsEstimateQuery)
	if err != nil {
		log.Logger.Debug("json err:" + err.Error())
		controller.Response(nil, err)
		return
	}
	searchDividendsEstimateQuery.Operator = controller.GetOperator()
	cnt, data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery)
	controller.ReturnPageListData(int64(cnt), data, err, searchDividendsEstimateQuery.PageNumber)
}

//SearchDividendsIncentives 查询业绩分红
func (controller *DividendsEstimateController) SearchDividendsIncentives() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	searchDividendsIncentivesQuery := &query.SearchDividendsIncentivesQuery{}
	err := controller.Unmarshal(searchDividendsIncentivesQuery)
	if err != nil {
		log.Logger.Debug("json err:" + err.Error())
		controller.Response(nil, err)
		return
	}
	searchDividendsIncentivesQuery.Operator = controller.GetOperator()
	cnt, data, err := dividendsEstimateService.SearchDividendsIncentives(searchDividendsIncentivesQuery)
	controller.ReturnPageListData(int64(cnt), data, err, searchDividendsIncentivesQuery.PageNumber)
}

//SearchMoneyIncentives 查询金额激励分红
func (controller *DividendsEstimateController) SearchMoneyIncentives() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	searchMoneyIncentivesQuery := &query.SearchMoneyIncentivesQuery{}
	err := controller.Unmarshal(searchMoneyIncentivesQuery)
	if err != nil {
		log.Logger.Debug("json err:" + err.Error())
		controller.Response(nil, err)
		return
	}
	searchMoneyIncentivesQuery.Operator = controller.GetOperator()
	cnt, data, err := dividendsEstimateService.SearchMoneyIncentives(searchMoneyIncentivesQuery)
	controller.ReturnPageListData(int64(cnt), data, err, searchMoneyIncentivesQuery.PageNumber)
}

//EstimateMoneyIncentives 确定预算金额激励分红
func (controller *DividendsEstimateController) EstimateMoneyIncentives() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	estimateMoneyIncentivesCommand := &command.EstimateMoneyIncentivesCommand{}
	err := controller.Unmarshal(estimateMoneyIncentivesCommand)
	if err != nil {
		log.Logger.Debug("json err:" + err.Error())
		controller.Response(nil, err)
		return
	}
	estimateMoneyIncentivesCommand.Operator = controller.GetOperator()
	data, err := dividendsEstimateService.EstimateMoneyIncentives(estimateMoneyIncentivesCommand)
	controller.Response(data, err)
}

//EstimateDividendsIncentives 确定业绩分红激励
func (controller *DividendsEstimateController) EstimateDividendsIncentives() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	estimateDividendsIncentivesCommand := &command.EstimateDividendsIncentivesCommand{}
	err := controller.Unmarshal(estimateDividendsIncentivesCommand)
	if err != nil {
		log.Logger.Debug("json err:" + err.Error())
		controller.Response(nil, err)
		return
	}
	estimateDividendsIncentivesCommand.Operator = controller.GetOperator()
	data, err := dividendsEstimateService.EstimateDividendsIncentives(estimateDividendsIncentivesCommand)
	controller.Response(data, err)
}

//MoneyIncentivesSelector
func (controller *DividendsEstimateController) MoneyIncentivesSelector() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	moneyIncentivesSelectorQuery := &query.MoneyIncentiveSelectorQuery{}
	err := controller.Unmarshal(moneyIncentivesSelectorQuery)
	if err != nil {
		log.Logger.Debug("json err:" + err.Error())
		controller.Response(nil, err)
		return
	}
	moneyIncentivesSelectorQuery.Operator = controller.GetOperator()
	data, err := dividendsEstimateService.MoneyIncentivesSelector(moneyIncentivesSelectorQuery)
	controller.Response(data, err)
}

//ConfimDividendsEstimate 确定分红预算
func (controller *DividendsEstimateController) ConfimDividendsEstimate() {
	dividendsEstimateService := service.NewDividendsEstimateService(nil)
	confimDividendsEstimateCommand := &command.ConfimDividendsEstimateCommand{}
	err := controller.Unmarshal(confimDividendsEstimateCommand)
	if err != nil {
		log.Logger.Debug("json err:" + err.Error())
		controller.Response(nil, err)
		return
	}
	confimDividendsEstimateCommand.Operator = controller.GetOperator()
	data, err := dividendsEstimateService.ConfimDividendsEstimate(confimDividendsEstimateCommand)
	controller.Response(data, err)
}