From 1d4473f81abe4ef200f23b781756a7da689dc718 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 17 十二月 2024 16:49:13 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java | 5 + ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java | 34 +++++-- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java | 11 ++ ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java | 4 + ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java | 36 +++++++++ ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java | 5 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java | 9 ++ ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml | 12 ++ ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java | 1 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 23 +++++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java | 1 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java | 4 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java | 20 +++++ ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java | 41 +++++++--- 17 files changed, 182 insertions(+), 32 deletions(-) diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java index 5a0c169..1824fcd 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java @@ -72,6 +72,7 @@ @ApiModelProperty(value = "添加时间") @TableField("create_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime createTime; @ApiModelProperty(value = "删除(0=否,1=是)") diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java index aa4ac8c..63f7507 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java @@ -62,6 +62,11 @@ public R<List<Order>> byUserId(Long appUserId) { return R.fail(); } + + @Override + public R<List<Order>> byShopId(Integer shopId) { + return R.fail(); + } }; } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java index 41f8d17..efeec68 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java @@ -33,6 +33,8 @@ @PostMapping("/order/byUserId") public R<List<Order>> byUserId(@RequestParam("appUserId")Long appUserId); + @PostMapping("/order/byShopId") + public R<List<Order>> byShopId(@RequestParam("shopId")Integer shopId); /** diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java index 4828120..98ccca5 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java @@ -104,5 +104,9 @@ @TableField("bound_shop_superiors_points") private Integer boundShopSuperiorsPoints; + @ApiModelProperty(value = "vip名子") + @TableField(exist = false) + private String vipName; + } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java index a749c31..18c6b4a 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/SeckillActivityInfo.java @@ -73,5 +73,8 @@ @TableField(exist = false) private List<GoodsSeckill> goodsSeckills; + @TableField(exist = false) + private Goods goods; + } diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java index 4f31bf8..3807f84 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopWithdraw.java @@ -78,5 +78,9 @@ @TableField("create_user_id") private Long createUserId; + @ApiModelProperty(value = "门店名称") + @TableField(exist = false) + private String shopName; + } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java index 315b847..a6bb668 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java @@ -187,9 +187,6 @@ public R<AppUser> info(){ Long userId = tokenService.getLoginUserApplet().getUserid(); AppUser user = appUserService.getById(userId); - - - return R.ok(user); } @Resource @@ -403,6 +400,26 @@ return R.ok(appuserPage); } + @GetMapping("/shop/getAppuserPage") + @ApiOperation(value = "用户列表", tags = {"门店后台"}) + public R<IPage<AppUser>> shopGetAppuserPage(@ApiParam("页码") @RequestParam Integer pageNum, + @ApiParam("每一页数据大小") Integer pageSize, + AppUser appUser) + { + Integer objectId = tokenService.getLoginUser().getSysUser().getObjectId(); + + List<Long> userIds = new ArrayList<>(); + userIds.add(-1L); + //获取在该本店下单的用户ids + R<List<Order>> listR = remoteOrderGoodsClient.byShopId(objectId); + for (Order datum : listR.getData()) { + userIds.add(datum.getAppUserId()); + } + IPage<AppUser> appuserPage = appUserService.getAppuserPage1(pageNum, pageSize, appUser,objectId); + return R.ok(appuserPage); + } + + @GetMapping("/danger/info") @ApiOperation(value = "用户列表-保级条件详情", tags = {"管理后台"}) public R<DangerInfoDto> dangerinfo(Long id) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java index a1d0963..6d9ebf5 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WithdrawalRequestsController.java @@ -2,19 +2,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.account.api.model.AppUser; import com.ruoyi.account.api.model.BalanceChangeRecord; import com.ruoyi.account.api.model.WithdrawalRequests; import com.ruoyi.account.dto.WithQuery; import com.ruoyi.account.dto.WithdrawalRequestsDTO; +import com.ruoyi.account.service.AppUserService; import com.ruoyi.account.service.WithdrawalRequestsService; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -33,6 +33,8 @@ @Resource private WithdrawalRequestsService withdrawalRequestsService; + @Resource + private AppUserService appUserService; /** * 提现申请 @@ -48,14 +50,24 @@ @ApiOperation(value = "提现申请列表", tags = {"后台"}) public R<IPage<WithdrawalRequests>> page(@RequestBody WithQuery withQuery){ return R.ok(withdrawalRequestsService.pageList(withQuery)); - } -// @PostMapping("/auth") -// @ApiOperation(value = "提现申请", tags = {"后台"}) -// public R<IPage<WithdrawalRequests>> page(@RequestBody WithQuery withQuery){ -// return R.ok(withdrawalRequestsService.pageList(withQuery)); -// -// } + @PostMapping("/auth") + @ApiOperation(value = "提现申请审批", tags = {"后台"}) + public R<IPage<WithdrawalRequests>> auth(@RequestParam Long id,@ApiParam("2'审核通过',3'审核拒绝'") Integer auditStatus){ + WithdrawalRequests byId = withdrawalRequestsService.getById(id); + if (auditStatus==2){ + + //将用户待审核金额减少,已提现金额增加 + AppUser byId1 = appUserService.getById(byId.getAppUserId()); + byId1.setWithdrawnAmount(byId1.getWithdrawnAmount().add(byId.getWithdrawalAmount())); + appUserService.updateById(byId1); + //执行对应的第三方提现 todo + } + //通过 + byId.setAuditStatus(auditStatus); + withdrawalRequestsService.updateById(byId); + return R.ok(); + } } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java index f313602..a2ae452 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java @@ -28,7 +28,8 @@ List<NearbyReferrerVo> getNearbyReferrer(@Param("cityCode") String cityCode, @Param("nearbyReferrer") NearbyReferrer nearbyReferrer); IPage<AppUser> getAppuserPage(@Param("page") IPage<AppUser> page, @Param("appUser") AppUser appUser); - + IPage<AppUser> getAppuserPage1(@Param("page") IPage<AppUser> page, @Param("appUser") AppUser appUser,Integer objectId); + } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java index d17c594..db37014 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java @@ -82,4 +82,5 @@ void onlineRecord(); IPage<AppUser> getAppuserPage(Integer pageNum, Integer pageSize, AppUser appUser); + IPage<AppUser> getAppuserPage1(Integer pageNum, Integer pageSize, AppUser appUser,Integer objectId); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java index a58ae1f..864d130 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java @@ -669,4 +669,9 @@ } return appUserMapper.getAppuserPage(new Page<>(pageNum, pageSize), appUser); } + @Override + public IPage<AppUser> getAppuserPage1(Integer pageNum, Integer pageSize, AppUser appUser,Integer objectId) { + + return appUserMapper.getAppuserPage1(new Page<>(pageNum, pageSize), appUser,objectId); + } } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java index 1f95358..de0971d 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java @@ -212,6 +212,15 @@ } + @PostMapping("/byUserId") + public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId){ + return R.ok(orderService.lambdaQuery().eq(Order::getAppUserId, appUserId).list()); + } + @PostMapping("/byShopId") + public R<List<Order>> byShopId(@RequestParam("shopId") Integer shopId){ + return R.ok(orderService.lambdaQuery().isNotNull(Order::getEndTime).eq(Order::getShopId, shopId).groupBy(Order::getAppUserId).list()); + } + @ResponseBody diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java index 07e9282..f158f0f 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java @@ -14,6 +14,7 @@ import com.ruoyi.other.api.vo.GetSeckillActivityInfo; import com.ruoyi.other.mapper.SeckillActivityInfoMapper; import com.ruoyi.other.service.GoodsSeckillService; +import com.ruoyi.other.service.GoodsService; import com.ruoyi.other.service.SeckillActivityInfoService; import com.ruoyi.other.vo.SeckillActivityDetailVO; import com.ruoyi.other.vo.SeckillActivityVO; @@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.List; @@ -46,6 +48,9 @@ @Resource private SeckillActivityInfoMapper seckillActivityInfoMapper; + + @Resource + private GoodsService goodsService; @@ -101,6 +106,18 @@ Goods goods) { IPage<SeckillActivityVO> IPage = seckillActivityInfoMapper.querySeckillActivity(Page.of(pageNum, pageSize), goods); + for (SeckillActivityVO record : IPage.getRecords()) { + LocalDateTime startTime = record.getStartTime(); + LocalDateTime now = LocalDateTime.now(); + LocalDateTime endTime = record.getEndTime(); + if (endTime.isBefore(now)){ + record.setStatus(2); //已结束 + }else if (startTime.isBefore(now)){ + record.setStatus(1); // 已开始 + }else { + record.setStatus(0); // 未开始 + } + } return R.ok(IPage); } @@ -148,6 +165,9 @@ List<GoodsSeckill> goodsSeckills = goodsSeckillService.list(new LambdaQueryWrapper<GoodsSeckill>() .eq(GoodsSeckill::getSeckillActivityInfoId, id)); seckillActivityInfo.setGoodsSeckills(goodsSeckills); + Integer goodId = seckillActivityInfo.getGoodId(); + Goods goods = goodsService.getById(goodId); + seckillActivityInfo.setGoods(goods); return R.ok(seckillActivityInfo); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java index 41660b8..8114a0d 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java @@ -149,9 +149,14 @@ @ApiOperation(value = "广告管理-分享管理-列表", tags = {"管理后台"}) @GetMapping("/manage/list") public R<Page<Share>> managelist(String name, Integer addType, @RequestParam Integer pageNum, Integer pageSize) { - tokenService.getLoginUser(); - Page<Share> page = shareService.lambdaQuery().eq(Share::getAuditStatus, 1).like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageNum, pageSize)); - return R.ok(page); + //判断当前登陆人是平台还是门店 + if (tokenService.getLoginUser().getSysUser().getRoleType()==1) { + Page<Share> page = shareService.lambdaQuery().eq(Share::getAuditStatus, 1).like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageNum, pageSize)); + return R.ok(page); + }else { + Page<Share> page = shareService.lambdaQuery().eq(Share::getAddType,3).eq(Share::getObjectId, tokenService.getLoginUser().getSysUser().getObjectId()).like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).page(Page.of(pageNum, pageSize)); + return R.ok(page); + } } @ApiOperation(value = "广告管理-分享管理-设为小程序分享", tags = {"管理后台"}) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java index 1c04ba7..e6d1b79 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopWithdrawController.java @@ -1,8 +1,22 @@ package com.ruoyi.other.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.other.api.domain.ShopWithdraw; +import com.ruoyi.other.service.ShopService; +import com.ruoyi.other.service.ShopWithdrawService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; /** * <p> @@ -14,7 +28,29 @@ */ @RestController @RequestMapping("/shop-withdraw") +@Api(tags = {"管理后台-门店管理-提现管理"}) public class ShopWithdrawController { + @Resource + private ShopWithdrawService shopWithdrawService; + @Resource + private ShopService shopService; + + /** + * 提现申请列表 + */ + @RequestMapping("/list") + @ApiOperation("提现申请列表") + public R<IPage<ShopWithdraw>> list(@ApiParam("页码") @RequestParam Integer pageNum, + @ApiParam("每一页数据大小") Integer pageSize, + ShopWithdraw shopWithdraw) { + + Page<ShopWithdraw> page = shopWithdrawService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<ShopWithdraw>() + .like(StringUtils.isNotEmpty(shopWithdraw.getShopName()), ShopWithdraw::getShopName, shopWithdraw.getShopName())); + page.getRecords().forEach(item-> item.setShopName(shopService.getById(item.getShopId()).getName())); + return R.ok(page); + } + + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java index 0a91761..3ad615f 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java @@ -21,6 +21,7 @@ import com.ruoyi.other.service.*; import com.ruoyi.other.vo.GoodsVO; import com.ruoyi.system.api.model.LoginUser; +import org.jetbrains.annotations.NotNull; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -29,6 +30,7 @@ import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * <p> @@ -287,6 +289,11 @@ // 会员价格 List<GoodsVip> goodsVipList = goodsVipService.list(new LambdaQueryWrapper<GoodsVip>() .eq(GoodsVip::getGoodsId, goodsId)); + List<VipSetting> vipSettings = getVipSettings(goodsVipList.stream().map(GoodsVip::getVip)); + goodsVipList.forEach(goodsArea -> vipSettings.stream() + .filter(vipSetting -> vipSetting.getId().equals(goodsArea.getVip())) + .findFirst().ifPresent( vipSetting -> goodsArea.setVipName(vipSetting.getVipName()))); + goods.setGoodsVipList(goodsVipList); // 特殊地区售价设置 @@ -300,25 +307,35 @@ List<GoodsArea> goodsAreaList1 = new ArrayList<>(); listMap.forEach((s, goodsAreas) -> { - List<Integer> vipIds = goodsAreas.stream().map(GoodsArea::getVip).collect(Collectors.toList()); - List<VipSetting> vipSettings = vipSettingService.listByIds(vipIds); - goodsAreas.forEach(goodsArea -> vipSettings.stream() + List<VipSetting> vipSettings1 = getVipSettings(goodsAreas.stream().map(GoodsArea::getVip)); + goodsAreas.forEach(goodsArea -> vipSettings1.stream() .filter(vipSetting -> vipSetting.getId().equals(goodsArea.getVip())) .findFirst().ifPresent( vipSetting -> goodsArea.setVipName(vipSetting.getVipName()))); - GoodsArea goodsArea = goodsAreas.get(0); - GoodsArea goodsArea1 = new GoodsArea(); - goodsArea1.setProvinceCode(goodsArea.getProvinceCode()); - goodsArea1.setCityCode(goodsArea.getCityCode()); - goodsArea1.setDistrictsCode(goodsArea.getDistrictsCode()); - goodsArea1.setProvince(goodsArea.getProvince()); - goodsArea1.setCity(goodsArea.getCity()); - goodsArea1.setDistricts(goodsArea.getDistricts()); - goodsArea1.setGoodsAreaList(goodsAreas); + GoodsArea goodsArea1 = getGoodsArea(goodsAreas); goodsAreaList1.add(goodsArea1); }); goods.setGoodsAreaList(goodsAreaList1); return goods; } + + private List<VipSetting> getVipSettings(Stream<Integer> goodsVipList) { + List<Integer> vipIds = goodsVipList.collect(Collectors.toList()); + return vipSettingService.listByIds(vipIds); + } + + @NotNull + private static GoodsArea getGoodsArea(List<GoodsArea> goodsAreas) { + GoodsArea goodsArea = goodsAreas.get(0); + GoodsArea goodsArea1 = new GoodsArea(); + goodsArea1.setProvinceCode(goodsArea.getProvinceCode()); + goodsArea1.setCityCode(goodsArea.getCityCode()); + goodsArea1.setDistrictsCode(goodsArea.getDistrictsCode()); + goodsArea1.setProvince(goodsArea.getProvince()); + goodsArea1.setCity(goodsArea.getCity()); + goodsArea1.setDistricts(goodsArea.getDistricts()); + goodsArea1.setGoodsAreaList(goodsAreas); + return goodsArea1; + } } diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml index bf9639e..e30473d 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml @@ -49,17 +49,25 @@ <select id="querySeckillActivity" resultType="com.ruoyi.other.vo.SeckillActivityVO"> SELECT tsai.id, - tg.`name`, + tg.`name` goodsName, tg.introduction, + tgc.`name` goodsCategoryName, + tg.operating_cost, + tg.shop_cost, + tg.purchase_limit maxNum, tg.home_page_picture, tg.original_price, tgs.selling_price, tg.sale_num, - tsai.start_time + tg.`type` goodsType, + tsai.start_time, + tsai.end_time, + tsai.is_shelves showStatus FROM t_seckill_activity_info tsai LEFT JOIN t_goods tg ON tsai.good_id = tg.id LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id + LEFT JOIN t_goods_category tgc ON tgc.id = tg.goods_category_id WHERE tsai.end_time >= NOW() AND tsai.del_flag = 0 <if test="goods.name != null and goods.name != ''"> AND tg.`name` LIKE concat('%',#{goods.name},'%') -- Gitblit v1.7.1