作者 yangfu

分红明细列表修改

... ... @@ -324,8 +324,6 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s
var dividends = make([]interface{}, 0)
for i := range creditAccounts {
a := creditAccounts[i]
participateType := a.DividendsParticipateType
item := map[string]interface{}{
"creditAccountId": a.DividendsEstimateId,
"orderGoodName": "",
... ... @@ -336,8 +334,8 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s
"userInfo": a.DividendsUser.UserInfo,
"userId": a.DividendsUser.UserId,
},
"dividendsParticipateType": participateType,
"dividendsAccountStatus": 0, //TODO:分红状态
"dividendsParticipateType": a.DividendsParticipateType,
"dividendsAccountStatus": a.PaymentStatus,
"dividendsEstimateTime": a.CreatedAt.Unix() * 1000,
"orderOrReturnedOrderNum": a.DividendsEstimateOrderNumber,
}
... ... @@ -470,7 +468,7 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
UserId int64 `json:"userId"`
UserBaseId int64 `json:"userBaseId"`
DividendsAccountStatus int32 `json:"dividendsAccountStatus"` // 分红结算状态
DividendsAccountStatus int32 `json:"dividendsAccountStatus"` // 分红结算状态 未结算:1,已结算:2,已支付:3
Offset int64 `json:"offset"`
Limit int64 `json:"limit"`
}{}
... ... @@ -478,7 +476,13 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
return nil, err
}
queryOptions = tool_funs.SimpleStructToMap(&request)
if request.DividendsAccountStatus == 2 {
queryOptions["paymentStatus"] = int32(1)
}
if request.DividendsAccountStatus == 3 {
queryOptions["dividendsAccountStatus"] = int32(2)
queryOptions["paymentStatus"] = int32(2)
}
var contractNumbers []string
var err error
if request.OrgId > 0 && request.UserId > 0 {
... ... @@ -535,7 +539,10 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
DividendsType: item.DividendsType,
DividendsUser: item.DividendsUser,
}
// TODO:优化查询 统一查询到map里面
if item.PaymentStatus == 2 {
result.DividendsAccountStatus = 3
}
// TODO:优化查询 统一查询到map里面、或者冗余数据
if item.DividendsType == 1 {
order, err := dividendsOrderRepository.FindOne(map[string]interface{}{
"dividendsOrderNumber": item.OrderOrReturnedOrderNum,
... ... @@ -547,7 +554,10 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
result.DividendsOrderAmount = order.DividendsOrderAmount
result.CustomerName = order.CustomerName
} else if item.DividendsType == 2 {
order, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{"dividendsReturnedOrderNumber": item.OrderOrReturnedOrderNum, "orgId": request.OrgId})
order, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{
"dividendsReturnedOrderNumber": item.OrderOrReturnedOrderNum,
"orgId": request.OrgId,
})
if err != nil {
return nil, err
}
... ...
... ... @@ -331,6 +331,9 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
if paymentStatus, ok := queryOptions["paymentStatus"]; ok && paymentStatus.(int32) != 0 {
query.Where("payment_status = ?", paymentStatus)
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
offsetLimitFlag = offsetLimit.(bool)
... ...