作者 陈志颖

fix:分红预算增加项目有无判断

@@ -8,6 +8,19 @@ import ( @@ -8,6 +8,19 @@ import (
8 "github.com/beego/beego/v2/core/validation" 8 "github.com/beego/beego/v2/core/validation"
9 ) 9 )
10 10
  11 +type SearchCooperationProjectExtQuery struct {
  12 + // 公司ID,通过集成REST上下文获取
  13 + ExtCompanyId int64 `cname:"公司ID" json:"extCompanyId,omitempty"`
  14 + // 组织机构ID
  15 + ExtOrgId int64 `cname:"组织机构ID" json:"extOrgId,omitempty"`
  16 + // 关联的组织机构ID列表
  17 + ExtOrgIds []int64 `cname:"关联的组织机构ID列表" json:"extOrgIds,omitempty"`
  18 + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
  19 + ExtUserId int64 `cname:"用户ID" json:"extUserId,omitempty"`
  20 + // 用户基础数据id
  21 + ExtUserBaseId int64 `cname:"用户基础数据ID" json:"extUserBaseId,omitempty"`
  22 +}
  23 +
11 type SearchCooperationProjectQuery struct { 24 type SearchCooperationProjectQuery struct {
12 // 页面大小 25 // 页面大小
13 PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"` 26 PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"`
@@ -35,6 +48,8 @@ type SearchCooperationProjectQuery struct { @@ -35,6 +48,8 @@ type SearchCooperationProjectQuery struct {
35 UserId int64 `cname:"用户ID" json:"userId"` 48 UserId int64 `cname:"用户ID" json:"userId"`
36 // 用户基础数据id 49 // 用户基础数据id
37 UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` 50 UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
  51 + // 额外的查询条件
  52 + SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"`
38 } 53 }
39 54
40 func (searchCooperationProjectQuery *SearchCooperationProjectQuery) Valid(validation *validation.Validation) { 55 func (searchCooperationProjectQuery *SearchCooperationProjectQuery) Valid(validation *validation.Validation) {
@@ -124,48 +124,48 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo @@ -124,48 +124,48 @@ func (domainService *ConfirmDividendsIncentivesEstimateService) Confirm(orderGoo
124 } 124 }
125 125
126 // 获取共创项目 126 // 获取共创项目
127 - cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{  
128 - "cooperationProjectNumber": cooperationContract.CooperationProjectNumber,  
129 - "companyId": cooperationContract.Company.CompanyId,  
130 - "orgId": cooperationContract.Org.OrgId,  
131 - //"notPause": true,  
132 - })  
133 - if err != nil {  
134 - var orderNumber string  
135 - if orderGood.DividendsOrderNumber != "" {  
136 - orderNumber = orderGood.DividendsOrderNumber  
137 - } else {  
138 - orderNumber = orderGood.DividendsReturnedOrderNumber  
139 - }  
140 - dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{  
141 - DividendsUser: nil,  
142 - DividendsParticipateType: 0,  
143 - DividendsStage: 0,  
144 - DividendsAmount: 0,  
145 - OrderOrReturnedOrderNumber: orderNumber,  
146 - IsSuccessfully: false,  
147 - Reason: "共创项目" + orderGood.CooperationContractNumber + "查询错误", 127 + if cooperationContract.CooperationProjectNumber != "" {
  128 + cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{
  129 + "cooperationProjectNumber": cooperationContract.CooperationProjectNumber,
  130 + "companyId": cooperationContract.Company.CompanyId,
  131 + "orgId": cooperationContract.Org.OrgId,
148 }) 132 })
149 - continue  
150 - //return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
151 - }  
152 - if cooperationProject == nil {  
153 - var orderNumber string  
154 - if orderGood.DividendsOrderNumber != "" {  
155 - orderNumber = orderGood.DividendsOrderNumber  
156 - } else {  
157 - orderNumber = orderGood.DividendsReturnedOrderNumber 133 + if err != nil {
  134 + var orderNumber string
  135 + if orderGood.DividendsOrderNumber != "" {
  136 + orderNumber = orderGood.DividendsOrderNumber
  137 + } else {
  138 + orderNumber = orderGood.DividendsReturnedOrderNumber
  139 + }
  140 + dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
  141 + DividendsUser: nil,
  142 + DividendsParticipateType: 0,
  143 + DividendsStage: 0,
  144 + DividendsAmount: 0,
  145 + OrderOrReturnedOrderNumber: orderNumber,
  146 + IsSuccessfully: false,
  147 + Reason: "共创项目" + cooperationContract.CooperationProjectNumber + "查询错误",
  148 + })
  149 + continue
  150 + }
  151 + if cooperationProject == nil {
  152 + var orderNumber string
  153 + if orderGood.DividendsOrderNumber != "" {
  154 + orderNumber = orderGood.DividendsOrderNumber
  155 + } else {
  156 + orderNumber = orderGood.DividendsReturnedOrderNumber
  157 + }
  158 + dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{
  159 + DividendsUser: nil,
  160 + DividendsParticipateType: 0,
  161 + DividendsStage: 0,
  162 + DividendsAmount: 0,
  163 + OrderOrReturnedOrderNumber: orderNumber,
  164 + IsSuccessfully: false,
  165 + Reason: "共创项目" + cooperationContract.CooperationProjectNumber + "已结束或不存在",
  166 + })
  167 + continue
158 } 168 }
159 - dividendsEstimateDetails = append(dividendsEstimateDetails, &service.DividendsEstimateDetail{  
160 - DividendsUser: nil,  
161 - DividendsParticipateType: 0,  
162 - DividendsStage: 0,  
163 - DividendsAmount: 0,  
164 - OrderOrReturnedOrderNumber: orderNumber,  
165 - IsSuccessfully: false,  
166 - Reason: "共创项目" + orderGood.CooperationContractNumber + "已结束或不存在",  
167 - })  
168 - continue  
169 } 169 }
170 170
171 if orderGood.DividendsOrderNumber != "" { // 获取分红订单 171 if orderGood.DividendsOrderNumber != "" { // 获取分红订单