切换导航条
此项目
正在载入...
登录
allied-creation
/
allied-creation-gateway
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
yangfu
3 years ago
提交
f90aff27d2183f48142b66ac6fe549edd0b9f84c
1 个父辈
c334c017
统计修改
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
82 行增加
和
0 行删除
pkg/application/mobile/cooperation/service/statistics_person.go
pkg/infrastructure/service_gateway/allied_creation_cooperation/module_cooperation_statistics.go
pkg/application/mobile/cooperation/service/statistics_person.go
查看文件 @
f90aff2
...
...
@@ -181,6 +181,86 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer
},
nil
}
// CompanyStatistics 共创用户-共创企业统计
func
(
srv
PersonStatisticsService
)
CompanyStatisticsV2
(
cmd
*
command
.
CooperationPersonStatisticsCommand
)
(
interface
{},
error
)
{
gateway
:=
allied_creation_cooperation
.
NewHttplibAlliedCreationCooperation
(
cmd
.
Operator
)
var
response
=
struct
{
OrgIds
[]
int
`json:"orgIds"`
}{}
err
:=
gateway
.
CooperationStatisticsWithObject
(
allied_creation_cooperation
.
PersonCooperationCompany
,
map
[
string
]
interface
{}{
"userBaseId"
:
cmd
.
Operator
.
UserBaseId
,
},
&
response
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
var
companyList
[]
int
=
response
.
OrgIds
if
len
(
companyList
)
==
0
{
return
map
[
string
]
interface
{}{
"list"
:
[]
struct
{}{},
},
nil
}
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
())
}
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
.
Company
`json:"company"`
}
var
cooperationCompanyStatisticsResponses
[]
cooperationCompanyStatisticsResponse
if
err
:=
json
.
UnmarshalFromString
(
json
.
MarshalToString
(
result
),
&
cooperationCompanyStatisticsResponses
);
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
var
values
=
make
([]
interface
{},
0
)
gatewayUser
:=
allied_creation_user
.
NewHttplibAlliedCreationUser
(
cmd
.
Operator
)
for
i
:=
range
companyList
{
for
j
:=
range
cooperationCompanyStatisticsResponses
{
if
cooperationCompanyStatisticsResponses
[
j
]
.
OrgId
==
int64
(
companyList
[
i
])
{
orgData
,
err
:=
gatewayUser
.
OrgGet
(
allied_creation_user
.
ReqOrgGet
{
OrgId
:
companyList
[
i
],
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
//orgData,err:= gatewayUser.CompanyGet(allied_creation_user.ReqCompanyGet{
// OrgId: companyList[i],
//})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
cooperationCompanyStatisticsResponses
[
j
]
.
Company
=
domain
.
Company
{
CompanyID
:
orgData
.
OrgID
,
CompanyName
:
orgData
.
OrgName
,
//Logo: user.Company.Logo,
}
values
=
append
(
values
,
cooperationCompanyStatisticsResponses
[
j
])
}
}
}
return
map
[
string
]
interface
{}{
"list"
:
values
,
},
nil
}
// CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目)
func
(
srv
PersonStatisticsService
)
CooperationProjectRecommend
(
projectQuery
*
command
.
ListCooperationProjectQuery
)
(
int64
,
interface
{},
error
)
{
if
projectQuery
.
Operator
.
UserBaseId
>
0
{
...
...
pkg/infrastructure/service_gateway/allied_creation_cooperation/module_cooperation_statistics.go
查看文件 @
f90aff2
...
...
@@ -43,6 +43,8 @@ const (
PersonCooperationProjectSharedInfo
=
"PersonCooperationProjectSharedInfo"
// 个人 - 共创项目共享信息数据 - 附件
PersonCooperationProjectSharedInfoAttachment
=
"PersonCooperationProjectSharedInfoAttachment"
// 个人 - 共创企业
PersonCooperationCompany
=
"PersonCooperationCompany"
// 账期结算单统计
CreditAccountStatistics
=
"CreditAccountStatistics"
...
...
请
注册
或
登录
后发表评论