作者 yangfu

共创首页统计

@@ -5,6 +5,11 @@ type DividendsEstimatesDto struct { @@ -5,6 +5,11 @@ type DividendsEstimatesDto struct {
5 DividendsAccountStatus int `json:"dividendsAccountStatus"` 5 DividendsAccountStatus int `json:"dividendsAccountStatus"`
6 DividendsAmount float64 `json:"dividendsAmount"` 6 DividendsAmount float64 `json:"dividendsAmount"`
7 DividendsOrderAmount float64 `json:"dividendsOrderAmount"` 7 DividendsOrderAmount float64 `json:"dividendsOrderAmount"`
  8 + // 客户姓名
  9 + CustomerName string `json:"customerName"`
  10 + // 订单产品名称
  11 + OrderGoodName string `json:"orderGoodName"`
  12 +
8 DividendsEstimateID int `json:"dividendsEstimateId"` 13 DividendsEstimateID int `json:"dividendsEstimateId"`
9 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"` 14 DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
10 DividendsEstimateTime int64 `json:"dividendsEstimateTime"` 15 DividendsEstimateTime int64 `json:"dividendsEstimateTime"`
@@ -22,10 +27,6 @@ type DividendsEstimatesDto struct { @@ -22,10 +27,6 @@ type DividendsEstimatesDto struct {
22 UserType int `json:"userType"` 27 UserType int `json:"userType"`
23 } `json:"dividendsUser"` 28 } `json:"dividendsUser"`
24 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` 29 OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
25 - // 客户姓名  
26 - CustomerName string `json:"customerName"`  
27 - // 订单产品名称  
28 - OrderGoodName string `json:"orderGoodName"`  
29 } 30 }
30 31
31 func (d *DividendsEstimatesDto) LoadDto() { 32 func (d *DividendsEstimatesDto) LoadDto() {
@@ -5,7 +5,9 @@ import ( @@ -5,7 +5,9 @@ import (
5 "github.com/linmadan/egglib-go/core/application" 5 "github.com/linmadan/egglib-go/core/application"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
9 "math/rand" 11 "math/rand"
10 "time" 12 "time"
11 ) 13 )
@@ -48,10 +50,62 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics @@ -48,10 +50,62 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
48 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 50 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
49 } 51 }
50 52
  53 + // 模式列表
  54 + models, err := gateway.CooperationModeList(allied_creation_cooperation.ReqCooperationModeList{
  55 + PageSize: 20,
  56 + PageNumber: 1,
  57 + })
  58 + if err != nil {
  59 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  60 + }
  61 + var cooperationModes []interface{}
  62 + for i := range models.List {
  63 + item := models.List[i]
  64 + cooperationModes = append(cooperationModes, map[string]interface{}{
  65 + "cooperationModeId": item.CooperationModeId,
  66 + "cooperationModeName": item.CooperationModeName,
  67 + "cooperationModeNumber": item.CooperationModeNumber,
  68 + })
  69 + }
  70 + // 项目概览统计
  71 + contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
  72 + PageNumber: 1,
  73 + PageSize: 1,
  74 + })
  75 + if err != nil {
  76 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  77 + }
  78 + projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
  79 + PageNumber: 1,
  80 + PageSize: 1,
  81 + })
  82 + if err != nil {
  83 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  84 + }
  85 + gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
  86 + cmd.Operator)
  87 + users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{
  88 + Limit: 1,
  89 + Offset: 0,
  90 + CompanyId: cmd.Operator.CompanyId,
  91 + OrganizationId: cmd.Operator.OrgId,
  92 + UserType: domain.UserTypeCooperation,
  93 + })
  94 + if err != nil {
  95 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  96 + }
  97 + var projectOverviewStatistics = map[string]interface{}{
  98 + "contractSum": contracts.Grid.Total,
  99 + "cooperationUserCount": users.Count,
  100 + "projectSum": projects.Total,
  101 + }
  102 +
51 return map[string]interface{}{ 103 return map[string]interface{}{
  104 + "projectOverviewStatistics": projectOverviewStatistics,
52 "currentMonthDividendsStatistics": companyDividendsStatistics, 105 "currentMonthDividendsStatistics": companyDividendsStatistics,
53 "cooperationModeStatistics": cooperationModeStatistics, 106 "cooperationModeStatistics": cooperationModeStatistics,
54 - "CooperationGoodsStatistics": cooperationGoodsStatistics, 107 + "cooperationGoodsStatistics": cooperationGoodsStatistics,
  108 + "cooperationModes": cooperationModes,
55 }, nil 109 }, nil
56 } 110 }
57 111
1 package domain 1 package domain
2 2
3 import ( 3 import (
  4 + "encoding/base64"
4 "fmt" 5 "fmt"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util"
  7 + "log"
6 "time" 8 "time"
7 9
8 jwt "github.com/dgrijalva/jwt-go" 10 jwt "github.com/dgrijalva/jwt-go"
@@ -48,15 +50,16 @@ func (qrmsg *QrcodeMessage) GenerateImageBase64() ([]byte, error) { @@ -48,15 +50,16 @@ func (qrmsg *QrcodeMessage) GenerateImageBase64() ([]byte, error) {
48 } 50 }
49 key := loginHost + str 51 key := loginHost + str
50 encryptedData, err := util.AesEncrypt([]byte(key), aecSecret) 52 encryptedData, err := util.AesEncrypt([]byte(key), aecSecret)
  53 + qrmsg.Token = base64.StdEncoding.EncodeToString(encryptedData)
51 //初始化数据 54 //初始化数据
52 - qrmsg.Token = string(encryptedData) 55 + //qrmsg.Token = string(encryptedData)
53 qrmsg.IsLogin = false 56 qrmsg.IsLogin = false
54 57
55 // 输入日志 58 // 输入日志
56 - //decrypted,_:= util.AesDecrypt(encryptedData,aecSecret)  
57 - //if string(decrypted)==key{  
58 - // log.Println("token:",str,"\n encrypt:",key,"\n decrypt:",string(decrypted))  
59 - //} 59 + decrypted, _ := util.AesDecrypt(encryptedData, aecSecret)
  60 + if string(decrypted) == key {
  61 + log.Println("token:", str, "\n encrypt:", key, "\n decrypt:", string(decrypted))
  62 + }
60 63
61 //qrCode, err := qr.Encode(str, qr.M, qr.Auto) 64 //qrCode, err := qr.Encode(str, qr.M, qr.Auto)
62 //if err != nil { 65 //if err != nil {
@@ -12,7 +12,7 @@ type CooperationController struct { @@ -12,7 +12,7 @@ type CooperationController struct {
12 } 12 }
13 13
14 /***** CooperationApplicationsService 共创申请服务 *****/ 14 /***** CooperationApplicationsService 共创申请服务 *****/
15 -//SearchFeedback 承接人反馈CreditAccountSearch 15 +//SearchFeedback 承接人反馈
16 func (controller *CooperationController) SearchFeedback() { 16 func (controller *CooperationController) SearchFeedback() {
17 svr := service.UndertakerFeedbackService{} 17 svr := service.UndertakerFeedbackService{}
18 cmd := &command.SearchFeedbackCommand{} 18 cmd := &command.SearchFeedbackCommand{}
@@ -11,7 +11,7 @@ func init() { @@ -11,7 +11,7 @@ func init() {
11 11
12 web.Router("/v1/user/company-orgs", &controllers.AuthController{}, "Post:GetCompanyOrgsByUser") 12 web.Router("/v1/user/company-orgs", &controllers.AuthController{}, "Post:GetCompanyOrgsByUser")
13 web.Router("/v1/user/user-info", &controllers.AuthController{}, "Post:GetUserInfo") 13 web.Router("/v1/user/user-info", &controllers.AuthController{}, "Post:GetUserInfo")
14 - web.Router("/v1/user/user-info-extra", &controllers.AuthController{}, "Post:GetUserInfoExtra") 14 + web.Router("/v1/user/favorite-menus", &controllers.AuthController{}, "Post:GetUserInfoExtra")
15 web.Router("/v1/user/user-menu", &controllers.AuthController{}, "Post:GetUserMenus") 15 web.Router("/v1/user/user-menu", &controllers.AuthController{}, "Post:GetUserMenus")
16 web.Router("/v1/user/user-orgs", &controllers.AuthController{}, "Post:GetUserOrg") 16 web.Router("/v1/user/user-orgs", &controllers.AuthController{}, "Post:GetUserOrg")
17 17