作者 yangfu

共创首页统计

package dto
type DividendsEstimatesDto struct {
CooperationProjectNumber string `json:"cooperationProjectNumber"`
DividendsAccountStatus int `json:"dividendsAccountStatus"`
DividendsAmount float64 `json:"dividendsAmount"`
DividendsOrderAmount float64 `json:"dividendsOrderAmount"`
DividendsEstimateID int `json:"dividendsEstimateId"`
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
DividendsEstimateTime int64 `json:"dividendsEstimateTime"`
DividendsParticipateType int `json:"dividendsParticipateType"`
DividendsType int `json:"dividendsType"`
CooperationProjectNumber string `json:"cooperationProjectNumber"`
DividendsAccountStatus int `json:"dividendsAccountStatus"`
DividendsAmount float64 `json:"dividendsAmount"`
DividendsOrderAmount float64 `json:"dividendsOrderAmount"`
// 客户姓名
CustomerName string `json:"customerName"`
// 订单产品名称
OrderGoodName string `json:"orderGoodName"`
DividendsEstimateID int `json:"dividendsEstimateId"`
DividendsEstimateOrderNumber string `json:"dividendsEstimateOrderNumber"`
DividendsEstimateTime int64 `json:"dividendsEstimateTime"`
DividendsParticipateType int `json:"dividendsParticipateType"`
DividendsType int `json:"dividendsType"`
DividendsUser struct {
UserID int `json:"userId"`
UserInfo struct {
... ... @@ -22,10 +27,6 @@ type DividendsEstimatesDto struct {
UserType int `json:"userType"`
} `json:"dividendsUser"`
OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"`
// 客户姓名
CustomerName string `json:"customerName"`
// 订单产品名称
OrderGoodName string `json:"orderGoodName"`
}
func (d *DividendsEstimatesDto) LoadDto() {
... ...
... ... @@ -5,7 +5,9 @@ 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/application/mobile/cooperation/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
"math/rand"
"time"
)
... ... @@ -48,10 +50,62 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// 模式列表
models, err := gateway.CooperationModeList(allied_creation_cooperation.ReqCooperationModeList{
PageSize: 20,
PageNumber: 1,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
var cooperationModes []interface{}
for i := range models.List {
item := models.List[i]
cooperationModes = append(cooperationModes, map[string]interface{}{
"cooperationModeId": item.CooperationModeId,
"cooperationModeName": item.CooperationModeName,
"cooperationModeNumber": item.CooperationModeNumber,
})
}
// 项目概览统计
contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
PageNumber: 1,
PageSize: 1,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
PageNumber: 1,
PageSize: 1,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
cmd.Operator)
users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{
Limit: 1,
Offset: 0,
CompanyId: cmd.Operator.CompanyId,
OrganizationId: cmd.Operator.OrgId,
UserType: domain.UserTypeCooperation,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
var projectOverviewStatistics = map[string]interface{}{
"contractSum": contracts.Grid.Total,
"cooperationUserCount": users.Count,
"projectSum": projects.Total,
}
return map[string]interface{}{
"projectOverviewStatistics": projectOverviewStatistics,
"currentMonthDividendsStatistics": companyDividendsStatistics,
"cooperationModeStatistics": cooperationModeStatistics,
"CooperationGoodsStatistics": cooperationGoodsStatistics,
"cooperationGoodsStatistics": cooperationGoodsStatistics,
"cooperationModes": cooperationModes,
}, nil
}
... ...
package domain
import (
"encoding/base64"
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/util"
"log"
"time"
jwt "github.com/dgrijalva/jwt-go"
... ... @@ -48,15 +50,16 @@ func (qrmsg *QrcodeMessage) GenerateImageBase64() ([]byte, error) {
}
key := loginHost + str
encryptedData, err := util.AesEncrypt([]byte(key), aecSecret)
qrmsg.Token = base64.StdEncoding.EncodeToString(encryptedData)
//初始化数据
qrmsg.Token = string(encryptedData)
//qrmsg.Token = string(encryptedData)
qrmsg.IsLogin = false
// 输入日志
//decrypted,_:= util.AesDecrypt(encryptedData,aecSecret)
//if string(decrypted)==key{
// log.Println("token:",str,"\n encrypt:",key,"\n decrypt:",string(decrypted))
//}
decrypted, _ := util.AesDecrypt(encryptedData, aecSecret)
if string(decrypted) == key {
log.Println("token:", str, "\n encrypt:", key, "\n decrypt:", string(decrypted))
}
//qrCode, err := qr.Encode(str, qr.M, qr.Auto)
//if err != nil {
... ...
... ... @@ -12,7 +12,7 @@ type CooperationController struct {
}
/***** CooperationApplicationsService 共创申请服务 *****/
//SearchFeedback 承接人反馈CreditAccountSearch
//SearchFeedback 承接人反馈
func (controller *CooperationController) SearchFeedback() {
svr := service.UndertakerFeedbackService{}
cmd := &command.SearchFeedbackCommand{}
... ...
... ... @@ -11,7 +11,7 @@ func init() {
web.Router("/v1/user/company-orgs", &controllers.AuthController{}, "Post:GetCompanyOrgsByUser")
web.Router("/v1/user/user-info", &controllers.AuthController{}, "Post:GetUserInfo")
web.Router("/v1/user/user-info-extra", &controllers.AuthController{}, "Post:GetUserInfoExtra")
web.Router("/v1/user/favorite-menus", &controllers.AuthController{}, "Post:GetUserInfoExtra")
web.Router("/v1/user/user-menu", &controllers.AuthController{}, "Post:GetUserMenus")
web.Router("/v1/user/user-orgs", &controllers.AuthController{}, "Post:GetUserOrg")
... ...