作者 yangfu

统计修改

1 -package service  
2 -  
3 -import (  
4 - "github.com/linmadan/egglib-go/core/application"  
5 - "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"  
7 -)  
8 -  
9 -// 企业端统计  
10 -type CompanyStatisticsService struct {  
11 -}  
12 -  
13 -// IndexStatistics TODO:首页统计 (入口页面统计数据)  
14 -func (srv CompanyStatisticsService) IndexStatistics(userMenusCommand *command.IndexStatisticsCommand) (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())  
22 - }  
23 - return map[string]interface{}{  
24 - "accessMenus": resultMenu.Menus,  
25 - }, nil  
26 -}  
27 -  
28 -// IndexStatistics TODO:共创人员统计(共创人员明细)  
29 -func (srv CompanyStatisticsService) CooperationPersonStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (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 - }  
38 - return map[string]interface{}{  
39 - "accessMenus": resultMenu.Menus,  
40 - }, nil  
41 -}  
42 -  
43 -// IndexStatistics TODO:产品统计排行榜 年月榜  
44 -func (srv CompanyStatisticsService) GoodsStatistics(userMenusCommand *command.GoodsStatisticsCommand) (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())  
52 - }  
53 - return map[string]interface{}{  
54 - "accessMenus": resultMenu.Menus,  
55 - }, nil  
56 -}  
57 -  
58 -// IndexStatistics TODO:共创分红支出统计  
59 -func (srv CompanyStatisticsService) CooperationDividendsStatistics(userMenusCommand *command.CooperationDividendsStatisticsCommand) (interface{}, error) {  
60 - creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(  
61 - userMenusCommand.Operator)  
62 - resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{  
63 - UserId: int(userMenusCommand.Operator.UserId),  
64 - })  
65 - if err != nil {  
66 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
67 - }  
68 - return map[string]interface{}{  
69 - "accessMenus": resultMenu.Menus,  
70 - }, nil  
71 -}  
  1 +package service
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
  5 +)
  6 +
  7 +// 企业端统计
  8 +type CompanyStatisticsService struct {
  9 +}
  10 +
  11 +// IndexStatistics TODO:首页统计 (入口页面统计数据)
  12 +func (srv CompanyStatisticsService) IndexStatistics(userMenusCommand *command.IndexStatisticsCommand) (interface{}, error) {
  13 + //creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  14 + // userMenusCommand.Operator)
  15 + //resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
  16 + // UserId: int(userMenusCommand.Operator.UserId),
  17 + //})
  18 + //if err != nil {
  19 + // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  20 + //}
  21 + return map[string]interface{}{}, nil
  22 +}
  23 +
  24 +// CooperationPersonStatistics TODO:共创人员统计(共创人员明细)
  25 +func (srv CompanyStatisticsService) CooperationPersonStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) {
  26 + return map[string]interface{}{}, nil
  27 +}
  28 +
  29 +// GoodsStatistics TODO:产品统计排行榜 年月榜
  30 +func (srv CompanyStatisticsService) GoodsStatistics(userMenusCommand *command.GoodsStatisticsCommand) (interface{}, error) {
  31 + return map[string]interface{}{}, nil
  32 +}
  33 +
  34 +// CooperationDividendsStatistics TODO:共创分红支出统计
  35 +func (srv CompanyStatisticsService) CooperationDividendsStatistics(userMenusCommand *command.CooperationDividendsStatisticsCommand) (interface{}, error) {
  36 + return map[string]interface{}{}, nil
  37 +}
  1 +package service
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
  5 +)
  6 +
  7 +// 个人端统计
  8 +type PersonStatisticsService struct {
  9 +}
  10 +
  11 +// IndexStatistics TODO:个人端 - 首页统计 (入口页面统计数据)
  12 +func (srv PersonStatisticsService) IndexStatistics(userMenusCommand *command.IndexStatisticsCommand) (interface{}, error) {
  13 + //creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  14 + // userMenusCommand.Operator)
  15 + //resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
  16 + // UserId: int(userMenusCommand.Operator.UserId),
  17 + //})
  18 + //if err != nil {
  19 + // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  20 + //}
  21 + return map[string]interface{}{
  22 + "overview": map[string]interface{}{
  23 + "contractSum": 60,
  24 + "contractStoppedSum": 70,
  25 + "companySum": 6,
  26 + },
  27 + "dividendStatistics": map[string]interface{}{
  28 + "creditAccount": 1000,
  29 + "dividendsEstimate": 2000,
  30 + "orderAmount": 7000,
  31 + },
  32 + }, nil
  33 +}
  34 +
  35 +// CompanyStatistics 共创用户-共创企业统计
  36 +func (srv PersonStatisticsService) CompanyStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) {
  37 + return map[string]interface{}{}, nil
  38 +}
  39 +
  40 +// CompanyDividendStatistics 共创用户-共创企业分红统计
  41 +func (srv PersonStatisticsService) CompanyDividendStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) {
  42 + return map[string]interface{}{}, nil
  43 +}
  44 +
  45 +// CooperationProjectRecommend 猜你喜欢(共创项目)
  46 +func (srv PersonStatisticsService) CooperationProjectRecommend(userMenusCommand *command.GoodsStatisticsCommand) (interface{}, error) {
  47 + return map[string]interface{}{}, nil
  48 +}
@@ -443,3 +443,57 @@ func (controller *CooperationController) CooperationDividendsStatistics() { @@ -443,3 +443,57 @@ func (controller *CooperationController) CooperationDividendsStatistics() {
443 data, err := svr.CooperationDividendsStatistics(cmd) 443 data, err := svr.CooperationDividendsStatistics(cmd)
444 controller.Response(data, err) 444 controller.Response(data, err)
445 } 445 }
  446 +
  447 +/***** PersonStatistics 用户端统计 *****/
  448 +
  449 +func (controller *CooperationController) PersonIndexStatistics() {
  450 + svr := service.PersonStatisticsService{}
  451 + cmd := &command.IndexStatisticsCommand{}
  452 + err := controller.Unmarshal(cmd)
  453 + if err != nil {
  454 + controller.Response(nil, err)
  455 + return
  456 + }
  457 + cmd.Operator = controller.GetOperator()
  458 + data, err := svr.IndexStatistics(cmd)
  459 + controller.Response(data, err)
  460 +}
  461 +
  462 +func (controller *CooperationController) PersonCompanyStatistics() {
  463 + svr := service.PersonStatisticsService{}
  464 + cmd := &command.CooperationPersonStatisticsCommand{}
  465 + err := controller.Unmarshal(cmd)
  466 + if err != nil {
  467 + controller.Response(nil, err)
  468 + return
  469 + }
  470 + cmd.Operator = controller.GetOperator()
  471 + data, err := svr.CompanyStatistics(cmd)
  472 + controller.Response(data, err)
  473 +}
  474 +
  475 +func (controller *CooperationController) PersonCompanyDividendStatistics() {
  476 + svr := service.PersonStatisticsService{}
  477 + cmd := &command.CooperationPersonStatisticsCommand{}
  478 + err := controller.Unmarshal(cmd)
  479 + if err != nil {
  480 + controller.Response(nil, err)
  481 + return
  482 + }
  483 + cmd.Operator = controller.GetOperator()
  484 + data, err := svr.CompanyDividendStatistics(cmd)
  485 + controller.Response(data, err)
  486 +}
  487 +
  488 +func (controller *CooperationController) PersonCooperationProjectRecommend() {
  489 + svr := service.PersonStatisticsService{}
  490 + cmd := &command.GoodsStatisticsCommand{}
  491 + err := controller.Unmarshal(cmd)
  492 + if err != nil {
  493 + controller.Response(nil, err)
  494 + return
  495 + }
  496 + cmd.Operator = controller.GetOperator()
  497 + data, err := svr.CooperationProjectRecommend(cmd)
  498 + controller.Response(data, err)
  499 +}
@@ -10,7 +10,7 @@ func init() { @@ -10,7 +10,7 @@ func init() {
10 web.Router("/v1/auth/login/pwd", &controllers.AuthController{}, "Post:LoginPwd") 10 web.Router("/v1/auth/login/pwd", &controllers.AuthController{}, "Post:LoginPwd")
11 web.Router("/v1/auth/login/sms", &controllers.AuthController{}, "Post:LoginSms") 11 web.Router("/v1/auth/login/sms", &controllers.AuthController{}, "Post:LoginSms")
12 web.Router("/v1/auth/login/qrcode", &controllers.AuthController{}, "Post:QrcodeLoginStatus") 12 web.Router("/v1/auth/login/qrcode", &controllers.AuthController{}, "Post:QrcodeLoginStatus")
13 - web.Router("/v1/auth/captcha-init", &controllers.AuthController{}, "Post:CaptchaInit") 13 + web.Router("/v1/auth/captcha-init", &controllers.AuthController{}, "Get:CaptchaInit")
14 web.Router("/v1/auth/qrcode-init", &controllers.AuthController{}, "Post:GetQrcode") 14 web.Router("/v1/auth/qrcode-init", &controllers.AuthController{}, "Post:GetQrcode")
15 web.Router("/v1/auth/sms-code", &controllers.AuthController{}, "Post:SendSmsCode") 15 web.Router("/v1/auth/sms-code", &controllers.AuthController{}, "Post:SendSmsCode")
16 web.Router("/v1/auth/check-sms-code", &controllers.AuthController{}, "Post:CheckSmsCode") 16 web.Router("/v1/auth/check-sms-code", &controllers.AuthController{}, "Post:CheckSmsCode")
@@ -38,7 +38,6 @@ func init() { @@ -38,7 +38,6 @@ func init() {
38 web.Router("/v1/app/cooperation-projects/person/search", &mobile_client.CooperationController{}, "Post:PersonSearchCooperationProject") 38 web.Router("/v1/app/cooperation-projects/person/search", &mobile_client.CooperationController{}, "Post:PersonSearchCooperationProject")
39 39
40 /***** CompanyDividends 账期结算 *****/ 40 /***** CompanyDividends 账期结算 *****/
41 - /***** CompanyDividends 账期结算 *****/  
42 web.Router("/v1/app/company/credit-accounts/search", &mobile_client.CooperationController{}, "Post:CreditAccountSearch") 41 web.Router("/v1/app/company/credit-accounts/search", &mobile_client.CooperationController{}, "Post:CreditAccountSearch")
43 web.Router("/v1/app/company/credit-accounts/:creditId", &mobile_client.CooperationController{}, "Get:CreditAccountGet") 42 web.Router("/v1/app/company/credit-accounts/:creditId", &mobile_client.CooperationController{}, "Get:CreditAccountGet")
44 web.Router("/v1/app/company/credit-accounts/pay", &mobile_client.CooperationController{}, "Post:CreditAccountPay") 43 web.Router("/v1/app/company/credit-accounts/pay", &mobile_client.CooperationController{}, "Post:CreditAccountPay")
@@ -60,4 +59,10 @@ func init() { @@ -60,4 +59,10 @@ func init() {
60 web.Router("/v1/app/cooperation/person/statistics", &mobile_client.CooperationController{}, "Post:CooperationPersonStatistics") 59 web.Router("/v1/app/cooperation/person/statistics", &mobile_client.CooperationController{}, "Post:CooperationPersonStatistics")
61 web.Router("/v1/app/cooperation/goods/statistics", &mobile_client.CooperationController{}, "Post:GoodsStatistics") 60 web.Router("/v1/app/cooperation/goods/statistics", &mobile_client.CooperationController{}, "Post:GoodsStatistics")
62 web.Router("/v1/app/cooperation-dividends-statistics/statistics", &mobile_client.CooperationController{}, "Post:CooperationDividendsStatistics") 61 web.Router("/v1/app/cooperation-dividends-statistics/statistics", &mobile_client.CooperationController{}, "Post:CooperationDividendsStatistics")
  62 +
  63 + /***** PersonStatistics 用户端统计 *****/
  64 + web.Router("/v1/app/cooperation-user/index", &mobile_client.CooperationController{}, "Get:PersonIndexStatistics")
  65 + web.Router("/v1/app/cooperation-user/company-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyStatistics")
  66 + web.Router("/v1/app/cooperation-user/company-dividend-statistics", &mobile_client.CooperationController{}, "Post:PersonCompanyDividendStatistics")
  67 + web.Router("/v1/app/cooperation-projects/recommend", &mobile_client.CooperationController{}, "Post:PersonCooperationProjectRecommend")
63 } 68 }