作者 yangfu

直方图统计

@@ -138,18 +138,9 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre @@ -138,18 +138,9 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre
138 138
139 // PaymentHistoryHistogramStatistics 支付历史统计-直方图 139 // PaymentHistoryHistogramStatistics 支付历史统计-直方图
140 func (srv CompanyCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { 140 func (srv CompanyCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
141 - //return map[string]interface{}{  
142 - // "xAxis": map[string]interface{}{  
143 - // "data": []string{"7-5", "7-15", "7-25"},  
144 - // },  
145 - // "yAxis": struct{}{},  
146 - // "source": map[string]interface{}{  
147 - // "value": []float64{60, 80, 90},  
148 - // },  
149 - //}, nil  
150 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 141 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
151 cmd.Operator) 142 cmd.Operator)
152 - paymentHistoryHistogramStatistics, err := gateway.CreditAccountStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{ 143 + paymentHistoryHistogramStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{
153 "orgId": cmd.Operator.OrgId, 144 "orgId": cmd.Operator.OrgId,
154 }) 145 })
155 if err != nil { 146 if err != nil {
@@ -67,18 +67,9 @@ func (srv PersonCreditAccountService) PaymentHistoryStatistics(cmd *command.Cred @@ -67,18 +67,9 @@ func (srv PersonCreditAccountService) PaymentHistoryStatistics(cmd *command.Cred
67 67
68 // PaymentHistoryHistogramStatistics 支付历史统计-直方图 68 // PaymentHistoryHistogramStatistics 支付历史统计-直方图
69 func (srv PersonCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) { 69 func (srv PersonCreditAccountService) PaymentHistoryHistogramStatistics(cmd *command.CreditAccountPaySearchCommand) (interface{}, error) {
70 - //return map[string]interface{}{  
71 - // "xAxis": map[string]interface{}{  
72 - // "data": []string{"7-5", "7-15", "7-25"},  
73 - // },  
74 - // "yAxis": struct{}{},  
75 - // "source": map[string]interface{}{  
76 - // "value": []float64{60, 80, 90},  
77 - // },  
78 - //}, nil  
79 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 70 gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
80 cmd.Operator) 71 cmd.Operator)
81 - paymentHistoryHistogramStatistics, err := gateway.CreditAccountStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{ 72 + paymentHistoryHistogramStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PaymentHistoryHistogramStatistics, map[string]interface{}{
82 "userBaseId": cmd.Operator.UserBaseId, 73 "userBaseId": cmd.Operator.UserBaseId,
83 }) 74 })
84 if err != nil { 75 if err != nil {
@@ -43,26 +43,38 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics @@ -43,26 +43,38 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics
43 } 43 }
44 44
45 // 模式列表 45 // 模式列表
46 - models, err := gateway.CooperationModeList(allied_creation_cooperation.ReqCooperationModeList{  
47 - PageSize: 20,  
48 - PageNumber: 1,  
49 - CompanyId: cmd.Operator.CompanyId,  
50 - OrgId: cmd.Operator.OrgId,  
51 - UserId: cmd.Operator.UserId,  
52 - UserBaseId: cmd.Operator.UserBaseId,  
53 - }) 46 + var modeStatistics []CooperationModeStatistics
  47 + var modeNumbers []string
  48 + err = json.UnmarshalFromString(json.MarshalToString(cooperationModeStatistics), &modeStatistics)
54 if err != nil { 49 if err != nil {
55 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 50 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
56 } 51 }
57 - var cooperationModes []interface{}  
58 - for i := range models.List {  
59 - item := models.List[i]  
60 - cooperationModes = append(cooperationModes, map[string]interface{}{  
61 - "cooperationModeId": item.CooperationModeId,  
62 - "cooperationModeName": item.CooperationModeName,  
63 - "cooperationModeNumber": item.CooperationModeNumber, 52 + for i := range modeStatistics {
  53 + modeNumbers = append(modeNumbers, modeStatistics[i].CooperationModeNumber)
  54 + }
  55 +
  56 + var cooperationModes = make([]interface{}, 0)
  57 + if len(modeNumbers) > 0 {
  58 + models, err := gateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{
  59 + PageSize: 20,
  60 + PageNumber: 1,
  61 + //CompanyId: cmd.Operator.CompanyId,
  62 + //OrgId: cmd.Operator.OrgId,
  63 + CooperationModeNumbers: modeNumbers,
64 }) 64 })
  65 + if err != nil {
  66 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  67 + }
  68 + for i := range models.List {
  69 + item := models.List[i]
  70 + cooperationModes = append(cooperationModes, map[string]interface{}{
  71 + "cooperationModeId": item.CooperationModeId,
  72 + "cooperationModeName": item.CooperationModeName,
  73 + "cooperationModeNumber": item.CooperationModeNumber,
  74 + })
  75 + }
65 } 76 }
  77 +
66 // 项目概览统计 78 // 项目概览统计
67 contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{ 79 contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
68 PageNumber: 1, 80 PageNumber: 1,
@@ -184,3 +196,16 @@ func (srv CompanyStatisticsService) CooperationPersonStatistics(cmd *command.Coo @@ -184,3 +196,16 @@ func (srv CompanyStatisticsService) CooperationPersonStatistics(cmd *command.Coo
184 "cooperationPersonStatistics": response, 196 "cooperationPersonStatistics": response,
185 }, nil 197 }, nil
186 } 198 }
  199 +
  200 +type CooperationModeStatistics struct {
  201 + // 共创人数
  202 + CooperationPeople float64 `json:"cooperationPeople"`
  203 + // 分红预算
  204 + DividendsEstimate string `json:"dividendsEstimate"`
  205 + // 订单金额
  206 + OrderAmount float64 `json:"orderAmount"`
  207 + // 共创模式编号
  208 + CooperationModeNumber string `json:"cooperationModeNumber"`
  209 + // 结算金额
  210 + SettlementAmount float64 `json:"settlementAmount"`
  211 +}
@@ -46,6 +46,8 @@ type ( @@ -46,6 +46,8 @@ type (
46 OrgId int64 `json:"orgId"` 46 OrgId int64 `json:"orgId"`
47 UserId int64 `json:"userId"` 47 UserId int64 `json:"userId"`
48 UserBaseId int64 `json:"userBaseId"` 48 UserBaseId int64 `json:"userBaseId"`
  49 + //模式编码列表
  50 + CooperationModeNumbers []string `cname:"模式编码列表" json:"cooperationModeNumbers,omitempty"`
49 } 51 }
50 52
51 DataCooperationModeList struct { 53 DataCooperationModeList struct {
@@ -163,6 +165,8 @@ type ( @@ -163,6 +165,8 @@ type (
163 OrgId int64 `json:"orgId"` 165 OrgId int64 `json:"orgId"`
164 UserId int64 `json:"userId"` 166 UserId int64 `json:"userId"`
165 UserBaseId int64 `json:"userBaseId"` 167 UserBaseId int64 `json:"userBaseId"`
  168 + //模式编码列表
  169 + CooperationModeNumbers []string `cname:"模式编码列表" json:"cooperationModeNumbers,omitempty"`
166 } 170 }
167 171
168 DataCooperationModesSearch struct { 172 DataCooperationModesSearch struct {