作者 yangfu

个人统计修改

... ... @@ -613,9 +613,9 @@ func (svr AuthService) GetCompanyOrgsByUser(queryParam *query.GetCompanyOrgsByUs
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(queryParam.Operator)
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
UserBaseId: queryParam.Operator.UserBaseId,
//Phone: queryParam.Phone,
UserType: domain.UserTypeEmployee,
UserBaseId: queryParam.Operator.UserBaseId,
UserType: domain.UserTypeEmployee,
PullRealTime: true,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -15,7 +15,7 @@ type SearchDividendContractsCommand struct {
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
//审核状态
OrgId int64 `json:"orgId,omitempty"`
OrgId int64 `json:"companyId,omitempty"`
//审核状态
UserBaseId int64 `json:"userBaseId,omitempty"`
}
... ...
... ... @@ -23,12 +23,6 @@ func (srv CompanyStatisticsService) GetDividendContracts(cmd *command.GetDividen
// GetDividendContracts 企业的合约列表(分红信息按合约划分)
func (srv CompanyStatisticsService) SearchDividendContracts(cmd *command.SearchDividendContractsCommand) (int64, interface{}, error) {
//var items []*dto.CompanyContractDividendDto
//for i := 0; i < 2; i++ {
// item := dto.NewCompanyContractDividendDto()
// item.LoadDto()
// items = append(items, item)
//}
cmd.OrgId = cmd.Operator.OrgId
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
... ...
... ... @@ -14,7 +14,9 @@ type PersonDividendsService struct {
func (srv PersonDividendsService) GetDividendContracts(cmd *command.GetDividendContractsCommand) (interface{}, error) {
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.GetContractDividends, cmd)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.GetContractDividends, map[string]interface{}{
"contractId": cmd.ContractId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ... @@ -23,10 +25,15 @@ func (srv PersonDividendsService) GetDividendContracts(cmd *command.GetDividendC
// GetDividendContracts 企业的合约列表(分红信息按合约划分)
func (srv PersonDividendsService) SearchDividendContracts(cmd *command.SearchDividendContractsCommand) (int64, interface{}, error) {
cmd.OrgId = cmd.Operator.OrgId
cmd.UserBaseId = cmd.Operator.UserBaseId
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cmd.Operator)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchContractDividends, cmd)
result, err := gateway.CooperationStatistics(allied_creation_cooperation.SearchContractDividends, map[string]interface{}{
"orgId": cmd.OrgId,
"userBaseId": cmd.UserBaseId,
"limit": cmd.PageSize,
"offset": cmd.PageNumber * cmd.PageSize,
})
if err != nil {
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ...
... ... @@ -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,
... ...
... ... @@ -24,6 +24,9 @@ const (
CompanyDividendsStatistics = "CompanyDividendsStatistics"
// 企业、个人 - 分红预算列表
SearchDividendsEstimates = "SearchDividendsEstimates"
// 个人 - 共创企业统计
CooperationCompanyStatistics = "CooperationCompanyStatistics"
)
// CooperationStatistics 共创统计
... ...