作者 yangfu

企业分红统计

@@ -10,6 +10,12 @@ import ( @@ -10,6 +10,12 @@ import (
10 type GetDividendContractsCommand struct { 10 type GetDividendContractsCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
  13 + // 查询偏离量
  14 + PageNumber int `json:"pageIndex" valid:"Required"`
  15 + // 查询限制
  16 + PageSize int `json:"pageSize" valid:"Required"`
  17 + //审核状态
  18 + //Status int `json:"status"`
13 } 19 }
14 20
15 func (cmd *GetDividendContractsCommand) Valid(validation *validation.Validation) { 21 func (cmd *GetDividendContractsCommand) Valid(validation *validation.Validation) {
@@ -10,6 +10,12 @@ import ( @@ -10,6 +10,12 @@ import (
10 type SearchDividendsEstimatesCommand struct { 10 type SearchDividendsEstimatesCommand struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
  13 + // 查询偏离量
  14 + PageNumber int `json:"pageIndex" valid:"Required"`
  15 + // 查询限制
  16 + PageSize int `json:"pageSize" valid:"Required"`
  17 + //审核状态
  18 + Status int `json:"status"`
13 } 19 }
14 20
15 func (cmd *SearchDividendsEstimatesCommand) Valid(validation *validation.Validation) { 21 func (cmd *SearchDividendsEstimatesCommand) Valid(validation *validation.Validation) {
  1 +package dto
  2 +
  3 +type CompanyContractDividendDto struct {
  4 + CooperationContractName string `json:"cooperationContractName"`
  5 + CooperationContractNumber string `json:"cooperationContractNumber"`
  6 + CooperationContractID string `json:"cooperationContractId"`
  7 + DividendsAmount string `json:"dividendsAmount"`
  8 + DividendsOrderAmount string `json:"dividendsOrderAmount"`
  9 + CreatedAt int64 `json:"createdAt"`
  10 + CooperationContractStatus int `json:"cooperationContractStatus"`
  11 +}
  12 +
  13 +func (v *CompanyContractDividendDto) LoadDto() {
  14 + v = &CompanyContractDividendDto{
  15 + CooperationContractID: "79879879834",
  16 + CooperationContractNumber: "dfjkdjfld",
  17 + CooperationContractName: "合约名称",
  18 + DividendsAmount: "9876.99",
  19 + DividendsOrderAmount: "8596.33",
  20 + CreatedAt: 1628901385000,
  21 + CooperationContractStatus: 1,
  22 + }
  23 +}
  24 +
  25 +func NewCompanyContractDividendDto() *CompanyContractDividendDto {
  26 + v := &CompanyContractDividendDto{
  27 + CooperationContractID: "79879879834",
  28 + CooperationContractNumber: "dfjkdjfld",
  29 + CooperationContractName: "合约名称",
  30 + DividendsAmount: "9876.99",
  31 + DividendsOrderAmount: "8596.33",
  32 + CreatedAt: 1628901385000,
  33 + CooperationContractStatus: 1,
  34 + }
  35 + return v
  36 +}
  1 +package dto
  2 +
  3 +type DividendsEstimatesDto struct {
  4 + CooperationProjectNumber string `json:"cooperationProjectNumber"`
  5 + DividendsAccountStatus int `json:"dividendsAccountStatus"`
  6 + DividendsAmount float64 `json:"dividendsAmount"`
  7 + DividendsOrderAmount string `json:"dividendsOrderAmount"`
  8 + DividendsEstimateID int `json:"dividendsEstimateId"`
  9 + DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
  10 + DividendsEstimateTime string `json:"dividendsEstimateTime"`
  11 + DividendsParticipateType int `json:"dividendsParticipateType"`
  12 + DividendsType int `json:"dividendsType"`
  13 + DividendsUser struct {
  14 + UserID int `json:"userId"`
  15 + UserInfo struct {
  16 + //UserAccount string `json:"userAccount"`
  17 + //UserAvatar string `json:"userAvatar"`
  18 + //UserEmail string `json:"userEmail"`
  19 + UserName string `json:"userName"`
  20 + // UserPhone string `json:"userPhone"`
  21 + } `json:"userInfo"`
  22 + UserType int `json:"userType"`
  23 + } `json:"dividendsUser"`
  24 + OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
  25 +}
  26 +
  27 +func (d *DividendsEstimatesDto) LoadDto() {
  28 +
  29 +}
  30 +
  31 +func NewDividendsEstimatesDto() *DividendsEstimatesDto {
  32 + return &DividendsEstimatesDto{
  33 + CooperationProjectNumber: "xxfdilm00256",
  34 + }
  35 +}
1 package service 1 package service
2 2
3 import ( 3 import (
4 - "github.com/linmadan/egglib-go/core/application"  
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
6 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"
7 ) 6 )
8 7
9 // 企业端分红服务 8 // 企业端分红服务
@@ -12,45 +11,60 @@ type CompanyDividendsService struct { @@ -12,45 +11,60 @@ type CompanyDividendsService struct {
12 11
13 // IndexStatistics TODO:企业的合约列表(分红信息按合约划分) 12 // IndexStatistics TODO:企业的合约列表(分红信息按合约划分)
14 func (srv CompanyStatisticsService) GetDividendContracts(userMenusCommand *command.GetDividendContractsCommand) (interface{}, error) { 13 func (srv CompanyStatisticsService) GetDividendContracts(userMenusCommand *command.GetDividendContractsCommand) (interface{}, error) {
15 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(  
16 - userMenusCommand.Operator)  
17 - resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{  
18 - UserId: int(userMenusCommand.Operator.UserId),  
19 - })  
20 - if err != nil {  
21 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 14 + //creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  15 + // userMenusCommand.Operator)
  16 + //resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
  17 + // UserId: int(userMenusCommand.Operator.UserId),
  18 + //})
  19 + //if err != nil {
  20 + // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  21 + //}
  22 + var items []*dto.CompanyContractDividendDto
  23 + for i := 0; i < 2; i++ {
  24 + item := dto.NewCompanyContractDividendDto()
  25 + item.LoadDto()
  26 + items = append(items, item)
22 } 27 }
23 return map[string]interface{}{ 28 return map[string]interface{}{
24 - "accessMenus": resultMenu.Menus, 29 + "list": items,
25 }, nil 30 }, nil
26 } 31 }
27 32
28 // IndexStatistics TODO:企业的合约统计(分红统计) 33 // IndexStatistics TODO:企业的合约统计(分红统计)
29 func (srv CompanyStatisticsService) DividendsStatistics(userMenusCommand *command.DividendsStatisticsCommand) (interface{}, error) { 34 func (srv CompanyStatisticsService) DividendsStatistics(userMenusCommand *command.DividendsStatisticsCommand) (interface{}, error) {
30 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(  
31 - userMenusCommand.Operator)  
32 - resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{  
33 - UserId: int(userMenusCommand.Operator.UserId),  
34 - })  
35 - if err != nil {  
36 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
37 - } 35 + //creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  36 + // userMenusCommand.Operator)
  37 + //resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
  38 + // UserId: int(userMenusCommand.Operator.UserId),
  39 + //})
  40 + //if err != nil {
  41 + // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  42 + //}
38 return map[string]interface{}{ 43 return map[string]interface{}{
39 - "accessMenus": resultMenu.Menus, 44 + "sumTotal": 9000,
  45 + "waitSettle": 6000,
  46 + "hasBeenSettle": 3000,
  47 + "hasBeenPay": 2000,
40 }, nil 48 }, nil
41 } 49 }
42 50
43 // IndexStatistics 企业的合约明细列表(分红预算信息) 51 // IndexStatistics 企业的合约明细列表(分红预算信息)
44 func (srv CompanyStatisticsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (interface{}, error) { 52 func (srv CompanyStatisticsService) SearchDividendsEstimates(userMenusCommand *command.SearchDividendsEstimatesCommand) (interface{}, error) {
45 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(  
46 - userMenusCommand.Operator)  
47 - resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{  
48 - UserId: int(userMenusCommand.Operator.UserId),  
49 - })  
50 - if err != nil {  
51 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 53 + //creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  54 + // userMenusCommand.Operator)
  55 + //resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
  56 + // UserId: int(userMenusCommand.Operator.UserId),
  57 + //})
  58 + //if err != nil {
  59 + // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  60 + //}
  61 + var items []*dto.DividendsEstimatesDto
  62 + for i := 0; i < 2; i++ {
  63 + item := dto.NewDividendsEstimatesDto()
  64 + item.LoadDto()
  65 + items = append(items, item)
52 } 66 }
53 return map[string]interface{}{ 67 return map[string]interface{}{
54 - "accessMenus": resultMenu.Menus, 68 + "list": items,
55 }, nil 69 }, nil
56 } 70 }
@@ -44,7 +44,7 @@ func init() { @@ -44,7 +44,7 @@ func init() {
44 web.Router("/v1/app/company/credit-accounts/pay/search", &mobile_client.CooperationController{}, "Post:CreditAccountPaySearch") 44 web.Router("/v1/app/company/credit-accounts/pay/search", &mobile_client.CooperationController{}, "Post:CreditAccountPaySearch")
45 45
46 /***** CompanyDividends 企业端分红 *****/ 46 /***** CompanyDividends 企业端分红 *****/
47 - web.Router("/v1/app/cooperation/company/dividends/contracts", &mobile_client.CooperationController{}, "Get:GetDividendContracts") 47 + web.Router("/v1/app/cooperation/company/dividends/contracts", &mobile_client.CooperationController{}, "Post:GetDividendContracts")
48 web.Router("/v1/app/cooperation/company/dividends/sum", &mobile_client.CooperationController{}, "Post:DividendsStatistics") 48 web.Router("/v1/app/cooperation/company/dividends/sum", &mobile_client.CooperationController{}, "Post:DividendsStatistics")
49 web.Router("/v1/app/cooperation/company/dividends-estimates/search", &mobile_client.CooperationController{}, "Post:SearchDividendsEstimates") 49 web.Router("/v1/app/cooperation/company/dividends-estimates/search", &mobile_client.CooperationController{}, "Post:SearchDividendsEstimates")
50 50