作者 yangfu

统计修改

@@ -67,6 +67,8 @@ func (svr *CooperationStatisticsService) CooperationContractStatistics(contractS @@ -67,6 +67,8 @@ func (svr *CooperationStatisticsService) CooperationContractStatistics(contractS
67 res, err = statisticsService.PersonCooperationProjectSharedInfo(contractStatisticsQuery.QueryOptions) 67 res, err = statisticsService.PersonCooperationProjectSharedInfo(contractStatisticsQuery.QueryOptions)
68 case domain_service.PersonCooperationProjectSharedInfoAttachment: 68 case domain_service.PersonCooperationProjectSharedInfoAttachment:
69 res, err = statisticsService.PersonCooperationProjectSharedInfoAttachment(contractStatisticsQuery.QueryOptions) 69 res, err = statisticsService.PersonCooperationProjectSharedInfoAttachment(contractStatisticsQuery.QueryOptions)
  70 + case domain_service.PersonCooperationCompany:
  71 + res, err = statisticsService.PersonCooperationCompany(contractStatisticsQuery.QueryOptions)
70 case domain_service.CreditAccountStatistics: 72 case domain_service.CreditAccountStatistics:
71 res, err = statisticsService.CreditAccountStatistics(contractStatisticsQuery.QueryOptions) 73 res, err = statisticsService.CreditAccountStatistics(contractStatisticsQuery.QueryOptions)
72 case domain_service.RelevantCooperationContractNumbers: 74 case domain_service.RelevantCooperationContractNumbers:
@@ -531,3 +531,42 @@ func (ptr *CooperationStatisticsService) PersonCooperationProjectSharedInfoAttac @@ -531,3 +531,42 @@ func (ptr *CooperationStatisticsService) PersonCooperationProjectSharedInfoAttac
531 531
532 return response, nil 532 return response, nil
533 } 533 }
  534 +
  535 +// 个人 - 共创企业
  536 +func (ptr *CooperationStatisticsService) PersonCooperationCompany(queryOptions map[string]interface{}) (interface{}, error) {
  537 + // 参数验证
  538 + var request = struct {
  539 + UserBaseId int64 `json:"userBaseId"`
  540 + }{}
  541 + if err := LoadQueryObject(queryOptions, &request); err != nil {
  542 + return nil, err
  543 + }
  544 + var response = struct {
  545 + OrgIds []int64 `json:"orgIds"`
  546 + }{
  547 + OrgIds: make([]int64, 0),
  548 + }
  549 + undertakerDao, _ := dao.NewCooperationContractUndertakerDao(ptr.transactionContext)
  550 + _, undertakers, _ := undertakerDao.Find(map[string]interface{}{"userBaseId": request.UserBaseId, "offsetLimit": false})
  551 + contractIds := make([]int64, 0)
  552 + if len(undertakers) == 0 {
  553 + return response, nil
  554 + }
  555 + for i := range undertakers {
  556 + contractIds = append(contractIds, undertakers[i].CooperationContractId)
  557 + }
  558 + var mapOrg = make(map[int64]int64)
  559 + contractDao, _ := dao.NewCooperationContractDao(ptr.transactionContext)
  560 + _, contracts, err := contractDao.Find(map[string]interface{}{"cooperationContractIds": contractIds})
  561 + if err != nil {
  562 + return nil, err
  563 + }
  564 + for i := range contracts {
  565 + orgId := contracts[i].Org.OrgId
  566 + if _, ok := mapOrg[orgId]; !ok {
  567 + response.OrgIds = append(response.OrgIds, orgId)
  568 + mapOrg[orgId] = orgId
  569 + }
  570 + }
  571 + return response, nil
  572 +}
@@ -47,6 +47,8 @@ const ( @@ -47,6 +47,8 @@ const (
47 PersonCooperationProjectSharedInfo = "PersonCooperationProjectSharedInfo" 47 PersonCooperationProjectSharedInfo = "PersonCooperationProjectSharedInfo"
48 // 个人 - 共创项目共享信息数据 - 附件 48 // 个人 - 共创项目共享信息数据 - 附件
49 PersonCooperationProjectSharedInfoAttachment = "PersonCooperationProjectSharedInfoAttachment" 49 PersonCooperationProjectSharedInfoAttachment = "PersonCooperationProjectSharedInfoAttachment"
  50 + // 个人 - 共创企业
  51 + PersonCooperationCompany = "PersonCooperationCompany"
50 52
51 // 账期结算单统计 53 // 账期结算单统计
52 CreditAccountStatistics = "CreditAccountStatistics" 54 CreditAccountStatistics = "CreditAccountStatistics"