...
|
...
|
@@ -29,6 +29,9 @@ const ( |
|
|
CompanyDividendsStatistics = "CompanyDividendsStatistics"
|
|
|
// 企业、个人 - 分红预算列表
|
|
|
SearchDividendsEstimates = "SearchDividendsEstimates"
|
|
|
|
|
|
// 个人 - 共创企业统计
|
|
|
CooperationCompanyStatistics = "CooperationCompanyStatistics"
|
|
|
)
|
|
|
|
|
|
// CooperationStatisticsService 共创统计服务
|
...
|
...
|
@@ -54,6 +57,20 @@ func NewCooperationStatisticsService(transactionContext *pgTransaction.Transacti |
|
|
//
|
|
|
// queryOptions 查询参数
|
|
|
func (ptr *CooperationStatisticsService) SearchContractDividends(queryOptions map[string]interface{}) (interface{}, error) {
|
|
|
var request = struct {
|
|
|
//企业
|
|
|
CompanyId int64 `json:"companyId"`
|
|
|
OrgId int64 `json:"orgId"`
|
|
|
//个人
|
|
|
UserBaseId int64 `json:"userBaseId"`
|
|
|
Offset int `json:"offset"`
|
|
|
Limit int `json:"limit"`
|
|
|
}{}
|
|
|
if err := LoadQueryObject(queryOptions, &request); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
queryOptions = tool_funs.SimpleStructToMap(&request)
|
|
|
|
|
|
// 1.根据个人、企业查询合约列表
|
|
|
var contracts []*domain.CooperationContract
|
|
|
var err error
|
...
|
...
|
@@ -115,7 +132,6 @@ func (ptr *CooperationStatisticsService) getUserContracts(queryOptions map[strin |
|
|
}
|
|
|
queryOptions["inCooperationContractNumber"] = numbers
|
|
|
contractRepository, _ := repository.NewCooperationContractRepository(ptr.transactionContext)
|
|
|
// TODO: 参数查询条件
|
|
|
_, contracts, err := contractRepository.Find(queryOptions)
|
|
|
return contracts, err
|
|
|
}
|
...
|
...
|
@@ -203,22 +219,27 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s |
|
|
var dividends = make([]interface{}, 0)
|
|
|
for i := range creditAccounts {
|
|
|
a := creditAccounts[i]
|
|
|
participateType, _ := strconv.Atoi(a.ParticipateType)
|
|
|
dividends = append(dividends, map[string]interface{}{
|
|
|
"creditAccountId": a.CreditAccountId,
|
|
|
"orderGoodName": "",
|
|
|
//"dividendsType": a.AccountDetail.DividendsType,
|
|
|
"dividendsRatio": 0,
|
|
|
//"dividendsAmount": a.AccountDetail.DividendsAmount,
|
|
|
"dividendsUser": map[string]interface{}{
|
|
|
"userInfo": a.Participator.UserInfo,
|
|
|
"userId": a.Participator.UserId,
|
|
|
},
|
|
|
"dividendsParticipateType": participateType,
|
|
|
"dividendsAccountStatus": a.PaymentStatus,
|
|
|
"dividendsEstimateTime": a.CreatedAt.Unix() * 1000,
|
|
|
"orderOrReturnedOrderNum": a.CreditAccountOrderNum,
|
|
|
})
|
|
|
for j := range a.AccountDetail {
|
|
|
participateType, _ := strconv.Atoi(a.ParticipateType)
|
|
|
item := map[string]interface{}{
|
|
|
"creditAccountId": a.CreditAccountId,
|
|
|
"orderGoodName": "",
|
|
|
"dividendsType": 0,
|
|
|
"dividendsRatio": 0,
|
|
|
"dividendsAmount": a.AccountDetail[j].DividendsAmount,
|
|
|
"dividendsUser": map[string]interface{}{
|
|
|
"userInfo": a.Participator.UserInfo,
|
|
|
"userId": a.Participator.UserId,
|
|
|
},
|
|
|
"dividendsParticipateType": participateType,
|
|
|
"dividendsAccountStatus": a.PaymentStatus,
|
|
|
"dividendsEstimateTime": a.CreatedAt.Unix() * 1000,
|
|
|
"orderOrReturnedOrderNum": a.CreditAccountOrderNum,
|
|
|
}
|
|
|
item["dividendsType"] = a.AccountDetail[j].DividendsType
|
|
|
dividends = append(dividends, item)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
res["dividends"] = dividends
|
|
|
return res, nil
|
...
|
...
|
|