credit_accounts_person.go 2.6 KB
package service

import (
	"github.com/linmadan/egglib-go/core/application"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)

// PersonCreditAccountService 企业端账期结算 【0%】
type PersonCreditAccountService struct {
}

// CreditAccountPaySearch  企业分红结算支付记录
func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
	gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
		cmd.Operator)
	resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
		PageNumber:    cmd.PageNumber,
		PageSize:      cmd.PageSize,
		PaymentStatus: 2,
		// TODO:时间段过滤,用户过滤
	})
	if err != nil {
		return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
	}
	return map[string]interface{}{
		"grid": map[string]interface{}{
			"list": resultMenu.Grid.List,
			"sum":  6000,
		},
	}, nil
}

// PaymentHistoryStatistics  支付历史统计
func (srv PersonCreditAccountService) PaymentHistoryStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
	//gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
	//	cmd.Operator)
	//resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
	//	PageNumber:    cmd.PageNumber,
	//	PageSize:      cmd.PageSize,
	//	PaymentStatus: 2,
	//})
	//if err != nil {
	//	return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
	//}
	return map[string]interface{}{
		"rankItems":          []struct{}{},
		"totalPaymentAmount": 6000,
	}, nil
}

// PaymentHistoryHistogramStatistics  支付历史统计-直方图
func (srv PersonCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
	//gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
	//	cmd.Operator)
	//resultMenu, err := gateway.CreditAccountsSearch(allied_creation_cooperation.ReqCreditAccountsSearch{
	//	PageNumber:    cmd.PageNumber,
	//	PageSize:      cmd.PageSize,
	//	PaymentStatus: 2,
	//})
	//if err != nil {
	//	return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
	//}
	return map[string]interface{}{
		"xAxis": map[string]interface{}{
			"data": []string{"7-5", "7-15", "7-25"},
		},
		"yAxis": struct{}{},
		"source": map[string]interface{}{
			"value": []float64{60, 80, 90},
		},
	}, nil
}