...
|
...
|
@@ -9,7 +9,6 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/repository"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -297,7 +296,7 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s |
|
|
}
|
|
|
|
|
|
// 2.合约分红列表
|
|
|
creditAccountRepository, _ := repository.NewCreditAccountRepository(ptr.transactionContext)
|
|
|
creditAccountRepository, _ := repository.NewDividendsEstimateRepository(ptr.transactionContext)
|
|
|
queryOptions["cooperationContractNumber"] = contract.CooperationContractNumber
|
|
|
_, creditAccounts, err := creditAccountRepository.Find(queryOptions)
|
|
|
if err != nil {
|
...
|
...
|
@@ -308,11 +307,7 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s |
|
|
var orderGoodIds []int64
|
|
|
for i := range creditAccounts {
|
|
|
a := creditAccounts[i]
|
|
|
for j := range a.AccountDetail {
|
|
|
if a.AccountDetail[j].OrderGoodId > 0 {
|
|
|
orderGoodIds = append(orderGoodIds, a.AccountDetail[j].OrderGoodId)
|
|
|
}
|
|
|
}
|
|
|
orderGoodIds = append(orderGoodIds, a.OrderGoodId)
|
|
|
}
|
|
|
var mapOrderGoods = make(map[int64]*domain.OrderGood)
|
|
|
if len(orderGoodIds) > 0 {
|
...
|
...
|
@@ -329,35 +324,30 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s |
|
|
var dividends = make([]interface{}, 0)
|
|
|
for i := range creditAccounts {
|
|
|
a := creditAccounts[i]
|
|
|
for j := range a.AccountDetail {
|
|
|
participateType, _ := strconv.Atoi(a.ParticipateType)
|
|
|
detail := a.AccountDetail[j]
|
|
|
|
|
|
participateType := a.DividendsParticipateType
|
|
|
item := map[string]interface{}{
|
|
|
"creditAccountId": a.CreditAccountId,
|
|
|
"creditAccountId": a.DividendsEstimateId,
|
|
|
"orderGoodName": "",
|
|
|
"dividendsType": 0,
|
|
|
"dividendsType": a.DividendsType,
|
|
|
"dividendsRatio": 0,
|
|
|
"dividendsAmount": detail.DividendsAmount,
|
|
|
"dividendsAmount": a.DividendsAmount,
|
|
|
"dividendsUser": map[string]interface{}{
|
|
|
"userInfo": a.Participator.UserInfo,
|
|
|
"userId": a.Participator.UserId,
|
|
|
"userInfo": a.DividendsUser.UserInfo,
|
|
|
"userId": a.DividendsUser.UserId,
|
|
|
},
|
|
|
"dividendsParticipateType": participateType,
|
|
|
"dividendsAccountStatus": a.PaymentStatus,
|
|
|
"dividendsAccountStatus": 0, //TODO:分红状态
|
|
|
"dividendsEstimateTime": a.CreatedAt.Unix() * 1000,
|
|
|
"orderOrReturnedOrderNum": a.CreditAccountOrderNum,
|
|
|
}
|
|
|
if detail.OrderGoodAmount > 0 {
|
|
|
item["dividendsRatio"] = utils.Round(detail.DividendsAmount/detail.OrderGoodAmount*100, 2)
|
|
|
"orderOrReturnedOrderNum": a.DividendsEstimateOrderNumber,
|
|
|
}
|
|
|
item["dividendsType"] = a.AccountDetail[j].DividendsType
|
|
|
if v, ok := mapOrderGoods[detail.OrderGoodId]; ok {
|
|
|
if v, ok := mapOrderGoods[a.OrderGoodId]; ok {
|
|
|
item["orderGoodName"] = v.OrderGoodName
|
|
|
if v.OrderGoodAmount > 0 {
|
|
|
item["dividendsRatio"] = utils.Round(a.DividendsAmount/v.OrderGoodAmount*100, 2)
|
|
|
}
|
|
|
|
|
|
dividends = append(dividends, item)
|
|
|
}
|
|
|
|
|
|
dividends = append(dividends, item)
|
|
|
}
|
|
|
res["dividends"] = dividends
|
|
|
return res, nil
|
...
|
...
|
|