积分列表接口

This commit is contained in:
张松 2025-09-26 16:57:22 +08:00
parent 00b79a40b4
commit e9581d9cfd
3 changed files with 9 additions and 5 deletions

View File

@ -105,8 +105,8 @@ public class UShopUserController {
* 获取用户所有门店下积分列表 * 获取用户所有门店下积分列表
*/ */
@GetMapping("/pointsShopList") @GetMapping("/pointsShopList")
public CzgResult<List<PointsShopListVO>> getList() { public CzgResult<List<PointsShopListVO>> getList(@RequestParam(required = false) String shopName) {
return CzgResult.success(memberPointsLogService.getList(StpKit.USER.getLoginIdAsLong())); return CzgResult.success(memberPointsLogService.getList(StpKit.USER.getLoginIdAsLong(), shopName));
} }
/** /**

View File

@ -18,5 +18,5 @@ public interface MemberPointsLogService extends IService<MemberPointsLog> {
Page<MemberPointsLogDTO> getMemberPointsLogPage(MemberPointsLogDTO param); Page<MemberPointsLogDTO> getMemberPointsLogPage(MemberPointsLogDTO param);
List<PointsShopListVO> getList(long userId); List<PointsShopListVO> getList(long userId, String shopName);
} }

View File

@ -90,14 +90,18 @@ public class MemberPointsLogServiceImpl extends ServiceImpl<MemberPointsLogMappe
} }
@Override @Override
public List<PointsShopListVO> getList(long userId) { public List<PointsShopListVO> getList(long userId, String shopName) {
ArrayList<PointsShopListVO> pointsShopListVOS = new ArrayList<>(); ArrayList<PointsShopListVO> pointsShopListVOS = new ArrayList<>();
List<ShopUser> shopUserList = shopUserService.list(new QueryWrapper().eq(ShopUser::getUserId, userId).gt(ShopUser::getAccountPoints, 0)); List<ShopUser> shopUserList = shopUserService.list(new QueryWrapper().eq(ShopUser::getUserId, userId).gt(ShopUser::getAccountPoints, 0));
if (shopUserList.isEmpty()) { if (shopUserList.isEmpty()) {
return pointsShopListVOS; return pointsShopListVOS;
} }
Set<Long> shopIdList = shopUserList.stream().map(ShopUser::getSourceShopId).collect(Collectors.toSet()); Set<Long> shopIdList = shopUserList.stream().map(ShopUser::getSourceShopId).collect(Collectors.toSet());
Map<Long, ShopInfo> shopInfoMap = shopInfoService.listByIds(shopIdList).stream().collect(Collectors.toMap(ShopInfo::getId, item -> item)); QueryWrapper queryWrapper = new QueryWrapper().in(ShopInfo::getId, shopIdList);
if (StrUtil.isNotBlank(shopName)) {
queryWrapper.like(ShopInfo::getShopName, shopName);
}
Map<Long, ShopInfo> shopInfoMap = shopInfoService.list(queryWrapper).stream().collect(Collectors.toMap(ShopInfo::getId, item -> item));
for (ShopUser shopUser : shopUserList) { for (ShopUser shopUser : shopUserList) {
ShopInfo shopInfo = shopInfoMap.get(shopUser.getSourceShopId()); ShopInfo shopInfo = shopInfoMap.get(shopUser.getSourceShopId());
if (shopInfo == null) { if (shopInfo == null) {