提交 ecae0717 作者: xiaowang

接口放行

上级 a02ea2d9
......@@ -12,7 +12,6 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.math.BigDecimal;
......@@ -133,8 +132,7 @@ public class BackstageProductSpecController {
// }
@ApiOperation(value = "feign根据渠道等级获取单价信息")
@GetMapping("feignGetSpecLeaseUnitPrice")
@ApiIgnore
@PostMapping("feignGetSpecLeaseUnitPrice")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public BigDecimal feignGetUnitPriceByTag(@RequestBody PriceAcquisition priceAcquisition) {
return productSkuService.feignGetUnitPriceByTag(priceAcquisition);
......
package com.mmc.pms.controller.web;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author LW
* @date 2023/6/8 15:19
* 概要:
*/
@RestController
@RequestMapping("/lease/goods")
@Api(tags = {"web端-设备租赁-相关接口"})
public class WebLeaseGoodsController {
}
......@@ -90,6 +90,8 @@ public interface GoodsInfoDao {
List<MallGoodsProductDO> listIndustryProductList(List<Integer> industrySpecIds);
List<GoodsInfo> ListGoodsInfoByCategoryId(Integer id);
List<MallProdSkuInfoSpecDO> getMallProSkuInfoSpec(Integer goodsInfoId);
}
......
......@@ -551,22 +551,41 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
private List<GoodsSpecDTO> getProductSpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定sku的信息
List<MallProdInfoDO> mallProSkuInfo = goodsInfoDao.getMallProSkuInfo(goodsInfoId);
// 获取该产品下的规格id
Map<Integer, String> specIdsMap = mallProSkuInfo.stream().collect(Collectors.toMap(MallProdInfoDO::getId, MallProdInfoDO::getProductSpecIdList));
List<GoodsSpecDTO> list = mallProSkuInfo.stream().map(MallProdInfoDO::buildGoodsSpecDTO).collect(Collectors.toList());
for (GoodsSpecDTO goodsSpecDTO : list) {
String specIds = specIdsMap.get(goodsSpecDTO.getId());
String[] ids = specIds.split(",");
List<Integer> idList = new ArrayList<>();
for (String id : ids) {
idList.add(Integer.parseInt(id));
List<MallProdInfoDO> mallProdSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsInfoId);
List<GoodsSpecDTO> list = mallProdSkuInfoList.stream().map(MallProdInfoDO::buildGoodsSpecDTO).collect(Collectors.toList());
// 获取规格来源详细信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpec = goodsInfoDao.getMallProSkuInfoSpec(goodsInfoId);
// 根据id查询出规格的具体信息
list = list.stream().peek(d -> {
List<MallProductSpecDTO> specList = new ArrayList<>();
for (MallProdSkuInfoSpecDO e : mallProdSkuInfoSpec) {
if (d.getId().equals(e.getMallProdSkuInfoId())) {
// 构建规格对象
ProductSpecDO productSpecDO = e.getProductSpecDO();
MallProductSpecDTO productSpecDTO = productSpecDO.buildMallProductSpecDTO();
productSpecDTO.setProductSkuId(d.getSkuId());
productSpecDTO.setId(e.getId());
productSpecDTO.setProductSpec(e.getProductSpecId());
if (d.getFlag().equals(1)) {
// 获取自定义sku下规格的价格配置信息
ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(e.getProductSpecId());
List<ProductSpecPriceDO> productSpecPrice = productDao.getProductSpecPrice(productSpecCPQVO);
List<SpecPriceVO> collect = productSpecPrice.stream().map(m -> {
SpecPriceVO specPriceVO = new SpecPriceVO();
specPriceVO.setId(m.getId());
specPriceVO.setPrice(m.getPrice());
specPriceVO.setCooperationTag(m.getCooperationTag());
return specPriceVO;
}).collect(Collectors.toList());
productSpecCPQVO.setSpecPrice(collect);
productSpecDTO.setProductSpecCPQVO(productSpecCPQVO);
}
specList.add(productSpecDTO);
}
}
// 根据specIds集合找出spec的信息
List<ProductSpecDO> productSpecDOS = productDao.listProductSpecInfo(idList);
List<MallProductSpecDTO> mallProductSpecList = productSpecDOS.stream().map(ProductSpecDO::buildMallProductSpecDTO).collect(Collectors.toList());
goodsSpecDTO.setProductSpecList(mallProductSpecList);
}
d.setProductSpecList(specList);
}).collect(Collectors.toList());
return list;
}
......@@ -595,6 +614,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
/**
* 根据商品id,商品规格id查询并填充相关信息
*
* @param param
* @return
*/
......
......@@ -6,7 +6,7 @@ spring:
username: tmj
password: MMC@2022&MYSQL
redis:
database: 3
database: 1
host: redis.default
port: 6379
password: MMC@2022&REDIS
......
......@@ -6,7 +6,7 @@ spring:
username: tmj
password: MMC@2022&MYSQL
redis:
database: 3
database: 1
host: redis.default
port: 6379
password: MMC@2022&REDIS
......
......@@ -440,4 +440,17 @@
AND im.img_type = 0
WHERE gi.category_by_one = #{id}
</select>
<select id="getMallProSkuInfoSpec" resultType="com.mmc.pms.entity.MallProdSkuInfoSpecDO">
SELECT mp.id,
mp.mall_prod_info_id,
mp.product_spec_id,
ps.part_no,
ps.spec_image,
ps.spec_name,
ps.version_desc
FROM mall_prod_info_spec mp
INNER JOIN product_spec ps ON mp.product_spec_id = ps.id
WHERE mp.goods_info_id = #{id}
AND mp.is_deleted = 0
</select>
</mapper>
......@@ -6,4 +6,4 @@ data-filter:
- /pms/doc.html
- /pms/swagger-resources/**
- /pms/webjars/**
- /pms/product/spec/feignGetUnitPriceByTag
- /pms/product/spec/feignGetSpecLeaseUnitPrice
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论