审查视图

pkg/port/beego/controllers/web_client/dividends_estimate_controller.go 5.6 KB
tangxuhui authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
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())
21 22
		controller.Response(nil, err)
		return
tangxuhui authored
23 24 25 26 27 28 29 30 31 32 33 34 35
	}
	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())
36 37
		controller.Response(nil, err)
		return
tangxuhui authored
38 39
	}
	searchDividendsEstimateQuery.Operator = controller.GetOperator()
tangxuhui authored
40 41
	cnt, data, err := dividendsEstimateService.SearchDividendsEstimate(searchDividendsEstimateQuery)
	controller.ReturnPageListData(int64(cnt), data, err, searchDividendsEstimateQuery.PageNumber)
tangxuhui authored
42 43 44 45 46 47 48 49 50
}

//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())
51 52
		controller.Response(nil, err)
		return
tangxuhui authored
53 54
	}
	searchDividendsIncentivesQuery.Operator = controller.GetOperator()
tangxuhui authored
55 56
	cnt, data, err := dividendsEstimateService.SearchDividendsIncentives(searchDividendsIncentivesQuery)
	controller.ReturnPageListData(int64(cnt), data, err, searchDividendsIncentivesQuery.PageNumber)
tangxuhui authored
57 58 59 60 61 62 63 64 65
}

//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())
66 67
		controller.Response(nil, err)
		return
tangxuhui authored
68 69
	}
	searchMoneyIncentivesQuery.Operator = controller.GetOperator()
tangxuhui authored
70 71
	cnt, data, err := dividendsEstimateService.SearchMoneyIncentives(searchMoneyIncentivesQuery)
	controller.ReturnPageListData(int64(cnt), data, err, searchMoneyIncentivesQuery.PageNumber)
tangxuhui authored
72 73 74 75 76 77 78 79 80
}

//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())
81 82
		controller.Response(nil, err)
		return
tangxuhui authored
83 84 85 86 87 88 89 90 91 92 93 94 95
	}
	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())
96 97
		controller.Response(nil, err)
		return
tangxuhui authored
98 99 100 101 102
	}
	estimateDividendsIncentivesCommand.Operator = controller.GetOperator()
	data, err := dividendsEstimateService.EstimateDividendsIncentives(estimateDividendsIncentivesCommand)
	controller.Response(data, err)
}
tangxuhui authored
103 104 105 106 107 108 109 110

//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())
111 112
		controller.Response(nil, err)
		return
tangxuhui authored
113 114 115 116 117
	}
	moneyIncentivesSelectorQuery.Operator = controller.GetOperator()
	data, err := dividendsEstimateService.MoneyIncentivesSelector(moneyIncentivesSelectorQuery)
	controller.Response(data, err)
}
118 119 120 121 122 123 124 125

//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())
126 127
		controller.Response(nil, err)
		return
128 129 130 131 132
	}
	confimDividendsEstimateCommand.Operator = controller.GetOperator()
	data, err := dividendsEstimateService.ConfimDividendsEstimate(confimDividendsEstimateCommand)
	controller.Response(data, err)
}