金币代理流水查询更改

This commit is contained in:
tianfeng 2025-12-05 11:52:48 +08:00
parent 57d4f20af8
commit afc1b6a168
6 changed files with 30 additions and 9 deletions

View File

@ -29,6 +29,8 @@ public interface FreightBalanceRunningWaterClientApi {
@GetMapping("/flowByUserId")
ResultResponse<List<FreightBalanceRunningWaterDTO>> flowByUserId(
@RequestParam("userId") Long userId,
@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "searchId", required = false) Long searchId,
@RequestParam(value = "lastId",required = false) Long lastId
);

View File

@ -27,7 +27,7 @@ public interface FreightBalanceRunningWaterService extends BaseService<FreightBa
* @param lastId 最后一条记录id
* @return ignore
*/
List<FreightBalanceRunningWater> flowByUserId(Long userId, Long lastId);
List<FreightBalanceRunningWater> flowByUserId(Long userId, Long acceptUserId, Integer type, Long lastId);
/**

View File

@ -37,13 +37,18 @@ public class FreightBalanceRunningWaterServiceImpl extends
FreightBalanceRunningWaterService {
@Override
public List<FreightBalanceRunningWater> flowByUserId(Long userId, Long lastId) {
public List<FreightBalanceRunningWater> flowByUserId(Long userId, Long acceptUserId, Integer type, Long lastId) {
return query()
.and(wrapper -> wrapper
.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)
.or()
.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)

View File

@ -28,10 +28,10 @@ public class FreightBalanceRunningWaterClientEndpoint implements
private final FreightBalanceRunningWaterClientService freightBalanceRunningWaterClientService;
@Override
public ResultResponse<List<FreightBalanceRunningWaterDTO>> flowByUserId(Long userId,
public ResultResponse<List<FreightBalanceRunningWaterDTO>> flowByUserId(Long userId, Integer type, Long searchId,
Long lastId) {
return ResultResponse.success(
freightBalanceRunningWaterClientService.flowByUserId(userId, lastId)
freightBalanceRunningWaterClientService.flowByUserId(userId, searchId, type, lastId)
);
}

View File

@ -18,7 +18,7 @@ public interface FreightBalanceRunningWaterClientService {
* @param lastId 最后一条记录id
* @return ignore
*/
List<FreightBalanceRunningWaterDTO> flowByUserId(Long userId, Long lastId);
List<FreightBalanceRunningWaterDTO> flowByUserId(Long userId, Long searchId, Integer type, Long lastId);
List<FreightBalanceRunningWaterDTO> listByIds(Set<Long> ids);

View File

@ -34,8 +34,10 @@ public class FreightBalanceRunningWaterClientServiceImpl implements
private final UserProfileClient userProfileClient;
@Override
public List<FreightBalanceRunningWaterDTO> flowByUserId(Long userId, Long lastId) {
List<FreightBalanceRunningWater> runningWaters = freightBalanceRunningWaterService.flowByUserId(userId, lastId);
public List<FreightBalanceRunningWaterDTO> flowByUserId(Long userId, Long searchId, Integer type, Long lastId) {
Long acceptUserId = getByUserId(searchId);
List<FreightBalanceRunningWater> runningWaters = freightBalanceRunningWaterService.flowByUserId(userId, acceptUserId, type, lastId);
List<FreightBalanceRunningWaterDTO> runningWaterDTO = freightBalanceRunningWaterInnerConvertor.toListFreightBalanceRunningWaterDTO(runningWaters);
Set<Long> acceptUserIdList = runningWaterDTO.stream().map(FreightBalanceRunningWaterDTO::getAcceptUserId).collect(Collectors.toSet());
@ -50,7 +52,19 @@ public class FreightBalanceRunningWaterClientServiceImpl implements
return runningWaterDTO;
}
public List<FreightBalanceRunningWaterDTO> listByIds(Set<Long> ids) {
private Long getByUserId(Long searchId) {
if (searchId == null || searchId <= 0) {
return null;
}
List<UserProfileDTO> body = userProfileClient.getByAccount(String.valueOf(searchId)).getBody();
if (body != null) {
return body.get(0).getId();
}
return userProfileClient.getByUserId(searchId).getBody().getId();
}
public List<FreightBalanceRunningWaterDTO> listByIds(Set<Long> ids) {
if (ids.isEmpty()) {
return Collections.emptyList();
}