Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
2025-09-26 16:54:13 +08:00
4 changed files with 69 additions and 2 deletions

View File

@@ -4,16 +4,27 @@ import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.points.MemberPointsLogDTO;
import com.czg.account.entity.MemberPointsLog;
import com.czg.account.entity.ShopInfo;
import com.czg.account.entity.ShopUser;
import com.czg.account.service.MemberPointsLogService;
import com.czg.account.service.ShopInfoService;
import com.czg.account.service.ShopUserService;
import com.czg.account.vo.PointsShopListVO;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.MemberPointsLogMapper;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static com.czg.account.entity.table.MemberPointsLogTableDef.MEMBER_POINTS_LOG;
import static com.czg.account.entity.table.MemberPointsTableDef.MEMBER_POINTS;
import static com.czg.account.entity.table.ShopUserTableDef.SHOP_USER;
@@ -26,6 +37,10 @@ import static com.czg.account.entity.table.ShopUserTableDef.SHOP_USER;
*/
@Service
public class MemberPointsLogServiceImpl extends ServiceImpl<MemberPointsLogMapper, MemberPointsLog> implements MemberPointsLogService {
@Resource
private ShopUserService shopUserService;
@Resource
private ShopInfoService shopInfoService;
private QueryWrapper buildQueryWrapper(MemberPointsLogDTO param) {
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
@@ -73,4 +88,28 @@ public class MemberPointsLogServiceImpl extends ServiceImpl<MemberPointsLogMappe
QueryWrapper queryWrapper = buildFullQueryWrapper(param);
return super.pageAs(PageUtil.buildPage(), queryWrapper, MemberPointsLogDTO.class);
}
}
@Override
public List<PointsShopListVO> getList(long userId) {
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));
for (ShopUser shopUser : shopUserList) {
ShopInfo shopInfo = shopInfoMap.get(shopUser.getSourceShopId());
if (shopInfo == null) {
continue;
}
pointsShopListVOS.add(new PointsShopListVO()
.setShopName(shopInfo.getShopName())
.setLogo(shopInfo.getLogo())
.setAccountPoints(shopUser.getAccountPoints())
.setShopId(shopInfo.getId()));
}
return pointsShopListVOS;
}
}