作者 yangfu

企业分红统计

... ... @@ -10,6 +10,12 @@ import (
type GetDividendContractsCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageIndex" valid:"Required"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
//审核状态
//Status int `json:"status"`
}
func (cmd *GetDividendContractsCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -10,6 +10,12 @@ import (
type SearchDividendsEstimatesCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageIndex" valid:"Required"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
//审核状态
Status int `json:"status"`
}
func (cmd *SearchDividendsEstimatesCommand) Valid(validation *validation.Validation) {
... ...
package dto
type CompanyContractDividendDto struct {
CooperationContractName string `json:"cooperationContractName"`
CooperationContractNumber string `json:"cooperationContractNumber"`
CooperationContractID string `json:"cooperationContractId"`
DividendsAmount string `json:"dividendsAmount"`
DividendsOrderAmount string `json:"dividendsOrderAmount"`
CreatedAt int64 `json:"createdAt"`
CooperationContractStatus int `json:"cooperationContractStatus"`
}
func (v *CompanyContractDividendDto) LoadDto() {
v = &CompanyContractDividendDto{
CooperationContractID: "79879879834",
CooperationContractNumber: "dfjkdjfld",
CooperationContractName: "合约名称",
DividendsAmount: "9876.99",
DividendsOrderAmount: "8596.33",
CreatedAt: 1628901385000,
CooperationContractStatus: 1,
}
}
func NewCompanyContractDividendDto() *CompanyContractDividendDto {
v := &CompanyContractDividendDto{
CooperationContractID: "79879879834",
CooperationContractNumber: "dfjkdjfld",
CooperationContractName: "合约名称",
DividendsAmount: "9876.99",
DividendsOrderAmount: "8596.33",
CreatedAt: 1628901385000,
CooperationContractStatus: 1,
}
return v
}
... ...
package dto
type DividendsEstimatesDto struct {
CooperationProjectNumber string `json:"cooperationProjectNumber"`
DividendsAccountStatus int `json:"dividendsAccountStatus"`
DividendsAmount float64 `json:"dividendsAmount"`
DividendsOrderAmount string `json:"dividendsOrderAmount"`
DividendsEstimateID int `json:"dividendsEstimateId"`
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
DividendsEstimateTime string `json:"dividendsEstimateTime"`
DividendsParticipateType int `json:"dividendsParticipateType"`
DividendsType int `json:"dividendsType"`
DividendsUser struct {
UserID int `json:"userId"`
UserInfo struct {
//UserAccount string `json:"userAccount"`
//UserAvatar string `json:"userAvatar"`
//UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
// UserPhone string `json:"userPhone"`
} `json:"userInfo"`
UserType int `json:"userType"`
} `json:"dividendsUser"`
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
}
func (d *DividendsEstimatesDto) LoadDto() {
}
func NewDividendsEstimatesDto() *DividendsEstimatesDto {
return &DividendsEstimatesDto{
CooperationProjectNumber: "xxfdilm00256",
}
}
... ...
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_user"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"
)
// 企业端分红服务
... ... @@ -12,45 +11,60 @@ type CompanyDividendsService struct {
// IndexStatistics TODO:企业的合约列表(分红信息按合约划分)
func (srv CompanyStatisticsService) GetDividendContracts(userMenusCommand *command.GetDividendContractsCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
userMenusCommand.Operator)
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
UserId: int(userMenusCommand.Operator.UserId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
// userMenusCommand.Operator)
//resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
// UserId: int(userMenusCommand.Operator.UserId),
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
var items []*dto.CompanyContractDividendDto
for i := 0; i < 2; i++ {
item := dto.NewCompanyContractDividendDto()
item.LoadDto()
items = append(items, item)
}
return map[string]interface{}{
"accessMenus": resultMenu.Menus,
"list": items,
}, nil
}
// IndexStatistics TODO:企业的合约统计(分红统计)
func (srv CompanyStatisticsService) DividendsStatistics(userMenusCommand *command.DividendsStatisticsCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
userMenusCommand.Operator)
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
UserId: int(userMenusCommand.Operator.UserId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
//creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
// userMenusCommand.Operator)
//resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
// UserId: int(userMenusCommand.Operator.UserId),
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
return map[string]interface{}{
"accessMenus": resultMenu.Menus,
"sumTotal": 9000,
"waitSettle": 6000,
"hasBeenSettle": 3000,
"hasBeenPay": 2000,
}, nil
}
// IndexStatistics 企业的合约明细列表(分红预算信息)
func (srv CompanyStatisticsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
userMenusCommand.Operator)
resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
UserId: int(userMenusCommand.Operator.UserId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
// userMenusCommand.Operator)
//resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
// UserId: int(userMenusCommand.Operator.UserId),
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
var items []*dto.DividendsEstimatesDto
for i := 0; i < 2; i++ {
item := dto.NewDividendsEstimatesDto()
item.LoadDto()
items = append(items, item)
}
return map[string]interface{}{
"accessMenus": resultMenu.Menus,
"list": items,
}, nil
}
... ...
... ... @@ -44,7 +44,7 @@ func init() {
web.Router("/v1/app/company/credit-accounts/pay/search", &mobile_client.CooperationController{}, "Post:CreditAccountPaySearch")
/***** CompanyDividends 企业端分红 *****/
web.Router("/v1/app/cooperation/company/dividends/contracts", &mobile_client.CooperationController{}, "Get:GetDividendContracts")
web.Router("/v1/app/cooperation/company/dividends/contracts", &mobile_client.CooperationController{}, "Post:GetDividendContracts")
web.Router("/v1/app/cooperation/company/dividends/sum", &mobile_client.CooperationController{}, "Post:DividendsStatistics")
web.Router("/v1/app/cooperation/company/dividends-estimates/search", &mobile_client.CooperationController{}, "Post:SearchDividendsEstimates")
... ...