金币代理流水记录修改
This commit is contained in:
parent
9363e6f8a3
commit
bc76d5d939
@ -29,7 +29,7 @@ public interface FreightBalanceRunningWaterClientApi {
|
||||
@GetMapping("/flowByUserId")
|
||||
ResultResponse<List<FreightBalanceRunningWaterDTO>> flowByUserId(
|
||||
@RequestParam("userId") Long userId,
|
||||
@RequestParam(value = "type", required = false) Integer type,
|
||||
@RequestParam(value = "type", required = true) Integer type,
|
||||
@RequestParam(value = "searchId", required = false) Long searchId,
|
||||
@RequestParam(value = "lastId",required = false) Long lastId
|
||||
);
|
||||
|
||||
@ -60,6 +60,16 @@ public class FreightBalanceRunningWaterDTO extends DTO {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long sellerId;
|
||||
|
||||
/**
|
||||
* 接收人信息
|
||||
*/
|
||||
private AccountItem acceptUserAccount;
|
||||
|
||||
/**
|
||||
* 发送人信息
|
||||
*/
|
||||
private AccountItem userAccount;
|
||||
|
||||
/**
|
||||
* 类型0.收入 1.支出.
|
||||
*/
|
||||
@ -110,4 +120,11 @@ public class FreightBalanceRunningWaterDTO extends DTO {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long updateUser;
|
||||
|
||||
@Data
|
||||
public static class AccountItem {
|
||||
private String account;
|
||||
private String userNickName;
|
||||
private String userAvatar;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.red.circle.wallet.infra.database.rds.service.freight.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.framework.mybatis.constant.PageConstant;
|
||||
import com.red.circle.framework.mybatis.mybatisplus.LambdaQueryWrapperChain;
|
||||
import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import com.red.circle.tool.core.date.TimestampUtils;
|
||||
@ -38,20 +39,24 @@ public class FreightBalanceRunningWaterServiceImpl extends
|
||||
|
||||
@Override
|
||||
public List<FreightBalanceRunningWater> flowByUserId(Long userId, Long acceptUserId, Integer type, Long lastId) {
|
||||
return query()
|
||||
.and(Objects.isNull(acceptUserId), wrapper -> wrapper
|
||||
.eq(FreightBalanceRunningWater::getUserId, userId)
|
||||
.or()
|
||||
.eq(FreightBalanceRunningWater::getAcceptUserId, userId)
|
||||
)
|
||||
.and(Objects.nonNull(acceptUserId), e -> e
|
||||
.eq(FreightBalanceRunningWater::getUserId, userId)
|
||||
.eq(FreightBalanceRunningWater::getAcceptUserId, acceptUserId))
|
||||
.and(Objects.nonNull(type), e -> e.eq(FreightBalanceRunningWater::getType, type))
|
||||
.lt(Objects.nonNull(lastId), FreightBalanceRunningWater::getId, lastId)
|
||||
.orderByDesc(FreightBalanceRunningWater::getId)
|
||||
.last(PageConstant.DEFAULT_LIMIT)
|
||||
.list();
|
||||
LambdaQueryWrapperChain<FreightBalanceRunningWater> query = query();
|
||||
if (type == null || type == 0) {
|
||||
query.eq(FreightBalanceRunningWater::getType, 0);
|
||||
query.and(e -> {
|
||||
e.eq(FreightBalanceRunningWater::getAcceptUserId, userId)
|
||||
.eq(Objects.nonNull(acceptUserId), FreightBalanceRunningWater::getUserId, acceptUserId);
|
||||
});
|
||||
} else {
|
||||
query.eq(FreightBalanceRunningWater::getType, 1);
|
||||
query.and(e -> {
|
||||
e.eq(FreightBalanceRunningWater::getUserId, userId)
|
||||
.eq(Objects.nonNull(acceptUserId), FreightBalanceRunningWater::getAcceptUserId, acceptUserId);
|
||||
});
|
||||
}
|
||||
return query.lt(Objects.nonNull(lastId), FreightBalanceRunningWater::getId, lastId)
|
||||
.orderByDesc(FreightBalanceRunningWater::getId)
|
||||
.last(PageConstant.DEFAULT_LIMIT)
|
||||
.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -17,6 +17,7 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -41,17 +42,34 @@ public class FreightBalanceRunningWaterClientServiceImpl implements
|
||||
List<FreightBalanceRunningWaterDTO> runningWaterDTO = freightBalanceRunningWaterInnerConvertor.toListFreightBalanceRunningWaterDTO(runningWaters);
|
||||
|
||||
Set<Long> acceptUserIdList = runningWaterDTO.stream().map(FreightBalanceRunningWaterDTO::getAcceptUserId).collect(Collectors.toSet());
|
||||
Set<Long> userIdList = runningWaterDTO.stream().map(FreightBalanceRunningWaterDTO::getUserId).collect(Collectors.toSet());
|
||||
acceptUserIdList.addAll(userIdList);
|
||||
|
||||
Map<Long, UserProfileDTO> userProfileDTOMap = userProfileClient.mapByUserIds(acceptUserIdList).getBody();
|
||||
|
||||
runningWaterDTO.forEach(dto -> {
|
||||
UserProfileDTO profileDTO = userProfileDTOMap.get(dto.getAcceptUserId());
|
||||
if (profileDTO != null) {
|
||||
dto.setAccount(profileDTO.getAccount());
|
||||
}
|
||||
FreightBalanceRunningWaterDTO.AccountItem accountItem = getAcceptUserAccount(profileDTO);
|
||||
dto.setAcceptUserAccount(accountItem);
|
||||
|
||||
UserProfileDTO userProfileDTO = userProfileDTOMap.get(dto.getUserId());
|
||||
FreightBalanceRunningWaterDTO.AccountItem userAccount = getAcceptUserAccount(userProfileDTO);
|
||||
dto.setUserAccount(userAccount);
|
||||
});
|
||||
return runningWaterDTO;
|
||||
}
|
||||
|
||||
private static FreightBalanceRunningWaterDTO.AccountItem getAcceptUserAccount(UserProfileDTO profileDTO) {
|
||||
FreightBalanceRunningWaterDTO.AccountItem accountItem = null;
|
||||
if (profileDTO != null) {
|
||||
accountItem = new FreightBalanceRunningWaterDTO.AccountItem();
|
||||
accountItem.setAccount(profileDTO.getAccount());
|
||||
accountItem.setUserAvatar(profileDTO.getUserAvatar());
|
||||
accountItem.setUserNickName(profileDTO.getUserNickname());
|
||||
}
|
||||
return accountItem;
|
||||
}
|
||||
|
||||
private Long getByUserId(Long searchId) {
|
||||
if (searchId == null || searchId <= 0) {
|
||||
return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user