...
|
...
|
@@ -73,9 +73,9 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC |
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
dividendStatistics := map[string]interface{}{
|
|
|
"dividendAmount": annualDividend.AnnualDividends.Total, // 分红金额
|
|
|
"paidAmount": annualDividend.AnnualDividends.Paid, // 已支付
|
|
|
"unPaidAmount": annualDividend.AnnualDividends.Accounting, // 未支付
|
|
|
"dividendAmount": annualDividend.AnnualDividends.Total, // 分红金额
|
|
|
"paidAmount": annualDividend.AnnualDividends.Paid, // 已支付
|
|
|
"unPaidAmount": annualDividend.AnnualDividends.Total - annualDividend.AnnualDividends.Paid, // 未支付
|
|
|
}
|
|
|
|
|
|
return map[string]interface{}{
|
...
|
...
|
@@ -98,19 +98,53 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
var companyList []int
|
|
|
for i := range users.Users {
|
|
|
user := users.Users[i]
|
|
|
companyList = append(companyList, user.Org.OrgId)
|
|
|
}
|
|
|
|
|
|
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
cmd.Operator)
|
|
|
result, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationCompanyStatistics, map[string]interface{}{
|
|
|
"userBaseId": cmd.Operator.UserBaseId,
|
|
|
"companyList": companyList,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
var values []interface{}
|
|
|
type cooperationCompanyStatisticsResponse struct {
|
|
|
// 当天统计的企业id
|
|
|
OrgId int64 `json:"orgId"`
|
|
|
// 共创项目数
|
|
|
CooperationProjectCount int64 `json:"cooperationProjectCount"`
|
|
|
// 共创合约数
|
|
|
CooperationContractCount int64 `json:"cooperationContractCount"`
|
|
|
// 分红占比
|
|
|
DividendsRatio float64 `json:"dividendsRatio"`
|
|
|
// 分红支出
|
|
|
DividendsIncome float64 `json:"dividendsIncome"`
|
|
|
// 企业信息
|
|
|
Company domain.CompanyData `json:"company"`
|
|
|
}
|
|
|
var cooperationCompanyStatisticsResponses []cooperationCompanyStatisticsResponse
|
|
|
if err := json.UnmarshalFromString(json.MarshalToString(result), &cooperationCompanyStatisticsResponses); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
if len(cooperationCompanyStatisticsResponses) != len(users.Users) {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不匹配")
|
|
|
}
|
|
|
|
|
|
var values = make([]interface{}, 0)
|
|
|
for i := range users.Users {
|
|
|
user := users.Users[i]
|
|
|
item := map[string]interface{}{
|
|
|
"company": user.Company,
|
|
|
"cooperationProjectCount": 0,
|
|
|
"cooperationContractCount": 0,
|
|
|
"dividendsRatio": 0,
|
|
|
"dividendsIncome": 0,
|
|
|
cooperationCompanyStatisticsResponses[i].Company = domain.CompanyData{
|
|
|
CompanyID: user.Org.OrgId,
|
|
|
CompanyName: user.Org.OrgName,
|
|
|
CompanyLogo: user.Company.Log,
|
|
|
}
|
|
|
values = append(values, item)
|
|
|
values = append(values, cooperationCompanyStatisticsResponses[i])
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"list": values,
|
...
|
...
|
|