作者 陈志颖

fix:共创申请查询增加过取消滤参数

@@ -17,6 +17,8 @@ type SearchCooperationApplicationQuery struct { @@ -17,6 +17,8 @@ type SearchCooperationApplicationQuery struct {
17 ApplicantName string `cname:"申请人姓名" json:"applicantName,omitempty"` 17 ApplicantName string `cname:"申请人姓名" json:"applicantName,omitempty"`
18 // 共创申请审核状态,1待审核,2已同意,3已拒绝 18 // 共创申请审核状态,1待审核,2已同意,3已拒绝
19 CooperationApplicationStatus int32 `cname:"共创申请审核状态" json:"cooperationApplicationStatus,omitempty"` 19 CooperationApplicationStatus int32 `cname:"共创申请审核状态" json:"cooperationApplicationStatus,omitempty"`
  20 + // 是否被取消标记 1正常,2取消,3所有
  21 + IsCanceled int32 `cname:"取消状态" json:"isCanceled,omitempty"`
20 // 页面大小 22 // 页面大小
21 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` 23 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"`
22 // 页面大小 24 // 页面大小
@@ -26,7 +26,7 @@ type CooperationApplication struct { @@ -26,7 +26,7 @@ type CooperationApplication struct {
26 CooperationProject *CooperationProject `json:"cooperationProject"` 26 CooperationProject *CooperationProject `json:"cooperationProject"`
27 // 数据所属组织机构 27 // 数据所属组织机构
28 Org *Org `json:"org"` 28 Org *Org `json:"org"`
29 - // 是否被取消标志位 29 + // 是否被取消标志位 1未取消,2取消
30 IsCanceled int32 `json:"isCanceled"` 30 IsCanceled int32 `json:"isCanceled"`
31 // 公司 31 // 公司
32 Company *Company `json:"company"` 32 Company *Company `json:"company"`
@@ -50,6 +50,8 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -50,6 +50,8 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
50 for _, dividendsEstimate := range dividendsEstimates { 50 for _, dividendsEstimate := range dividendsEstimates {
51 // 根据当前分红预算单的分红订单号或退货单号获取分红预算单 51 // 根据当前分红预算单的分红订单号或退货单号获取分红预算单
52 if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{ 52 if countRelative, dividendsEstimatesRelative, err2 := dividendsEstimateRepository.Find(map[string]interface{}{
  53 + "companyId": dividendsEstimate.Company.CompanyId,
  54 + "orgId": dividendsEstimate.Org.OrgId,
53 "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum, 55 "orderOrReturnedOrderNum": dividendsEstimate.OrderOrReturnedOrderNum,
54 }); err2 != nil { 56 }); err2 != nil {
55 return nil, err2 57 return nil, err2
@@ -86,6 +88,8 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -86,6 +88,8 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
86 88
87 // 获取分红订单 89 // 获取分红订单
88 if countDividendsOrder, orders, err4 := dividendsOrderRepository.Find(map[string]interface{}{ 90 if countDividendsOrder, orders, err4 := dividendsOrderRepository.Find(map[string]interface{}{
  91 + "companyId": dividendsEstimates[0].Company.CompanyId,
  92 + "orgId": dividendsEstimates[0].Org.OrgId,
89 "dividendsOrderNumbers": orderNums, 93 "dividendsOrderNumbers": orderNums,
90 }); err4 != nil { 94 }); err4 != nil {
91 return nil, err4 95 return nil, err4
@@ -103,6 +107,8 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst @@ -103,6 +107,8 @@ func (domainService *CancelDividendsEstimateService) CancelEstimate(dividendsEst
103 107
104 // 获取分红退货单 108 // 获取分红退货单
105 if countDividendsReturnedOrder, returnedOrders, err5 := dividendsReturnedOrderRepository.Find(map[string]interface{}{ 109 if countDividendsReturnedOrder, returnedOrders, err5 := dividendsReturnedOrderRepository.Find(map[string]interface{}{
  110 + "companyId": dividendsEstimates[0].Company.CompanyId,
  111 + "orgId": dividendsEstimates[0].Org.OrgId,
106 "dividendsReturnedOrderNumbers": returnedOrderNums, 112 "dividendsReturnedOrderNumbers": returnedOrderNums,
107 }); err5 != nil { 113 }); err5 != nil {
108 return nil, err5 114 return nil, err5
@@ -248,6 +248,9 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string @@ -248,6 +248,9 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
248 if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 { 248 if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
249 query.Where(`(cooperation_application.cooperation_application_applicant->>'userBaseId' ='?')`, userBaseId) 249 query.Where(`(cooperation_application.cooperation_application_applicant->>'userBaseId' ='?')`, userBaseId)
250 } 250 }
  251 + if isCanceled, ok := queryOptions["isCanceled"]; ok && isCanceled.(int32) != 3 {
  252 + query.Where("is_canceled = ?", isCanceled)
  253 + }
251 if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { 254 if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
252 query.Where("company->>'companyId' = '?'", companyId) 255 query.Where("company->>'companyId' = '?'", companyId)
253 } 256 }
@@ -265,7 +268,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string @@ -265,7 +268,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
265 if offsetLimitFlag { 268 if offsetLimitFlag {
266 query.SetOffsetAndLimit(20) 269 query.SetOffsetAndLimit(20)
267 } 270 }
268 - query.Where("is_canceled = ?", 1) 271 +
269 query.SetOrderDirect("cooperation_application_id", "DESC") 272 query.SetOrderDirect("cooperation_application_id", "DESC")
270 if count, err := query.SelectAndCount(); err != nil { 273 if count, err := query.SelectAndCount(); err != nil {
271 return 0, cooperationApplications, err 274 return 0, cooperationApplications, err