|
|
@@ -331,10 +331,10 @@ public class StockDescController extends BladeController {
|
|
|
stockDesc.setGoodsIds(ids);
|
|
|
}
|
|
|
stockDesc.setSalesCompanyIds(AuthUtil.getDeptId());
|
|
|
- if ("0".equals(stockDesc.getWhether())){
|
|
|
+ if ("0".equals(stockDesc.getWhether())) {
|
|
|
IPage<PjStockDesc> pages = stockDescService.selectStockDescPage(Condition.getPage(query), stockDesc);
|
|
|
return R.data(pages);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
IPage<PjStockDesc> pages = stockDescService.selectStockDescPageZero(Condition.getPage(query), stockDesc);
|
|
|
return R.data(pages);
|
|
|
}
|
|
|
@@ -854,4 +854,109 @@ public class StockDescController extends BladeController {
|
|
|
return stockDescService.submitProductLaunch(stockDesc);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 小程序商品详情专用
|
|
|
+ */
|
|
|
+ @GetMapping("/listV1")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入stockDesc")
|
|
|
+ public R<IPage<PjStockDesc>> listV1(PjStockDesc stockDesc, Query query) {
|
|
|
+ LambdaQueryWrapper<PjStockDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(PjStockDesc::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PjStockDesc::getIsDeleted, 0)
|
|
|
+ .eq(PjStockDesc::getSalesCompanyId, AuthUtil.getDeptId())//公司
|
|
|
+ .eq(ObjectUtil.isNotEmpty(stockDesc.getCode()), PjStockDesc::getCode, stockDesc.getCode())
|
|
|
+ .eq(ObjectUtil.isNotEmpty(stockDesc.getTypeno()), PjStockDesc::getTypeno, stockDesc.getTypeno())
|
|
|
+ .eq(ObjectUtil.isNotEmpty(stockDesc.getStorageId()), PjStockDesc::getStorageId, stockDesc.getStorageId())
|
|
|
+ .eq(ObjectUtil.isNotEmpty(stockDesc.getStorageName()), PjStockDesc::getStorageName, stockDesc.getStorageName())
|
|
|
+ .eq(ObjectUtil.isNotEmpty(stockDesc.getBrandId()), PjStockDesc::getBrandId, stockDesc.getBrandId())
|
|
|
+ .eq(ObjectUtil.isNotEmpty(stockDesc.getBrandName()), PjStockDesc::getBrandName, stockDesc.getBrandName())
|
|
|
+ .eq(ObjectUtil.isNotEmpty(stockDesc.getGoodsTypeId()), PjStockDesc::getGoodsTypeId, stockDesc.getGoodsTypeId())
|
|
|
+ .eq(ObjectUtil.isNotEmpty(stockDesc.getDot()), PjStockDesc::getDot, stockDesc.getDot())
|
|
|
+ .orderByDesc(PjStockDesc::getBalanceQuantity);
|
|
|
+ if ("0".equals(stockDesc.getWhether())) {
|
|
|
+ lambdaQueryWrapper.ne(PjStockDesc::getBalanceQuantity, 0);
|
|
|
+ }
|
|
|
+ PjProductLaunch productLaunch = null;
|
|
|
+ if (ObjectUtil.isNotEmpty(stockDesc.getCname())) {
|
|
|
+ PjGoodsDesc pjGoodsDescs = goodsDescService.getOne(new LambdaQueryWrapper<PjGoodsDesc>()
|
|
|
+ .eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PjGoodsDesc::getIsDeleted, 0)
|
|
|
+ .eq(PjGoodsDesc::getCname, stockDesc.getCname()));
|
|
|
+ if (pjGoodsDescs != null) {
|
|
|
+ productLaunch = productLaunchService.getOne(new LambdaQueryWrapper<PjProductLaunch>()
|
|
|
+ .eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PjProductLaunch::getIsDeleted, 0)
|
|
|
+ .in(PjProductLaunch::getGoodsId, pjGoodsDescs.getId())
|
|
|
+ .eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId()));
|
|
|
+ lambdaQueryWrapper.eq(PjStockDesc::getCname, stockDesc.getCname());
|
|
|
+ } else {
|
|
|
+ lambdaQueryWrapper.eq(PjStockDesc::getCname, stockDesc.getCname());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lambdaQueryWrapper.orderByDesc(PjStockDesc::getBalanceQuantity);
|
|
|
+ IPage<PjStockDesc> pages = stockDescService.page(Condition.getPage(query), lambdaQueryWrapper);
|
|
|
+ if (!pages.getRecords().isEmpty()) {
|
|
|
+ List<PjGoodsFiles> goodsFilesList = new ArrayList<>();
|
|
|
+ List<PjBrandFiles> pjBrandFilesList = new ArrayList<>();
|
|
|
+ List<BrandFigure> brandFigureList = new ArrayList<>();
|
|
|
+ List<Long> goodsId = pages.getRecords().stream().map(PjStockDesc::getGoodsId).collect(Collectors.toList());
|
|
|
+ List<Long> brandIds = pages.getRecords().stream().map(PjStockDesc::getBrandId).collect(Collectors.toList());
|
|
|
+ if (!goodsId.isEmpty()) {
|
|
|
+ goodsFilesList = goodsFilesService.list(new LambdaQueryWrapper<PjGoodsFiles>()
|
|
|
+ .eq(PjGoodsFiles::getMainImage, 0)
|
|
|
+ .in(PjGoodsFiles::getPid, goodsId)
|
|
|
+ .eq(PjGoodsFiles::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PjGoodsFiles::getIsDeleted, 0));
|
|
|
+ }
|
|
|
+ if (!brandIds.isEmpty()) {
|
|
|
+ pjBrandFilesList = brandFilesService.list(new QueryWrapper<PjBrandFiles>()
|
|
|
+ .in("pid", brandIds).eq("is_deleted", 0));
|
|
|
+ brandFigureList = brandFigureService.list(new QueryWrapper<BrandFigure>()
|
|
|
+ .in("pid", brandIds).eq("is_deleted", 0));
|
|
|
+ }
|
|
|
+ for (PjStockDesc item : pages.getRecords()) {
|
|
|
+ if (productLaunch != null) {
|
|
|
+ item.setPriceOne(productLaunch.getPriceOne());
|
|
|
+ item.setPriceTwo(productLaunch.getPriceTwo());
|
|
|
+ item.setPriceThree(productLaunch.getPriceThree());
|
|
|
+ item.setPriceFour(productLaunch.getPriceFour());
|
|
|
+ }
|
|
|
+ if (!goodsFilesList.isEmpty()) {
|
|
|
+ item.setGoodsFilesList(goodsFilesList.stream()
|
|
|
+ .filter(e -> e.getPid().equals(item.getGoodsId()))
|
|
|
+ .collect(Collectors.toList()));
|
|
|
+ } else {
|
|
|
+ if (ObjectUtils.isNotNull(item.getBrandId())) {
|
|
|
+ if (!brandFigureList.isEmpty()) {
|
|
|
+ List<BrandFigure> brandFigureList1 = brandFigureList.stream()
|
|
|
+ .filter(e -> e.getPid().equals(item.getBrandId()) && e.getFigure().equals(item.getBrandItem()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!brandFigureList1.isEmpty()) {
|
|
|
+ item.setGoodsFilesList(BeanUtil.copy(brandFigureList1, PjGoodsFiles.class));
|
|
|
+ } else {
|
|
|
+ List<PjBrandFiles> pjBrandFilesList1 = pjBrandFilesList.stream()
|
|
|
+ .filter(e -> e.getPid().equals(item.getBrandId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!pjBrandFilesList1.isEmpty()) {
|
|
|
+ item.setGoodsFilesList(BeanUtil.copy(pjBrandFilesList1, PjGoodsFiles.class));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ List<PjBrandFiles> pjBrandFilesList1 = pjBrandFilesList.stream()
|
|
|
+ .filter(e -> e.getPid().equals(item.getBrandId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!pjBrandFilesList1.isEmpty()) {
|
|
|
+ item.setGoodsFilesList(BeanUtil.copy(pjBrandFilesList1, PjGoodsFiles.class));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(pages);
|
|
|
+ }
|
|
|
+
|
|
|
}
|