作者 yangfu

分红明细列表修改

@@ -324,8 +324,6 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s @@ -324,8 +324,6 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s
324 var dividends = make([]interface{}, 0) 324 var dividends = make([]interface{}, 0)
325 for i := range creditAccounts { 325 for i := range creditAccounts {
326 a := creditAccounts[i] 326 a := creditAccounts[i]
327 -  
328 - participateType := a.DividendsParticipateType  
329 item := map[string]interface{}{ 327 item := map[string]interface{}{
330 "creditAccountId": a.DividendsEstimateId, 328 "creditAccountId": a.DividendsEstimateId,
331 "orderGoodName": "", 329 "orderGoodName": "",
@@ -336,8 +334,8 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s @@ -336,8 +334,8 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s
336 "userInfo": a.DividendsUser.UserInfo, 334 "userInfo": a.DividendsUser.UserInfo,
337 "userId": a.DividendsUser.UserId, 335 "userId": a.DividendsUser.UserId,
338 }, 336 },
339 - "dividendsParticipateType": participateType,  
340 - "dividendsAccountStatus": 0, //TODO:分红状态 337 + "dividendsParticipateType": a.DividendsParticipateType,
  338 + "dividendsAccountStatus": a.PaymentStatus,
341 "dividendsEstimateTime": a.CreatedAt.Unix() * 1000, 339 "dividendsEstimateTime": a.CreatedAt.Unix() * 1000,
342 "orderOrReturnedOrderNum": a.DividendsEstimateOrderNumber, 340 "orderOrReturnedOrderNum": a.DividendsEstimateOrderNumber,
343 } 341 }
@@ -470,7 +468,7 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m @@ -470,7 +468,7 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
470 UserId int64 `json:"userId"` 468 UserId int64 `json:"userId"`
471 469
472 UserBaseId int64 `json:"userBaseId"` 470 UserBaseId int64 `json:"userBaseId"`
473 - DividendsAccountStatus int32 `json:"dividendsAccountStatus"` // 分红结算状态 471 + DividendsAccountStatus int32 `json:"dividendsAccountStatus"` // 分红结算状态 未结算:1,已结算:2,已支付:3
474 Offset int64 `json:"offset"` 472 Offset int64 `json:"offset"`
475 Limit int64 `json:"limit"` 473 Limit int64 `json:"limit"`
476 }{} 474 }{}
@@ -478,7 +476,13 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m @@ -478,7 +476,13 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
478 return nil, err 476 return nil, err
479 } 477 }
480 queryOptions = tool_funs.SimpleStructToMap(&request) 478 queryOptions = tool_funs.SimpleStructToMap(&request)
481 - 479 + if request.DividendsAccountStatus == 2 {
  480 + queryOptions["paymentStatus"] = int32(1)
  481 + }
  482 + if request.DividendsAccountStatus == 3 {
  483 + queryOptions["dividendsAccountStatus"] = int32(2)
  484 + queryOptions["paymentStatus"] = int32(2)
  485 + }
482 var contractNumbers []string 486 var contractNumbers []string
483 var err error 487 var err error
484 if request.OrgId > 0 && request.UserId > 0 { 488 if request.OrgId > 0 && request.UserId > 0 {
@@ -535,7 +539,10 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m @@ -535,7 +539,10 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
535 DividendsType: item.DividendsType, 539 DividendsType: item.DividendsType,
536 DividendsUser: item.DividendsUser, 540 DividendsUser: item.DividendsUser,
537 } 541 }
538 - // TODO:优化查询 统一查询到map里面 542 + if item.PaymentStatus == 2 {
  543 + result.DividendsAccountStatus = 3
  544 + }
  545 + // TODO:优化查询 统一查询到map里面、或者冗余数据
539 if item.DividendsType == 1 { 546 if item.DividendsType == 1 {
540 order, err := dividendsOrderRepository.FindOne(map[string]interface{}{ 547 order, err := dividendsOrderRepository.FindOne(map[string]interface{}{
541 "dividendsOrderNumber": item.OrderOrReturnedOrderNum, 548 "dividendsOrderNumber": item.OrderOrReturnedOrderNum,
@@ -547,7 +554,10 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m @@ -547,7 +554,10 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
547 result.DividendsOrderAmount = order.DividendsOrderAmount 554 result.DividendsOrderAmount = order.DividendsOrderAmount
548 result.CustomerName = order.CustomerName 555 result.CustomerName = order.CustomerName
549 } else if item.DividendsType == 2 { 556 } else if item.DividendsType == 2 {
550 - order, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{"dividendsReturnedOrderNumber": item.OrderOrReturnedOrderNum, "orgId": request.OrgId}) 557 + order, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{
  558 + "dividendsReturnedOrderNumber": item.OrderOrReturnedOrderNum,
  559 + "orgId": request.OrgId,
  560 + })
551 if err != nil { 561 if err != nil {
552 return nil, err 562 return nil, err
553 } 563 }
@@ -331,6 +331,9 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte @@ -331,6 +331,9 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte
331 newOrgIds := utils.SliceItoa(orgIds.([]int64)) 331 newOrgIds := utils.SliceItoa(orgIds.([]int64))
332 query.Where("org->>'orgId' in (?)", pg.In(newOrgIds)) 332 query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
333 } 333 }
  334 + if paymentStatus, ok := queryOptions["paymentStatus"]; ok && paymentStatus.(int32) != 0 {
  335 + query.Where("payment_status = ?", paymentStatus)
  336 + }
334 offsetLimitFlag := true 337 offsetLimitFlag := true
335 if offsetLimit, ok := queryOptions["offsetLimit"]; ok { 338 if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
336 offsetLimitFlag = offsetLimit.(bool) 339 offsetLimitFlag = offsetLimit.(bool)