| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.GoodsBargainPrice; |
| | | import com.ruoyi.other.api.domain.GoodsBargainPriceDetail; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.api.vo.GetGoodsBargainPrice; |
| | | import com.ruoyi.other.service.GoodsBargainPriceDetailService; |
| | | import com.ruoyi.other.service.GoodsBargainPriceService; |
| | | import com.ruoyi.other.service.GoodsService; |
| | | import com.ruoyi.other.service.*; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.alibaba.nacos.shaded.org.checkerframework.checker.units.UnitsTools.g; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private GoodsService goodsService; |
| | | |
| | | @Resource |
| | | private GoodsCategoryService goodsCategoryService; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private ShopService shopService; |
| | | |
| | | |
| | | /** |
| | |
| | | @ApiParam("审核状态") @RequestParam(value = "auditStatus", required = false) Integer auditStatus) { |
| | | |
| | | |
| | | List<Integer> goodsIds = goodsService.listObjs(new LambdaQueryWrapper<Goods>() |
| | | .select(Goods::getId) |
| | | List<Goods> goodsList = goodsService.list(new LambdaQueryWrapper<Goods>() |
| | | .eq(StringUtils.isNotEmpty(goodsName), Goods::getName, goodsName) |
| | | .eq(goodsType != null, Goods::getType, goodsType) |
| | | .eq(categoryId != null, Goods::getGoodsCategoryId, categoryId)); |
| | | List<Integer> goodsIds = goodsList.stream().map(Goods::getId).collect(Collectors.toList()); |
| | | if (goodsId != null){ |
| | | goodsIds.add(goodsId); |
| | | } |
| | | |
| | | goodsIds.add(goodsId); |
| | | Page<GoodsBargainPrice> page = goodsBargainPriceService.page(Page.of(pageNum, pageSize), new LambdaQueryWrapper<GoodsBargainPrice>() |
| | | .eq(!CollectionUtils.isEmpty(goodsIds), GoodsBargainPrice::getGoodsId, goodsId) |
| | | .eq(auditStatus != null, GoodsBargainPrice::getAuditStatus, auditStatus)); |
| | | |
| | | page.getRecords().forEach(goodsBargainPrice -> { |
| | | goodsList.stream() |
| | | .filter(goods -> goods.getId().equals(goodsBargainPrice.getGoodsId())) |
| | | .findFirst().ifPresent(g -> { |
| | | GoodsCategory goodsCategory = goodsCategoryService.getById(g.getGoodsCategoryId()); |
| | | Integer shopId = goodsBargainPrice.getShopId(); |
| | | Shop shop = shopService.getById(shopId); |
| | | R<AppUser> r = appUserClient.getAppUserByPhone(shop.getPhone()); |
| | | if (R.isError(r)){ |
| | | throw new RuntimeException("获取店长信息失败"); |
| | | } |
| | | goodsBargainPrice.setOwnerName(r.getData().getName()); |
| | | goodsBargainPrice.setOwnerPhone(shop.getPhone()); |
| | | goodsBargainPrice.setShopName(shop.getName()); |
| | | goodsBargainPrice.setGoodsName(g.getName()); |
| | | goodsBargainPrice.setCategoryName(goodsCategory.getName()); |
| | | }); |
| | | }); |
| | | |
| | | return R.ok(page); |
| | | } |
| | | |