作者 yangfu

统计修改

... ... @@ -67,6 +67,8 @@ func (svr *CooperationStatisticsService) CooperationContractStatistics(contractS
res, err = statisticsService.PersonCooperationProjectSharedInfo(contractStatisticsQuery.QueryOptions)
case domain_service.PersonCooperationProjectSharedInfoAttachment:
res, err = statisticsService.PersonCooperationProjectSharedInfoAttachment(contractStatisticsQuery.QueryOptions)
case domain_service.PersonCooperationCompany:
res, err = statisticsService.PersonCooperationCompany(contractStatisticsQuery.QueryOptions)
case domain_service.CreditAccountStatistics:
res, err = statisticsService.CreditAccountStatistics(contractStatisticsQuery.QueryOptions)
case domain_service.RelevantCooperationContractNumbers:
... ...
... ... @@ -531,3 +531,42 @@ func (ptr *CooperationStatisticsService) PersonCooperationProjectSharedInfoAttac
return response, nil
}
// 个人 - 共创企业
func (ptr *CooperationStatisticsService) PersonCooperationCompany(queryOptions map[string]interface{}) (interface{}, error) {
// 参数验证
var request = struct {
UserBaseId int64 `json:"userBaseId"`
}{}
if err := LoadQueryObject(queryOptions, &request); err != nil {
return nil, err
}
var response = struct {
OrgIds []int64 `json:"orgIds"`
}{
OrgIds: make([]int64, 0),
}
undertakerDao, _ := dao.NewCooperationContractUndertakerDao(ptr.transactionContext)
_, undertakers, _ := undertakerDao.Find(map[string]interface{}{"userBaseId": request.UserBaseId, "offsetLimit": false})
contractIds := make([]int64, 0)
if len(undertakers) == 0 {
return response, nil
}
for i := range undertakers {
contractIds = append(contractIds, undertakers[i].CooperationContractId)
}
var mapOrg = make(map[int64]int64)
contractDao, _ := dao.NewCooperationContractDao(ptr.transactionContext)
_, contracts, err := contractDao.Find(map[string]interface{}{"cooperationContractIds": contractIds})
if err != nil {
return nil, err
}
for i := range contracts {
orgId := contracts[i].Org.OrgId
if _, ok := mapOrg[orgId]; !ok {
response.OrgIds = append(response.OrgIds, orgId)
mapOrg[orgId] = orgId
}
}
return response, nil
}
... ...
... ... @@ -47,6 +47,8 @@ const (
PersonCooperationProjectSharedInfo = "PersonCooperationProjectSharedInfo"
// 个人 - 共创项目共享信息数据 - 附件
PersonCooperationProjectSharedInfoAttachment = "PersonCooperationProjectSharedInfoAttachment"
// 个人 - 共创企业
PersonCooperationCompany = "PersonCooperationCompany"
// 账期结算单统计
CreditAccountStatistics = "CreditAccountStatistics"
... ...