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