切换导航条
此项目
正在载入...
登录
allied-creation
/
allied-creation-gateway
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
yangfu
3 years ago
提交
f7717f716386897487a17b1e02a838262aca637a
1 个父辈
f90aff27
个人端统计修改
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
106 行增加
和
9 行删除
pkg/application/mobile/cooperation/service/statistics_person.go
pkg/infrastructure/service_gateway/allied_creation_user/module_org.go
pkg/infrastructure/service_gateway/allied_creation_user/param_org.go
pkg/port/beego/controllers/mobile_client/cooperation_controller.go
pkg/application/mobile/cooperation/service/statistics_person.go
查看文件 @
f7717f7
...
...
@@ -98,6 +98,86 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC
},
nil
}
// IndexStatistics 个人端 - 首页统计 (入口页面统计数据)
func
(
srv
PersonStatisticsService
)
IndexStatisticsV2
(
cmd
*
command
.
IndexStatisticsCommand
)
(
interface
{},
error
)
{
gateway
:=
allied_creation_cooperation
.
NewHttplibAlliedCreationCooperation
(
cmd
.
Operator
)
// 1.项目概览统计
contractStatisticsResult
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
PersonCooperationContractStatistics
,
map
[
string
]
interface
{}{
"userBaseId"
:
cmd
.
Operator
.
UserBaseId
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
type
contractStatistics
struct
{
ContractSum
int
`json:"contractSum"`
ContractStoppedSum
int
`json:"contractStoppedSum"`
}
var
cs
=
&
contractStatistics
{}
if
err
:=
json
.
UnmarshalFromString
(
json
.
MarshalToString
(
contractStatisticsResult
),
cs
);
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
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
overview
=
map
[
string
]
interface
{}{
"contractSum"
:
cs
.
ContractSum
,
//总合约数
"contractStoppedSum"
:
cs
.
ContractStoppedSum
,
//停止的合约数
"companySum"
:
len
(
response
.
OrgIds
),
//共创企业数
}
year
,
month
,
_
:=
time
.
Now
()
.
Date
()
beginTime
:=
time
.
Date
(
year
,
month
,
1
,
0
,
0
,
0
,
0
,
time
.
Local
)
endTime
:=
beginTime
.
AddDate
(
0
,
1
,
0
)
// 2.本月分红统计 - 个人
unPaidResult
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
CreditAccountStatistics
,
map
[
string
]
interface
{}{
"userBaseId"
:
cmd
.
Operator
.
UserBaseId
,
"beginTime"
:
beginTime
,
"endTime"
:
endTime
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
type
AnnualDividend
struct
{
Total
float64
`json:"total"`
Accounting
float64
`json:"accounting"`
Accounted
float64
`json:"accounted"`
Paid
float64
`json:"paid"`
Unpaid
float64
`json:"unpaid"`
}
var
annualUnPaidDividend
=
&
AnnualDividend
{}
if
err
:=
json
.
UnmarshalFromString
(
json
.
MarshalToString
(
unPaidResult
),
annualUnPaidDividend
);
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
// 2.本月分红统计 - 个人
paymentResult
,
err
:=
gateway
.
CooperationStatistics
(
allied_creation_cooperation
.
CreditAccountStatistics
,
map
[
string
]
interface
{}{
"userBaseId"
:
cmd
.
Operator
.
UserBaseId
,
"paymentBeginTime"
:
beginTime
,
"paymentEndTime"
:
endTime
,
})
var
annualPaymentDividend
=
&
AnnualDividend
{}
if
err
:=
json
.
UnmarshalFromString
(
json
.
MarshalToString
(
paymentResult
),
annualPaymentDividend
);
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
err
.
Error
())
}
dividendStatistics
:=
map
[
string
]
interface
{}{
"dividendAmount"
:
annualPaymentDividend
.
Paid
+
annualUnPaidDividend
.
Unpaid
,
// 分红金额 annualDividend.Total
"paidAmount"
:
annualPaymentDividend
.
Paid
,
// 已支付
"unPaidAmount"
:
annualUnPaidDividend
.
Unpaid
,
// 未支付
}
return
map
[
string
]
interface
{}{
"overview"
:
overview
,
"dividendStatistics"
:
dividendStatistics
,
},
nil
}
// CompanyStatistics 共创用户-共创企业统计
func
(
srv
PersonStatisticsService
)
CompanyStatistics
(
cmd
*
command
.
CooperationPersonStatisticsCommand
)
(
interface
{},
error
)
{
...
...
@@ -234,21 +314,20 @@ func (srv PersonStatisticsService) CompanyStatisticsV2(cmd *command.CooperationP
for
j
:=
range
cooperationCompanyStatisticsResponses
{
if
cooperationCompanyStatisticsResponses
[
j
]
.
OrgId
==
int64
(
companyList
[
i
])
{
orgData
,
err
:=
gatewayUser
.
OrgGet
(
allied_creation_user
.
ReqOrgGet
{
OrgId
:
companyList
[
i
],
OrgId
:
companyList
[
i
],
FetchFlag
:
1
,
})
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
())
var
companyLog
string
if
orgData
.
Company
!=
nil
{
companyLog
=
orgData
.
Company
.
Logo
}
cooperationCompanyStatisticsResponses
[
j
]
.
Company
=
domain
.
Company
{
CompanyID
:
orgData
.
OrgID
,
CompanyName
:
orgData
.
OrgName
,
//Logo: user.Company.Logo
,
Logo
:
companyLog
,
}
values
=
append
(
values
,
cooperationCompanyStatisticsResponses
[
j
])
}
...
...
pkg/infrastructure/service_gateway/allied_creation_user/module_org.go
查看文件 @
f7717f7
...
...
@@ -167,6 +167,9 @@ func (gateway HttplibAlliedCreationUser) OrgEnable(param ReqOrgEnable) (*DataOrg
// Org[orgId} 返回组织
func
(
gateway
HttplibAlliedCreationUser
)
OrgGet
(
param
ReqOrgGet
)
(
*
DataOrgGet
,
error
)
{
url
:=
gateway
.
baseUrL
+
"/org/"
+
strconv
.
Itoa
(
param
.
OrgId
)
if
param
.
FetchFlag
>
0
{
url
+=
fmt
.
Sprintf
(
"?fetchFlag=%v"
,
param
.
FetchFlag
)
}
method
:=
"get"
req
:=
gateway
.
CreateRequest
(
url
,
method
)
log
.
Logger
.
Debug
(
"向用户模块请求数据:返回组织。"
,
map
[
string
]
interface
{}{
...
...
pkg/infrastructure/service_gateway/allied_creation_user/param_org.go
查看文件 @
f7717f7
package
allied_creation_user
import
"time"
//创建组织
type
(
ReqOrgCreate
struct
{
...
...
@@ -84,6 +86,8 @@ type (
type
(
ReqOrgGet
struct
{
OrgId
int
`json:"orgId"`
// 获取标记 bit 0:获取企业数据
FetchFlag
int
`json:"fetchFlag"`
}
DataOrgGet
struct
{
...
...
@@ -103,6 +107,17 @@ type (
ParentID
int
`json:"parentId"`
ParentPath
string
`json:"parentPath"`
//} `json:"org"`
Company
*
struct
{
CompanyId
int
`json:"companyId"`
CompanyName
string
`json:"companyName"`
Scale
string
`json:"scale"`
IndustryCategory
string
`json:"industryCategory"`
RegisteredTime
time
.
Time
`json:"registeredTime"`
Status
int64
`json:"status"`
Logo
string
`json:"logo"`
Address
string
`json:"address"`
SystemName
string
`json:"systemName"`
}
`json:"company,omitempty"`
}
)
...
...
pkg/port/beego/controllers/mobile_client/cooperation_controller.go
查看文件 @
f7717f7
...
...
@@ -601,7 +601,7 @@ func (controller *CooperationController) PersonIndexStatistics() {
return
}
cmd
.
Operator
=
controller
.
GetOperator
()
data
,
err
:=
svr
.
IndexStatistics
(
cmd
)
data
,
err
:=
svr
.
IndexStatistics
V2
(
cmd
)
controller
.
Response
(
data
,
err
)
}
...
...
@@ -614,7 +614,7 @@ func (controller *CooperationController) PersonCompanyStatistics() {
return
}
cmd
.
Operator
=
controller
.
GetOperator
()
data
,
err
:=
svr
.
CompanyStatistics
(
cmd
)
data
,
err
:=
svr
.
CompanyStatistics
V2
(
cmd
)
controller
.
Response
(
data
,
err
)
}
...
...
请
注册
或
登录
后发表评论