提交 262bfee5 作者: xiaowang

新增:租赁设备列表条件查询

上级 e15f88ea
......@@ -17,20 +17,20 @@ import java.math.BigDecimal;
/**
* @Author LW
* @date 2022/9/22 10:28
* 概要:
*
* @date 2022/9/22 10:28 概要:
*/
@RestController
@RequestMapping("/product/spec/")
@Api(tags = {"产品管理模块-相关接口"})
public class BackstageProductSpecController {
@Autowired
private ProductSkuService productSkuService;
@Autowired private ProductSkuService productSkuService;
@ApiOperation(value = "新增产品sku")
@PostMapping("addProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addProductSku(@Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
public ResultBody addProductSku(
@Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.addProductSku(param);
}
......@@ -44,7 +44,8 @@ public class BackstageProductSpecController {
@ApiOperation(value = "编辑产品sku")
@PostMapping("editProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editProductSku(@Validated(Update.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
public ResultBody editProductSku(
@Validated(Update.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.editProductSku(param);
}
......@@ -65,7 +66,9 @@ public class BackstageProductSpecController {
@ApiOperation(value = "新增or修改产品规格")
@PostMapping("addOrEditProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addOrEditProductSpec(@Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody ProductSpecVO param) {
public ResultBody addOrEditProductSpec(
@Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody
ProductSpecVO param) {
return productSkuService.addOrEditProductSpec(param);
}
......@@ -79,10 +82,12 @@ public class BackstageProductSpecController {
@ApiOperation(value = "产品规格分页列表")
@GetMapping("listPageProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
public ResultBody listPageProductSpec(@ApiParam(value = "页码") @RequestParam(value = "pageNo") Integer pageNo,
public ResultBody listPageProductSpec(
@ApiParam(value = "页码") @RequestParam(value = "pageNo") Integer pageNo,
@ApiParam(value = "每页显示数") @RequestParam(value = "pageSize") Integer pageSize,
@ApiParam(value = "产品skuId") @RequestParam(value = "productSkuId") Integer productSkuId) {
return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId);
@ApiParam(value = "产品skuId") @RequestParam(value = "productSkuId") Integer productSkuId,
@ApiParam(value = "关键字") @RequestParam(value = "keyword", required = false) String keyword) {
return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId, keyword);
}
@ApiOperation(value = "产品规格管理-价格配置")
......@@ -92,7 +97,6 @@ public class BackstageProductSpecController {
return productSkuService.productSpecCPQ(productSpecCPQVO);
}
@ApiOperation(value = "价格配置信息的修改")
@PostMapping("updateProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
......@@ -108,28 +112,33 @@ public class BackstageProductSpecController {
}
//
// @ApiOperation(value = "价格配置信息--恢复全局默认设置")
// @GetMapping("getDefaultSettings")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
// public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value = "productSpecId") Integer productSpecId) {
// return productSpecService.getDefaultSettings(productSpecId);
// }
//
// @ApiOperation(value = "价格配置信息--恢复全局默认设置")
// @GetMapping("getDefaultSettings")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response =
// ProductSpecPriceDTO.class)})
// public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value =
// "productSpecId") Integer productSpecId) {
// return productSpecService.getDefaultSettings(productSpecId);
// }
//
@ApiOperation(value = "产品规格管理---删除规格")
@GetMapping("removeProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RemoveSkuDTO.class)})
public ResultBody removeProductSpec(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.removeProductSpec(id);
}
//
// @ApiOperation(value = "feign根据渠道等级获取单价信息")
// @GetMapping("feignGetUnitPriceByTag")
// @ApiIgnore
// @ApiResponses({@ApiResponse(code = 200, message = "OK",response = ProductSpecPriceDTO.class)})
// public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer specId,
// @RequestParam(value = "tagId")Integer tagId) {
// return productSpecService.feignGetUnitPriceByTag(specId,tagId);
// }
//
// @ApiOperation(value = "feign根据渠道等级获取单价信息")
// @GetMapping("feignGetUnitPriceByTag")
// @ApiIgnore
// @ApiResponses({@ApiResponse(code = 200, message = "OK",response =
// ProductSpecPriceDTO.class)})
// public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer
// specId,
// @RequestParam(value = "tagId")Integer
// tagId) {
// return productSpecService.feignGetUnitPriceByTag(specId,tagId);
// }
@ApiOperation(value = "feign根据渠道等级获取单价信息")
@PostMapping("feignGetSpecLeaseUnitPrice")
......
package com.mmc.pms.controller.mini;
package com.mmc.pms.controller.common;
import com.mmc.pms.common.Page;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.constant.TokenConstant;
import com.mmc.pms.controller.BaseController;
import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO;
import com.mmc.pms.model.qo.WareInfoQO;
......@@ -21,20 +22,24 @@ import javax.servlet.http.HttpServletRequest;
/**
* @Author LW
* @date 2023/6/8 17:16
* 概要:
*
* @date 2023/6/8 17:16 概要:
*/
@Api(tags = {"v1.0.1-设备租赁-相关接口"})
@RestController
@RequestMapping("/lease/goods")
public class MiniLeaseGoodsController extends BaseController {
@Autowired
private WebDeviceService webDeviceService;
public class LeaseGoodsController extends BaseController {
@Autowired private WebDeviceService webDeviceService;
@ApiOperation(value = "设备列表筛选")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = LeaseGoodsInfoDTO.class)})
@PostMapping("/deviceList")
public ResultBody listWareInfoPage(@RequestBody @Validated(Page.class) WareInfoQO param, HttpServletRequest request) {
return webDeviceService.listWareInfoPage(param, request, this.getUserLoginInfoFromRedis(request).getUserAccountId());
public ResultBody listWareInfoPage(
@RequestBody @Validated(Page.class) WareInfoQO param, HttpServletRequest request) {
if (request.getHeader(TokenConstant.TOKEN) == null) {
return webDeviceService.listWareInfoPage(param, null, null);
}
return webDeviceService.listWareInfoPage(
param, request, this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
}
......@@ -19,8 +19,7 @@ import java.util.Set;
/**
* @author 23214
* @description 针对表【product_sku(产品sku表)】的数据库操作Mapper
* @createDate 2023-05-25 14:55:56
* @Entity com.mmc.pms.entity.ProductSku
* @createDate 2023-05-25 14:55:56 @Entity com.mmc.pms.entity.ProductSku
*/
@Mapper
public interface ProductDao {
......@@ -49,13 +48,16 @@ public interface ProductDao {
ProductSpecDO getProductSpecDetail(Integer id);
int countListPageProductSpec(Integer productSkuId);
int countListPageProductSpec(@Param("id") Integer id, @Param("keyword") String keyword);
List<ProductSpecDO> listPageProductSpec(int pageNo, Integer pageSize, Integer productSkuId);
List<ProductSpecDO> listPageProductSpec(
@Param(value = "pageNo") Integer pageNo,
@Param(value = "pageSize") Integer pageSize,
@Param(value = "productSkuId") Integer productSkuId,
@Param(value = "keyword") String keyword);
int batchInsertSpecPrice(List<ProductSpecPriceDO> list);
void batchInsertLeaseSpecPrice(List<ProductSpecPriceDO> list);
void removeProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
......@@ -113,8 +115,5 @@ public interface ProductDao {
List<MallProdSkuInfoSpecDO> listMallProductSpec(Integer id);
List<ProductSpecPriceDO> getProductSpecPriceList(List<Integer> specIds);
}
package com.mmc.pms.model.lease.dto;
import com.mmc.pms.model.sale.dto.GoodsDetailInfoDTO;
import com.mmc.pms.model.sale.dto.GoodsImgDTO;
import com.mmc.pms.model.sale.dto.GoodsOtherServiceDTO;
import com.mmc.pms.model.sale.dto.GoodsSpecDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
/**
* @Author LW
*
* @date 2022/11/8 15:57 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class LeaseGoodsDetailDTO implements Serializable {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "pid")
private Integer pid;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "云享飞服务id")
private Integer shareFlyServiceId;
@ApiModelProperty(value = "云仓配件id")
private Integer repoId;
@ApiModelProperty(value = "规格信息")
private List<GoodsSpecDTO> goodsSpec;
@ApiModelProperty(value = "商品图片")
private List<GoodsImgDTO> images;
@ApiModelProperty(value = "商品视频")
private String goodsVideo;
@ApiModelProperty(value = "商品视频id")
private Integer goodsVideoId;
@ApiModelProperty(value = "商品详情")
private GoodsDetailInfoDTO goodsDetail;
@ApiModelProperty(value = "所属目录")
private Integer sortTypeId;
@ApiModelProperty(value = "一级分类id")
private Integer categoryByOne;
@ApiModelProperty(value = "二级分类id")
private Integer categoryByTwo;
@ApiModelProperty(value = "商品标签")
private String tag;
@ApiModelProperty(value = "其他服务: 1:免费配送,2:专业飞手培训2日, 3:半年保修, 4:一年保修 ")
private List<GoodsOtherServiceDTO> otherService;
}
......@@ -9,6 +9,7 @@ import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author small @Date 2023/5/16 15:30 @Version 1.0
......@@ -41,4 +42,7 @@ public class ProductSpecDTO implements Serializable {
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "价格配置")
private List<ProductSpecPriceDTO> priceList;
}
......@@ -27,10 +27,8 @@ import java.util.stream.Collectors;
*/
@Service
public class ProductServiceImpl implements ProductSkuService {
@Autowired
private ProductDao productDao;
@Autowired
private IndustrySpecDao industrySpecDao;
@Autowired private ProductDao productDao;
@Autowired private IndustrySpecDao industrySpecDao;
@Override
public ResultBody addProductSku(ProductSkuVO param) {
......@@ -78,26 +76,35 @@ public class ProductServiceImpl implements ProductSkuService {
public ResultBody listPageProductSku(ProductSkuQO productSkuQO) {
int count = productDao.countListPageProductSku(productSkuQO);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(productSkuQO.getPageNo(), productSkuQO.getPageSize(), count));
return ResultBody.success(
PageResult.buildPage(productSkuQO.getPageNo(), productSkuQO.getPageSize(), count));
}
Integer pageNo = productSkuQO.getPageNo();
productSkuQO.buildCurrentPage();
List<ProductSkuDO> productSkuList = productDao.listPageProductSku(productSkuQO);
List<Integer> productSkuIds = productSkuList.stream().map(ProductSkuDO::getId).collect(Collectors.toList());
List<Integer> productSkuIds =
productSkuList.stream().map(ProductSkuDO::getId).collect(Collectors.toList());
List<ProductSpecDO> productSpecList = productDao.getProductSpecList(productSkuIds);
Map<Integer, List<ProductSpecDO>> productSpecMap = productSpecList.stream().collect(Collectors.groupingBy(ProductSpecDO::getProductSkuId));
List<ProductSkuDTO> list = productSkuList.stream()
.map(ProductSkuDO::buildProductSkuDTO)
.collect(Collectors.toList());
list.stream().peek(d -> {
Map<Integer, List<ProductSpecDO>> productSpecMap =
productSpecList.stream().collect(Collectors.groupingBy(ProductSpecDO::getProductSkuId));
List<ProductSkuDTO> list =
productSkuList.stream().map(ProductSkuDO::buildProductSkuDTO).collect(Collectors.toList());
list.stream()
.peek(
d -> {
List<ProductSpecDO> productSpecDOS = productSpecMap.get(d.getId());
if (CollectionUtils.isEmpty(productSpecDOS)) {
d.setProductSpecList(null);
} else {
d.setProductSpecList(productSpecDOS.stream().map(ProductSpecDO::buildProductSpecDTO).collect(Collectors.toList()));
d.setProductSpecList(
productSpecDOS.stream()
.map(ProductSpecDO::buildProductSpecDTO)
.collect(Collectors.toList()));
}
}).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, productSkuQO.getPageSize(), count, list));
})
.collect(Collectors.toList());
return ResultBody.success(
PageResult.buildPage(pageNo, productSkuQO.getPageSize(), count, list));
}
@Override
......@@ -136,13 +143,18 @@ public class ProductServiceImpl implements ProductSkuService {
}
@Override
public ResultBody listPageProductSpec(Integer pageNo, Integer pageSize, Integer productSkuId) {
int count = productDao.countListPageProductSpec(productSkuId);
public ResultBody listPageProductSpec(
Integer pageNo, Integer pageSize, Integer productSkuId, String keyword) {
int count = productDao.countListPageProductSpec(productSkuId, keyword);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count));
}
List<ProductSpecDO> productSpecList = productDao.listPageProductSpec((pageNo - 1) * pageSize, pageSize, productSkuId);
List<ProductSpecDTO> list = productSpecList.stream().map(ProductSpecDO::buildProductSpecDTO).collect(Collectors.toList());
List<ProductSpecDO> productSpecList =
productDao.listPageProductSpec((pageNo - 1) * pageSize, pageSize, productSkuId, keyword);
List<ProductSpecDTO> list =
productSpecList.stream()
.map(ProductSpecDO::buildProductSpecDTO)
.collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, list));
}
......@@ -160,7 +172,9 @@ public class ProductServiceImpl implements ProductSkuService {
@Override
public List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO) {
// 批量插入规格价格
return productSpecCPQVO.getSpecPrice().stream().map(d -> {
return productSpecCPQVO.getSpecPrice().stream()
.map(
d -> {
ProductSpecPriceDO productSpecPriceDO = new ProductSpecPriceDO();
productSpecPriceDO.setCooperationTag(d.getCooperationTag());
productSpecPriceDO.setPrice(d.getPrice());
......@@ -170,7 +184,8 @@ public class ProductServiceImpl implements ProductSkuService {
productSpecPriceDO.setLeaseTerm(productSpecCPQVO.getLeaseTerm());
}
return productSpecPriceDO;
}).collect(Collectors.toList());
})
.collect(Collectors.toList());
}
@Override
......@@ -197,15 +212,17 @@ public class ProductServiceImpl implements ProductSkuService {
return ResultBody.success();
}
@Override
public ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
List<ProductSpecPriceDO> productSpecPriceList = productDao.getProductSpecPrice(productSpecCPQVO);
List<ProductSpecPriceDTO> list = productSpecPriceList.stream()
.map(ProductSpecPriceDO::buildProductSpecPriceDTO).collect(Collectors.toList());
List<ProductSpecPriceDO> productSpecPriceList =
productDao.getProductSpecPrice(productSpecCPQVO);
List<ProductSpecPriceDTO> list =
productSpecPriceList.stream()
.map(ProductSpecPriceDO::buildProductSpecPriceDTO)
.collect(Collectors.toList());
return ResultBody.success(list);
}
......@@ -232,19 +249,29 @@ public class ProductServiceImpl implements ProductSkuService {
if (mallProdSkuInfoSpecList.size() != 0 || inventorySpecList.size() != 0) {
if (inventorySpecList.size() != 0) {
// 根据清单id 获取行业规格id
Set<Integer> inventoryIds = inventorySpecList.stream().map(InventorySpecDO::getIndustryProductInventoryId).collect(Collectors.toSet());
List<IndustryProductInventoryDO> industryProductInventoryList = industrySpecDao.listIndustryProdInventory(inventoryIds);
Set<Integer> inventoryIds =
inventorySpecList.stream()
.map(InventorySpecDO::getIndustryProductInventoryId)
.collect(Collectors.toSet());
List<IndustryProductInventoryDO> industryProductInventoryList =
industrySpecDao.listIndustryProdInventory(inventoryIds);
// 获取行业规格id
Set<Integer> industrySpecIds = industryProductInventoryList.stream().map(IndustryProductInventoryDO::getIndustrySpecId).collect(Collectors.toSet());
Set<Integer> industrySpecIds =
industryProductInventoryList.stream()
.map(IndustryProductInventoryDO::getIndustrySpecId)
.collect(Collectors.toSet());
// 分别获取规格对应的sku信息
List<IndustrySpecDO> industrySpecList = industrySpecDao.listIndustrySpec(industrySpecIds);
List<SkuAndSpecDTO> industrySkuNameList = new ArrayList<>();
industrySpecList.stream().peek(d -> {
industrySpecList.stream()
.peek(
d -> {
SkuAndSpecDTO skuAndSpecDTO = new SkuAndSpecDTO();
skuAndSpecDTO.setIndustrySkuName(d.getSolutionName());
skuAndSpecDTO.setIndustrySpecNames(d.getSpecName());
industrySkuNameList.add(skuAndSpecDTO);
}).collect(Collectors.toList());
})
.collect(Collectors.toList());
removeSkuDTO.setIndustrySkuName(industrySkuNameList);
}
if (mallProdSkuInfoSpecList.size() != 0) {
......@@ -268,7 +295,8 @@ public class ProductServiceImpl implements ProductSkuService {
dayMap.put(16, 30);
dayMap.put(31, Integer.MAX_VALUE);
Integer dayRange = dayMap.entrySet().stream()
Integer dayRange =
dayMap.entrySet().stream()
.filter(entry -> priceAcquisition.getDay() <= entry.getKey())
.findFirst()
.map(Map.Entry::getValue)
......@@ -277,7 +305,3 @@ public class ProductServiceImpl implements ProductSkuService {
return productDao.feignGetUnitPriceByTag(priceAcquisition);
}
}
......@@ -2,6 +2,7 @@ package com.mmc.pms.service.Impl;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.constant.TokenConstant;
import com.mmc.pms.dao.GoodsInfoDao;
import com.mmc.pms.dao.ProductDao;
......@@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -31,17 +33,13 @@ import java.util.stream.Collectors;
@Service
public class WebDeviceServiceImpl implements WebDeviceService {
@Autowired
WebDeviceDao webDeviceDao;
@Autowired WebDeviceDao webDeviceDao;
@Autowired
UserAppApi userAppApi;
@Autowired UserAppApi userAppApi;
@Autowired
ProductDao productDao;
@Autowired ProductDao productDao;
@Autowired
GoodsInfoDao goodsInfoDao;
@Autowired GoodsInfoDao goodsInfoDao;
@Override
public ResultBody listSecondDistrict() {
......@@ -155,9 +153,20 @@ public class WebDeviceServiceImpl implements WebDeviceService {
}
@Override
public ResultBody listWareInfoPage(WareInfoQO param, HttpServletRequest request, Integer userAccountId) {
UserAccountSimpleDTO userAccountSimpleDTO = userAppApi.feignGetUserSimpleInfo(userAccountId, request.getHeader(TokenConstant.TOKEN));
List<Integer> userIds = userAppApi.feignListUserAccountIds(param.getProvinceId(), null, null, request.getHeader(TokenConstant.TOKEN));
public ResultBody listWareInfoPage(
WareInfoQO param, HttpServletRequest request, Integer userAccountId) {
List<Integer> userIds = null;
if (param.getProvinceId() != null) {
userIds =
userAppApi.feignListUserAccountIds(
param.getProvinceId(),
null,
null,
request == null ? null : request.getHeader(TokenConstant.TOKEN));
if (userIds == null || userIds.size() == 0) {
userIds = Collections.singletonList(-1);
}
}
int count = webDeviceDao.countListWareInfoPage(param.getCategoryId(), userIds);
if (count == 0) {
return ResultBody.success(
......@@ -165,18 +174,42 @@ public class WebDeviceServiceImpl implements WebDeviceService {
}
int pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfo> list = webDeviceDao.listWareInfoPage(param.getCategoryId(), userIds, param.getPageNo(), param.getPageSize());
List<LeaseGoodsInfoDTO> pageList = list.stream().map(GoodsInfo::buildLeaseGoodsInfoDTO).collect(Collectors.toList());
if (request == null) {
List<GoodsInfo> list =
webDeviceDao.listWareInfoPage(
param.getCategoryId(), userIds, param.getPageNo(), param.getPageSize());
List<LeaseGoodsInfoDTO> pageList =
list.stream().map(GoodsInfo::buildLeaseGoodsInfoDTO).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
UserAccountSimpleDTO userAccountSimpleDTO =
userAppApi.feignGetUserSimpleInfo(userAccountId, request.getHeader(TokenConstant.TOKEN));
if (userAccountSimpleDTO == null) {
return ResultBody.error(ResultEnum.INTERNAL_SERVER_ERROR);
}
List<GoodsInfo> list =
webDeviceDao.listWareInfoPage(
param.getCategoryId(), userIds, param.getPageNo(), param.getPageSize());
List<LeaseGoodsInfoDTO> pageList =
list.stream().map(GoodsInfo::buildLeaseGoodsInfoDTO).collect(Collectors.toList());
if (userAccountSimpleDTO.getCooperationTagId() == null) {
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
List<Integer> goodsId = pageList.stream().map(LeaseGoodsInfoDTO::getId).collect(Collectors.toList());
List<Integer> goodsId =
pageList.stream().map(LeaseGoodsInfoDTO::getId).collect(Collectors.toList());
List<MallProdSkuInfoSpecDO> mallProSkuInfoSpec = goodsInfoDao.listMallprodSpecById(goodsId);
Map<Integer, MallProdSkuInfoSpecDO> specMap = mallProSkuInfoSpec.stream().collect(Collectors.toMap(MallProdSkuInfoSpecDO::getGoodsInfoId, d -> d, (k1, k2) -> k1));
pageList.stream().peek(d -> {
Map<Integer, MallProdSkuInfoSpecDO> specMap =
mallProSkuInfoSpec.stream()
.collect(
Collectors.toMap(MallProdSkuInfoSpecDO::getGoodsInfoId, d -> d, (k1, k2) -> k1));
pageList.stream()
.peek(
d -> {
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = specMap.get(d.getId());
d.setPrice(mallProdSkuInfoSpecDO.getPrice());
}).collect(Collectors.toList());
})
.collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
......@@ -206,9 +239,13 @@ public class WebDeviceServiceImpl implements WebDeviceService {
@Override
public List<SkuInfoDTO> listWareSkuById(Integer id) {
List<SkuInfoDO> skuInfoDOS = webDeviceDao.listSkuInfo(id);
return skuInfoDOS.isEmpty() ? null : skuInfoDOS.stream().map(d -> {
return skuInfoDOS.isEmpty()
? null
: skuInfoDOS.stream()
.map(
d -> {
return d.buildSkuInfoDTO();
}).collect(Collectors.toList());
})
.collect(Collectors.toList());
}
}
......@@ -30,7 +30,8 @@ public interface ProductSkuService {
ResultBody getProductSpecDetail(Integer id);
ResultBody listPageProductSpec(Integer pageNo, Integer pageSize, Integer productSkuId);
ResultBody listPageProductSpec(
Integer pageNo, Integer pageSize, Integer productSkuId, String keyword);
ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
......@@ -45,5 +46,4 @@ public interface ProductSkuService {
ResultBody removeProductSpec(Integer id);
BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition);
}
......@@ -111,7 +111,7 @@
and product_name like CONCAT ('%',#{productName},'%')
</if>
<if test="categoryId != null">
and categories = #{categoryId}
and categories_id = #{categoryId}
</if>
<if test="directoryId != null">
and directory_id = #{directoryId}
......@@ -178,8 +178,13 @@
<select id="countListPageProductSpec" resultType="java.lang.Integer">
select count(*)
from product_spec
where is_deleted = 0
and product_id = #{id}
<where>
is_deleted = 0
and product_sku_id = #{id}
<if test="keyword != null and keyword != ''">
and spec_name like CONCAT('%',#{keyword},'%')
</if>
</where>
</select>
<select id="listPageProductSpec" resultType="com.mmc.pms.entity.ProductSpecDO">
select id,
......@@ -190,8 +195,13 @@
version_desc versionDesc,
create_time createTime
from product_spec
where is_deleted = 0
<where>
is_deleted = 0
and product_id = #{productSkuId}
<if test="keyword != null and keyword != ''">
and spec_name like CONCAT('%',#{keyword},'%')
</if>
</where>
order by create_time desc
limit #{pageNo}, #{pageSize}
</select>
......@@ -479,4 +489,17 @@
AND mp.is_deleted = 0
AND gi.is_deleted = 0
</select>
<select id="getProductSpecPriceList" resultType="com.mmc.pms.entity.ProductSpecPriceDO">
SELECT
id,
product_spec_id productSpecId,
tag_info_id tagInfoId,
price
FROM
product_spec_price
WHERE product_spec_id in (
<foreach collection="list" separator="," index="index" item="d">
#{d}
</foreach>)
</select>
</mapper>
......@@ -153,14 +153,12 @@
</select>
<select id="countListWareInfoPage" parameterType="com.mmc.pms.entity.GoodsInfo" resultType="int">
SELECT
count(*)
FROM
goods_info gi
SELECT count(*)
FROM goods_info gi
INNER JOIN goods_img img ON gi.id = img.goods_info_id
<where>
gi.is_deleted = 0 and gi.shelf_status = 0
<if test="categoryIds != null">
<if test="categoryIds != null and categoryIds.size != 0">
<foreach collection="categoryIds" item="item" index="index" open="and gi.category_by_one IN (" close=")"
separator=",">
#{item}
......
......@@ -7,3 +7,5 @@ data-filter:
- /pms/swagger-resources/**
- /pms/webjars/**
- /pms/product/spec/feignGetSpecLeaseUnitPrice
- /pms//lease/goods/deviceList
- /pms/classify/queryCategoryInfoByType
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论