revert Merge pull request '首页逻辑实现' (#7) from main-cx into main

Reviewed-on: #7
This commit is contained in:
2025-02-20 14:52:51 +08:00
parent 77509402c7
commit cfc986f8ab
7 changed files with 332 additions and 476 deletions

View File

@@ -3,7 +3,12 @@ package com.buy507.mall.portal.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.buy507.mall.common.api.CommonResult;
import com.buy507.mall.model.PmsProduct;
@@ -91,30 +96,4 @@ public class HomeController {
return CommonResult.success(productSku);
}
@ApiOperation("获取会员专区商品")
@RequestMapping(value = "/getVipProductList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> getVipProductList(){
List<PmsProduct> productList = homeService.getVipProductList();
return CommonResult.success(productList);
}
@ApiOperation("获取积分专区商品")
@RequestMapping(value = "/getPointProductList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> getPointProductList(){
List<PmsProduct> productList = homeService.getPointProductList();
return CommonResult.success(productList);
}
@ApiOperation("获取积分兑换专区")
@RequestMapping(value = "/getPointExchangeProductList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<PmsProduct>> getPointExchangeProductList(){
List<PmsProduct> productList = homeService.getPointExchangeProductList();
return CommonResult.success(productList);
}
}

View File

@@ -40,34 +40,4 @@ public interface HomeDao {
* 获取所有商品信息按销量排序
*/
List<PmsProduct> getAllPioductList();
/**
* 获取会员专区
*/
List<PmsProduct> getProductVipStatus(@Param("offset") Integer offset,@Param("limit") Integer limit);
/**
* 获取积分专区
*/
List<PmsProduct> getProductpointSareaStatus(@Param("offset") Integer offset,@Param("limit") Integer limit);
/**
* 获取积分兑换专区
*/
List<PmsProduct> getProductpointsExchangeStatus(@Param("offset") Integer offset,@Param("limit") Integer limit);
/**
* 获取会员专区详情
*/
List<PmsProduct> getVipStatusList();
/**
*获取积分专区商品
*/
List<PmsProduct> getPointStatusList();
/**
*获取积分兑换专区商品
*/
List<PmsProduct> getPointExchangeProductList();
}

View File

@@ -27,12 +27,6 @@ public class HomeContentResult {
private List<PmsProduct> hotProductList;
//推荐专题
private List<CmsSubject> subjectList;
//会员专区
private List<PmsProduct> vipProductList;
//积分专区
private List<PmsProduct> pointsAreaProductList;
//积分兑换专区
private List<PmsProduct> pointsExchangeProductList;
//查询所有商品按销量排序
private List<PmsProduct> allProductList;
}

View File

@@ -40,21 +40,9 @@ public interface HomeService {
* @param productId
* @return
*/
/**
* 获取会员专区商品
* @param
* @return
*/
List<PmsProduct> getVipProductList();
ProductDetailResult getProductInfo(Long productId);
ProductSkuResult getProductSku(Long productId, String sp1, String sp2, String sp3);
List<PmsProduct> getProductList(Long brandId, Long categoryId, String sortType, Integer pageSize, Integer pageNum);
List<PmsProduct> getPointProductList();
List<PmsProduct> getPointExchangeProductList();
}

View File

@@ -118,9 +118,8 @@ public class HomeServiceImpl implements HomeService {
//获取秒杀信息
result.setHomeFlashPromotion(getHomeFlashPromotion());
List<PmsProduct> VipProductList = homeDao.getProductVipStatus(0, 4);
List<PmsProduct> PointAreaProductList = homeDao.getProductpointSareaStatus(0, 4);
List<PmsProduct> pointsExchangeProductList = homeDao.getProductpointsExchangeStatus(0, 4);
List<PmsProduct> newProductList = homeDao.getNewProductList(0, 4);
List<PmsProduct> hotProductList = homeDao.getHotProductList(0, 4);
List<PmsProduct> allProductList = homeDao.getAllPioductList();
//根据会员等级显示不同的商品价格
@@ -128,13 +127,10 @@ public class HomeServiceImpl implements HomeService {
if(member != null) {
BigDecimal discount = commonService.getDiscount(member.getId());
if(discount != null) {
for (PmsProduct product : VipProductList) {
for(PmsProduct product : newProductList) {
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
}
for (PmsProduct product : PointAreaProductList) {
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
}
for (PmsProduct product : pointsExchangeProductList) {
for(PmsProduct product : hotProductList) {
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
}
for(PmsProduct product : allProductList) {
@@ -143,12 +139,10 @@ public class HomeServiceImpl implements HomeService {
}
}
//获取会员商品
result.setVipProductList(VipProductList);
//获取积分专区商品
result.setPointsAreaProductList(PointAreaProductList);
//获取积分兑换商品
result.setPointsExchangeProductList(pointsExchangeProductList);
//获取新品推荐
result.setNewProductList(newProductList);
//获取人气推荐
result.setHotProductList(hotProductList);
//获取推荐专题
//result.setSubjectList(homeDao.getRecommendSubjectList(0,4));
//获取上次所有商品,按销量排序
@@ -186,29 +180,6 @@ public class HomeServiceImpl implements HomeService {
return options;
}
/**
*获取会员专区商品
*/
@Override
public List<PmsProduct> getVipProductList() {
return homeDao.getVipStatusList();
}
/**
*获取积分专区商品
*/
@Override
public List<PmsProduct> getPointProductList() {
return homeDao.getPointStatusList();
}
/**
*获取积分兑换专区
*/
@Override
public List<PmsProduct> getPointExchangeProductList() {
return homeDao.getPointExchangeProductList();
}
private ProductCategoryOptions recursionCategory(PmsProductCategory category, List<PmsProductCategory> list) {
List<ProductCategoryOptions> childList = new ArrayList<>();
// 为每一个父节点增加子树List形式没有则为空的list
@@ -321,7 +292,6 @@ public class HomeServiceImpl implements HomeService {
}
return null;
}
//获取商品详情
@Override
public ProductDetailResult getProductInfo(Long productId) {

View File

@@ -3,8 +3,6 @@ package com.buy507.mall.portal.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import com.alipay.api.AlipayApiException;
import com.alipay.api.internal.util.AlipaySignature;
import com.buy507.mall.common.api.CommonResult;
import com.buy507.mall.common.util.MD5Util;
import com.buy507.mall.mapper.*;
@@ -45,6 +43,9 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ExecutorService;
import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.AlipayApiException;
/**
* 前台订单管理Service
*/
@@ -747,7 +748,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
return CommonResult.validateFailed("未查询到商品信息");
}
PmsProduct product = productMapper.selectByPrimaryKey(skuStock.getProductId());
PmsProduct product = new PmsProduct();
// 判断商品是否属于积分兑换区
boolean isPointsExchangeStatus = product.getPointsExchangeStatus() == 1;

View File

@@ -61,6 +61,11 @@
WHERE
hp.recommend_status = 1
AND p.publish_status = 1
AND (
p.vip_status = 1 OR
p.points_area_status = 1 OR
p.points_exchange_status = 1
)
ORDER BY
hp.sort DESC
LIMIT #{offset}, #{limit};
@@ -79,55 +84,4 @@
LIMIT #{offset}, #{limit};
</select>
<select id="getProductVipStatus" resultType="com.buy507.mall.model.PmsProduct">
SELECT p.*
FROM
pms_product
WHERE
vip_status = 1
LIMIT #{offset}, #{limit};
</select>
<select id="getProductpointSareaStatus" resultType="com.buy507.mall.model.PmsProduct">
SELECT p.*
FROM
pms_product
WHERE
points_area_status = 1
LIMIT #{offset}, #{limit};
</select>
<select id="getProductpointsExchangeStatus" resultType="com.buy507.mall.model.PmsProduct">
SELECT p.*
FROM
pms_product
WHERE
points_exchange_status = 1
LIMIT #{offset}, #{limit};
</select>
<select id="getVipStatusList" resultType="com.buy507.mall.model.PmsProduct">
SELECT p.*
FROM
pms_product
WHERE
vip_status = 1
</select>
<select id="getPointStatusList" resultType="com.buy507.mall.model.PmsProduct">
SELECT p.*
FROM
pms_product
WHERE
points_area_status = 1
</select>
<select id="getPointExchangeProductList" resultType="com.buy507.mall.model.PmsProduct">
SELECT p.*
FROM
pms_product
WHERE
points_exchange_status = 1
</select>
</mapper>