积分列表接口
This commit is contained in:
parent
00b79a40b4
commit
e9581d9cfd
|
|
@ -105,8 +105,8 @@ public class UShopUserController {
|
|||
* 获取用户所有门店下积分列表
|
||||
*/
|
||||
@GetMapping("/pointsShopList")
|
||||
public CzgResult<List<PointsShopListVO>> getList() {
|
||||
return CzgResult.success(memberPointsLogService.getList(StpKit.USER.getLoginIdAsLong()));
|
||||
public CzgResult<List<PointsShopListVO>> getList(@RequestParam(required = false) String shopName) {
|
||||
return CzgResult.success(memberPointsLogService.getList(StpKit.USER.getLoginIdAsLong(), shopName));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ public interface MemberPointsLogService extends IService<MemberPointsLog> {
|
|||
|
||||
Page<MemberPointsLogDTO> getMemberPointsLogPage(MemberPointsLogDTO param);
|
||||
|
||||
List<PointsShopListVO> getList(long userId);
|
||||
List<PointsShopListVO> getList(long userId, String shopName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,14 +90,18 @@ public class MemberPointsLogServiceImpl extends ServiceImpl<MemberPointsLogMappe
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<PointsShopListVO> getList(long userId) {
|
||||
public List<PointsShopListVO> getList(long userId, String shopName) {
|
||||
ArrayList<PointsShopListVO> pointsShopListVOS = new ArrayList<>();
|
||||
List<ShopUser> shopUserList = shopUserService.list(new QueryWrapper().eq(ShopUser::getUserId, userId).gt(ShopUser::getAccountPoints, 0));
|
||||
if (shopUserList.isEmpty()) {
|
||||
return pointsShopListVOS;
|
||||
}
|
||||
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) {
|
||||
ShopInfo shopInfo = shopInfoMap.get(shopUser.getSourceShopId());
|
||||
if (shopInfo == null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue