Merge pull request '首页逻辑实现' (#7) from main-cx into main
Reviewed-on: #7
This commit is contained in:
@@ -3,12 +3,7 @@ package com.buy507.mall.portal.controller;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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.common.api.CommonResult;
|
||||||
import com.buy507.mall.model.PmsProduct;
|
import com.buy507.mall.model.PmsProduct;
|
||||||
@@ -96,4 +91,30 @@ public class HomeController {
|
|||||||
return CommonResult.success(productSku);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,5 +39,35 @@ public interface HomeDao {
|
|||||||
/*
|
/*
|
||||||
* 获取所有商品信息按销量排序
|
* 获取所有商品信息按销量排序
|
||||||
*/
|
*/
|
||||||
List<PmsProduct> getAllPioductList();
|
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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,12 @@ public class HomeContentResult {
|
|||||||
private List<PmsProduct> hotProductList;
|
private List<PmsProduct> hotProductList;
|
||||||
//推荐专题
|
//推荐专题
|
||||||
private List<CmsSubject> subjectList;
|
private List<CmsSubject> subjectList;
|
||||||
|
//会员专区
|
||||||
|
private List<PmsProduct> vipProductList;
|
||||||
|
//积分专区
|
||||||
|
private List<PmsProduct> pointsAreaProductList;
|
||||||
|
//积分兑换专区
|
||||||
|
private List<PmsProduct> pointsExchangeProductList;
|
||||||
//查询所有商品按销量排序
|
//查询所有商品按销量排序
|
||||||
private List<PmsProduct> allProductList;
|
private List<PmsProduct> allProductList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,21 @@ public interface HomeService {
|
|||||||
* @param productId
|
* @param productId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取会员专区商品
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PmsProduct> getVipProductList();
|
||||||
|
|
||||||
ProductDetailResult getProductInfo(Long productId);
|
ProductDetailResult getProductInfo(Long productId);
|
||||||
|
|
||||||
ProductSkuResult getProductSku(Long productId, String sp1, String sp2, String sp3);
|
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> getProductList(Long brandId, Long categoryId, String sortType, Integer pageSize, Integer pageNum);
|
||||||
|
|
||||||
|
List<PmsProduct> getPointProductList();
|
||||||
|
|
||||||
|
List<PmsProduct> getPointExchangeProductList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,232 +67,262 @@ import com.github.pagehelper.PageHelper;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class HomeServiceImpl implements HomeService {
|
public class HomeServiceImpl implements HomeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SmsHomeAdvertiseMapper advertiseMapper;
|
private SmsHomeAdvertiseMapper advertiseMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private HomeDao homeDao;
|
private HomeDao homeDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SmsFlashPromotionMapper flashPromotionMapper;
|
private SmsFlashPromotionMapper flashPromotionMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SmsFlashPromotionSessionMapper promotionSessionMapper;
|
private SmsFlashPromotionSessionMapper promotionSessionMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PmsProductMapper productMapper;
|
private PmsProductMapper productMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PmsProductCategoryMapper productCategoryMapper;
|
private PmsProductCategoryMapper productCategoryMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CmsSubjectMapper subjectMapper;
|
private CmsSubjectMapper subjectMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PmsCommentReplayMapper pmsCommentReplayMapper;
|
private PmsCommentReplayMapper pmsCommentReplayMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PmsCommentMapper pmsCommentMapper;
|
private PmsCommentMapper pmsCommentMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PmsProductFullReductionMapper pmsProductFullReductionMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PmsProductAttributeMapper pmsProductAttributeMapper;
|
private PmsProductFullReductionMapper pmsProductFullReductionMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PmsProductAttributeValueMapper productAttributeValueMapper;
|
private PmsProductAttributeMapper pmsProductAttributeMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberProductCollectionRepository productCollectionRepository;
|
private PmsProductAttributeValueMapper productAttributeValueMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PmsSkuStockMapper skuStockMapper;
|
private MemberProductCollectionRepository productCollectionRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UmsMemberService memberService;
|
private PmsSkuStockMapper skuStockMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private UmsMemberService memberService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
private PortalCommonService commonService;
|
private PortalCommonService commonService;
|
||||||
|
|
||||||
@Override
|
|
||||||
public HomeContentResult content() {
|
|
||||||
|
|
||||||
HomeContentResult result = new HomeContentResult();
|
|
||||||
//获取首页广告
|
|
||||||
result.setAdvertiseList(getHomeAdvertiseList());
|
|
||||||
//获取推荐品牌
|
|
||||||
result.setBrandList(homeDao.getRecommendBrandList(0,4));
|
|
||||||
//获取秒杀信息
|
|
||||||
result.setHomeFlashPromotion(getHomeFlashPromotion());
|
|
||||||
|
|
||||||
List<PmsProduct> newProductList = homeDao.getNewProductList(0, 4);
|
|
||||||
List<PmsProduct> hotProductList = homeDao.getHotProductList(0, 4);
|
|
||||||
List<PmsProduct> allProductList = homeDao.getAllPioductList();
|
|
||||||
|
|
||||||
//根据会员等级显示不同的商品价格
|
|
||||||
UmsMember member = memberService.getCurrentMember();
|
|
||||||
if(member != null) {
|
|
||||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
|
||||||
if(discount != null) {
|
|
||||||
for(PmsProduct product : newProductList) {
|
|
||||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
||||||
}
|
|
||||||
for(PmsProduct product : hotProductList) {
|
|
||||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
||||||
}
|
|
||||||
for(PmsProduct product : allProductList) {
|
|
||||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取新品推荐
|
|
||||||
result.setNewProductList(newProductList);
|
|
||||||
//获取人气推荐
|
|
||||||
result.setHotProductList(hotProductList);
|
|
||||||
//获取推荐专题
|
|
||||||
//result.setSubjectList(homeDao.getRecommendSubjectList(0,4));
|
|
||||||
//获取上次所有商品,按销量排序
|
|
||||||
result.setAllProductList(allProductList);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PmsProduct> recommendProductList(Integer pageSize, Integer pageNum) {
|
public HomeContentResult content() {
|
||||||
// TODO: 2019/1/29 暂时默认推荐所有商品
|
|
||||||
PageHelper.startPage(pageNum,pageSize);
|
|
||||||
PmsProductExample example = new PmsProductExample();
|
|
||||||
example.createCriteria()
|
|
||||||
.andDeleteStatusEqualTo(0)
|
|
||||||
.andPublishStatusEqualTo(1);
|
|
||||||
return productMapper.selectByExample(example);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
HomeContentResult result = new HomeContentResult();
|
||||||
public List<ProductCategoryOptions> getProductCateList() {
|
//获取首页广告
|
||||||
PmsProductCategoryExample example = new PmsProductCategoryExample();
|
result.setAdvertiseList(getHomeAdvertiseList());
|
||||||
example.createCriteria()
|
//获取推荐品牌
|
||||||
.andShowStatusEqualTo(1);
|
result.setBrandList(homeDao.getRecommendBrandList(0, 4));
|
||||||
example.setOrderByClause("sort desc");
|
//获取秒杀信息
|
||||||
List<PmsProductCategory> productCategories = productCategoryMapper.selectByExample(example);
|
result.setHomeFlashPromotion(getHomeFlashPromotion());
|
||||||
|
|
||||||
List<ProductCategoryOptions> options = new ArrayList<>();
|
|
||||||
for(PmsProductCategory category : productCategories) {
|
|
||||||
//我们这里最大的根节点ID是0,所以找出所有parent id为0的节点,然后调用我们的递归算法
|
|
||||||
if(category.getParentId().equals(0L)){
|
|
||||||
options.add(recursionCategory(category, productCategories));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ProductCategoryOptions recursionCategory(PmsProductCategory category, List<PmsProductCategory> list) {
|
|
||||||
List<ProductCategoryOptions> childList = new ArrayList<>();
|
|
||||||
// 为每一个父节点增加子树(List形式,没有则为空的list)
|
|
||||||
ProductCategoryOptions node = new ProductCategoryOptions();
|
|
||||||
node.setId(category.getId());
|
|
||||||
node.setName(category.getName());
|
|
||||||
node.setLevel(category.getLevel());
|
|
||||||
node.setIcon(category.getIcon());
|
|
||||||
node.setPid(category.getParentId());
|
|
||||||
for (PmsProductCategory childCategory : list){
|
|
||||||
//如果子节点的pid等于父节点的ID,则说明是父子关系
|
|
||||||
if(childCategory.getParentId().equals(category.getId())){
|
|
||||||
// 继续调用递归算法,将当前作为父节点,继续找他的子节点,反复执行。
|
|
||||||
childList.add(recursionCategory(childCategory, list));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 当遍历完成,返回调用的节点
|
|
||||||
if(!childList.isEmpty()) {
|
|
||||||
node.setChildren(childList);
|
|
||||||
} else {
|
|
||||||
node.setChildren(null);
|
|
||||||
}
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
List<PmsProduct> VipProductList = homeDao.getProductVipStatus(0, 4);
|
||||||
public List<CmsSubject> getSubjectList(Long cateId, Integer pageSize, Integer pageNum) {
|
List<PmsProduct> PointAreaProductList = homeDao.getProductpointSareaStatus(0, 4);
|
||||||
PageHelper.startPage(pageNum,pageSize);
|
List<PmsProduct> pointsExchangeProductList = homeDao.getProductpointsExchangeStatus(0, 4);
|
||||||
CmsSubjectExample example = new CmsSubjectExample();
|
List<PmsProduct> allProductList = homeDao.getAllPioductList();
|
||||||
CmsSubjectExample.Criteria criteria = example.createCriteria();
|
|
||||||
criteria.andShowStatusEqualTo(1);
|
|
||||||
if(cateId!=null){
|
|
||||||
criteria.andCategoryIdEqualTo(cateId);
|
|
||||||
}
|
|
||||||
return subjectMapper.selectByExample(example);
|
|
||||||
}
|
|
||||||
|
|
||||||
private HomeFlashPromotion getHomeFlashPromotion() {
|
//根据会员等级显示不同的商品价格
|
||||||
HomeFlashPromotion homeFlashPromotion = new HomeFlashPromotion();
|
UmsMember member = memberService.getCurrentMember();
|
||||||
//获取当前秒杀活动
|
if (member != null) {
|
||||||
Date now = new Date();
|
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||||
SmsFlashPromotion flashPromotion = getFlashPromotion(now);
|
if (discount != null) {
|
||||||
if (flashPromotion != null) {
|
for (PmsProduct product : VipProductList) {
|
||||||
//获取当前秒杀场次
|
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
SmsFlashPromotionSession flashPromotionSession = getFlashPromotionSession(now);
|
}
|
||||||
if (flashPromotionSession != null) {
|
for (PmsProduct product : PointAreaProductList) {
|
||||||
homeFlashPromotion.setStartTime(flashPromotionSession.getStartTime());
|
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
homeFlashPromotion.setEndTime(flashPromotionSession.getEndTime());
|
}
|
||||||
homeFlashPromotion.setName(flashPromotion.getTitle());
|
for (PmsProduct product : pointsExchangeProductList) {
|
||||||
//获取下一个秒杀场次
|
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
SmsFlashPromotionSession nextSession = getNextFlashPromotionSession(homeFlashPromotion.getStartTime());
|
}
|
||||||
if(nextSession!=null){
|
for (PmsProduct product : allProductList) {
|
||||||
homeFlashPromotion.setNextStartTime(nextSession.getStartTime());
|
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
homeFlashPromotion.setNextEndTime(nextSession.getEndTime());
|
}
|
||||||
}
|
}
|
||||||
//获取秒杀商品
|
}
|
||||||
List<FlashPromotionProduct> flashProductList = homeDao.getFlashProductList(flashPromotion.getId(), flashPromotionSession.getId());
|
|
||||||
homeFlashPromotion.setProductList(flashProductList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return homeFlashPromotion;
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取下一个场次信息
|
//获取会员商品
|
||||||
private SmsFlashPromotionSession getNextFlashPromotionSession(Date date) {
|
result.setVipProductList(VipProductList);
|
||||||
SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample();
|
//获取积分专区商品
|
||||||
sessionExample.createCriteria()
|
result.setPointsAreaProductList(PointAreaProductList);
|
||||||
.andStartTimeGreaterThan(date);
|
//获取积分兑换商品
|
||||||
sessionExample.setOrderByClause("start_time asc");
|
result.setPointsExchangeProductList(pointsExchangeProductList);
|
||||||
List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample);
|
//获取推荐专题
|
||||||
if (!CollectionUtils.isEmpty(promotionSessionList)) {
|
//result.setSubjectList(homeDao.getRecommendSubjectList(0,4));
|
||||||
return promotionSessionList.get(0);
|
//获取上次所有商品,按销量排序
|
||||||
}
|
result.setAllProductList(allProductList);
|
||||||
return null;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SmsHomeAdvertise> getHomeAdvertiseList() {
|
@Override
|
||||||
SmsHomeAdvertiseExample example = new SmsHomeAdvertiseExample();
|
public List<PmsProduct> recommendProductList(Integer pageSize, Integer pageNum) {
|
||||||
example.createCriteria().andTypeEqualTo(1).andStatusEqualTo(1);
|
// TODO: 2019/1/29 暂时默认推荐所有商品
|
||||||
example.setOrderByClause("sort desc");
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
return advertiseMapper.selectByExample(example);
|
PmsProductExample example = new PmsProductExample();
|
||||||
}
|
example.createCriteria()
|
||||||
|
.andDeleteStatusEqualTo(0)
|
||||||
|
.andPublishStatusEqualTo(1);
|
||||||
|
return productMapper.selectByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
//根据时间获取秒杀活动
|
@Override
|
||||||
private SmsFlashPromotion getFlashPromotion(Date date) {
|
public List<ProductCategoryOptions> getProductCateList() {
|
||||||
Date currDate = DateUtil.getDate(date);
|
PmsProductCategoryExample example = new PmsProductCategoryExample();
|
||||||
SmsFlashPromotionExample example = new SmsFlashPromotionExample();
|
example.createCriteria()
|
||||||
example.createCriteria()
|
.andShowStatusEqualTo(1);
|
||||||
.andStatusEqualTo(1)
|
example.setOrderByClause("sort desc");
|
||||||
.andStartDateLessThanOrEqualTo(currDate)
|
List<PmsProductCategory> productCategories = productCategoryMapper.selectByExample(example);
|
||||||
.andEndDateGreaterThanOrEqualTo(currDate);
|
|
||||||
List<SmsFlashPromotion> flashPromotionList = flashPromotionMapper.selectByExample(example);
|
|
||||||
if (!CollectionUtils.isEmpty(flashPromotionList)) {
|
|
||||||
return flashPromotionList.get(0);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//根据时间获取秒杀场次
|
List<ProductCategoryOptions> options = new ArrayList<>();
|
||||||
private SmsFlashPromotionSession getFlashPromotionSession(Date date) {
|
for (PmsProductCategory category : productCategories) {
|
||||||
Date currTime = DateUtil.getTime(date);
|
//我们这里最大的根节点ID是0,所以找出所有parent id为0的节点,然后调用我们的递归算法
|
||||||
SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample();
|
if (category.getParentId().equals(0L)) {
|
||||||
sessionExample.createCriteria()
|
options.add(recursionCategory(category, productCategories));
|
||||||
.andStartTimeLessThanOrEqualTo(currTime)
|
}
|
||||||
.andEndTimeGreaterThanOrEqualTo(currTime);
|
}
|
||||||
List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample);
|
|
||||||
if (!CollectionUtils.isEmpty(promotionSessionList)) {
|
return options;
|
||||||
return promotionSessionList.get(0);
|
}
|
||||||
}
|
|
||||||
return null;
|
/**
|
||||||
}
|
*获取会员专区商品
|
||||||
//获取商品详情
|
*/
|
||||||
|
@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)
|
||||||
|
ProductCategoryOptions node = new ProductCategoryOptions();
|
||||||
|
node.setId(category.getId());
|
||||||
|
node.setName(category.getName());
|
||||||
|
node.setLevel(category.getLevel());
|
||||||
|
node.setIcon(category.getIcon());
|
||||||
|
node.setPid(category.getParentId());
|
||||||
|
for (PmsProductCategory childCategory : list) {
|
||||||
|
//如果子节点的pid等于父节点的ID,则说明是父子关系
|
||||||
|
if (childCategory.getParentId().equals(category.getId())) {
|
||||||
|
// 继续调用递归算法,将当前作为父节点,继续找他的子节点,反复执行。
|
||||||
|
childList.add(recursionCategory(childCategory, list));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当遍历完成,返回调用的节点
|
||||||
|
if (!childList.isEmpty()) {
|
||||||
|
node.setChildren(childList);
|
||||||
|
} else {
|
||||||
|
node.setChildren(null);
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CmsSubject> getSubjectList(Long cateId, Integer pageSize, Integer pageNum) {
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
CmsSubjectExample example = new CmsSubjectExample();
|
||||||
|
CmsSubjectExample.Criteria criteria = example.createCriteria();
|
||||||
|
criteria.andShowStatusEqualTo(1);
|
||||||
|
if (cateId != null) {
|
||||||
|
criteria.andCategoryIdEqualTo(cateId);
|
||||||
|
}
|
||||||
|
return subjectMapper.selectByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
private HomeFlashPromotion getHomeFlashPromotion() {
|
||||||
|
HomeFlashPromotion homeFlashPromotion = new HomeFlashPromotion();
|
||||||
|
//获取当前秒杀活动
|
||||||
|
Date now = new Date();
|
||||||
|
SmsFlashPromotion flashPromotion = getFlashPromotion(now);
|
||||||
|
if (flashPromotion != null) {
|
||||||
|
//获取当前秒杀场次
|
||||||
|
SmsFlashPromotionSession flashPromotionSession = getFlashPromotionSession(now);
|
||||||
|
if (flashPromotionSession != null) {
|
||||||
|
homeFlashPromotion.setStartTime(flashPromotionSession.getStartTime());
|
||||||
|
homeFlashPromotion.setEndTime(flashPromotionSession.getEndTime());
|
||||||
|
homeFlashPromotion.setName(flashPromotion.getTitle());
|
||||||
|
//获取下一个秒杀场次
|
||||||
|
SmsFlashPromotionSession nextSession = getNextFlashPromotionSession(homeFlashPromotion.getStartTime());
|
||||||
|
if (nextSession != null) {
|
||||||
|
homeFlashPromotion.setNextStartTime(nextSession.getStartTime());
|
||||||
|
homeFlashPromotion.setNextEndTime(nextSession.getEndTime());
|
||||||
|
}
|
||||||
|
//获取秒杀商品
|
||||||
|
List<FlashPromotionProduct> flashProductList = homeDao.getFlashProductList(flashPromotion.getId(), flashPromotionSession.getId());
|
||||||
|
homeFlashPromotion.setProductList(flashProductList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return homeFlashPromotion;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取下一个场次信息
|
||||||
|
private SmsFlashPromotionSession getNextFlashPromotionSession(Date date) {
|
||||||
|
SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample();
|
||||||
|
sessionExample.createCriteria()
|
||||||
|
.andStartTimeGreaterThan(date);
|
||||||
|
sessionExample.setOrderByClause("start_time asc");
|
||||||
|
List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample);
|
||||||
|
if (!CollectionUtils.isEmpty(promotionSessionList)) {
|
||||||
|
return promotionSessionList.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SmsHomeAdvertise> getHomeAdvertiseList() {
|
||||||
|
SmsHomeAdvertiseExample example = new SmsHomeAdvertiseExample();
|
||||||
|
example.createCriteria().andTypeEqualTo(1).andStatusEqualTo(1);
|
||||||
|
example.setOrderByClause("sort desc");
|
||||||
|
return advertiseMapper.selectByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据时间获取秒杀活动
|
||||||
|
private SmsFlashPromotion getFlashPromotion(Date date) {
|
||||||
|
Date currDate = DateUtil.getDate(date);
|
||||||
|
SmsFlashPromotionExample example = new SmsFlashPromotionExample();
|
||||||
|
example.createCriteria()
|
||||||
|
.andStatusEqualTo(1)
|
||||||
|
.andStartDateLessThanOrEqualTo(currDate)
|
||||||
|
.andEndDateGreaterThanOrEqualTo(currDate);
|
||||||
|
List<SmsFlashPromotion> flashPromotionList = flashPromotionMapper.selectByExample(example);
|
||||||
|
if (!CollectionUtils.isEmpty(flashPromotionList)) {
|
||||||
|
return flashPromotionList.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据时间获取秒杀场次
|
||||||
|
private SmsFlashPromotionSession getFlashPromotionSession(Date date) {
|
||||||
|
Date currTime = DateUtil.getTime(date);
|
||||||
|
SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample();
|
||||||
|
sessionExample.createCriteria()
|
||||||
|
.andStartTimeLessThanOrEqualTo(currTime)
|
||||||
|
.andEndTimeGreaterThanOrEqualTo(currTime);
|
||||||
|
List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample);
|
||||||
|
if (!CollectionUtils.isEmpty(promotionSessionList)) {
|
||||||
|
return promotionSessionList.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取商品详情
|
||||||
@Override
|
@Override
|
||||||
public ProductDetailResult getProductInfo(Long productId) {
|
public ProductDetailResult getProductInfo(Long productId) {
|
||||||
PmsProduct product = productMapper.selectByPrimaryKey(productId);
|
PmsProduct product = productMapper.selectByPrimaryKey(productId);
|
||||||
@@ -301,15 +331,15 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
List<String> result = Arrays.asList(detailResult.getAlbumPics().toString().split(","));
|
List<String> result = Arrays.asList(detailResult.getAlbumPics().toString().split(","));
|
||||||
detailResult.setListAlbumPics(result);
|
detailResult.setListAlbumPics(result);
|
||||||
detailResult.setAlbumPics(null);
|
detailResult.setAlbumPics(null);
|
||||||
PmsProductFullReduction ppFullReduction =(PmsProductFullReduction)pmsProductFullReductionMapper.getPmsProductFullReduction(productId);
|
PmsProductFullReduction ppFullReduction = (PmsProductFullReduction) pmsProductFullReductionMapper.getPmsProductFullReduction(productId);
|
||||||
detailResult.setPmsProductFullReduction(ppFullReduction);//满减商品
|
detailResult.setPmsProductFullReduction(ppFullReduction);//满减商品
|
||||||
|
|
||||||
UmsMember currentMember = memberService.getCurrentMember();//获取用户信息
|
UmsMember currentMember = memberService.getCurrentMember();//获取用户信息
|
||||||
if(currentMember == null) {
|
if (currentMember == null) {
|
||||||
detailResult.setWhetherTheCollection(0);//默认商品未收藏,1代表收藏
|
detailResult.setWhetherTheCollection(0);//默认商品未收藏,1代表收藏
|
||||||
} else {
|
} else {
|
||||||
for(MemberProductCollection scproduct:productCollectionRepository.findByMemberId(currentMember.getId())){
|
for (MemberProductCollection scproduct : productCollectionRepository.findByMemberId(currentMember.getId())) {
|
||||||
if(productId==scproduct.getProductId()){
|
if (productId == scproduct.getProductId()) {
|
||||||
detailResult.setWhetherTheCollection(1);
|
detailResult.setWhetherTheCollection(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,19 +353,19 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
List<ProductAttributeResult> specChildList = new ArrayList<>();
|
List<ProductAttributeResult> specChildList = new ArrayList<>();
|
||||||
ProductAttributeResult spec = null;
|
ProductAttributeResult spec = null;
|
||||||
ProductAttributeResult specChild = null;
|
ProductAttributeResult specChild = null;
|
||||||
String array [] = null;
|
String array[] = null;
|
||||||
|
|
||||||
for(PmsProductAttribute attribute : attributeList) {
|
for (PmsProductAttribute attribute : attributeList) {
|
||||||
spec = new ProductAttributeResult();
|
spec = new ProductAttributeResult();
|
||||||
spec.setId(attribute.getId());
|
spec.setId(attribute.getId());
|
||||||
spec.setName(attribute.getName());
|
spec.setName(attribute.getName());
|
||||||
specList.add(spec);
|
specList.add(spec);
|
||||||
|
|
||||||
//属性录入方式:0->手工录入;1->从列表中选取
|
//属性录入方式:0->手工录入;1->从列表中选取
|
||||||
//是否支持手动新增;0->不支持;1->支持
|
//是否支持手动新增;0->不支持;1->支持
|
||||||
if(1 == attribute.getInputType() && 0 == attribute.getHandAddStatus()) {
|
if (1 == attribute.getInputType() && 0 == attribute.getHandAddStatus()) {
|
||||||
array = attribute.getInputList().split(",");
|
array = attribute.getInputList().split(",");
|
||||||
for(int i=0; i<array.length; i++) {
|
for (int i = 0; i < array.length; i++) {
|
||||||
specChild = new ProductAttributeResult();
|
specChild = new ProductAttributeResult();
|
||||||
specChild.setPid(attribute.getId());
|
specChild.setPid(attribute.getId());
|
||||||
specChild.setName(array[i]);
|
specChild.setName(array[i]);
|
||||||
@@ -345,9 +375,9 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
PmsProductAttributeValueExample attributeValueExample = new PmsProductAttributeValueExample();
|
PmsProductAttributeValueExample attributeValueExample = new PmsProductAttributeValueExample();
|
||||||
attributeValueExample.createCriteria().andProductIdEqualTo(product.getId()).andProductAttributeIdEqualTo(attribute.getId());
|
attributeValueExample.createCriteria().andProductIdEqualTo(product.getId()).andProductAttributeIdEqualTo(attribute.getId());
|
||||||
List<PmsProductAttributeValue> attributeValueList = productAttributeValueMapper.selectByExample(attributeValueExample);
|
List<PmsProductAttributeValue> attributeValueList = productAttributeValueMapper.selectByExample(attributeValueExample);
|
||||||
for(PmsProductAttributeValue value : attributeValueList) {
|
for (PmsProductAttributeValue value : attributeValueList) {
|
||||||
array = value.getValue().split(",");
|
array = value.getValue().split(",");
|
||||||
for(String s : array) {
|
for (String s : array) {
|
||||||
specChild = new ProductAttributeResult();
|
specChild = new ProductAttributeResult();
|
||||||
specChild.setPid(attribute.getId());
|
specChild.setPid(attribute.getId());
|
||||||
specChild.setName(s);
|
specChild.setName(s);
|
||||||
@@ -356,31 +386,31 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
detailResult.setSpecList(specList);
|
detailResult.setSpecList(specList);
|
||||||
detailResult.setSpecChildList(specChildList);
|
detailResult.setSpecChildList(specChildList);
|
||||||
List<PmsComment> pmsComment =(List<PmsComment>) pmsCommentMapper.getPmsComment(productId);//评论基础信息
|
List<PmsComment> pmsComment = (List<PmsComment>) pmsCommentMapper.getPmsComment(productId);//评论基础信息
|
||||||
if(pmsComment.size()>0){
|
if (pmsComment.size() > 0) {
|
||||||
int i=pmsCommentMapper.getCountComment(productId);//评论总数
|
int i = pmsCommentMapper.getCountComment(productId);//评论总数
|
||||||
int j=pmsCommentMapper.getApplauseCount(productId)*100/i;//好评率 好评数除以评论 总数 默认好评为大于等于2星
|
int j = pmsCommentMapper.getApplauseCount(productId) * 100 / i;//好评率 好评数除以评论 总数 默认好评为大于等于2星
|
||||||
detailResult.setCountComent(i);
|
detailResult.setCountComent(i);
|
||||||
detailResult.setApplauseRate(j);
|
detailResult.setApplauseRate(j);
|
||||||
for(int a=0;a<pmsComment.size();a++){
|
for (int a = 0; a < pmsComment.size(); a++) {
|
||||||
List<PmsCommentReplay> pcr =(List<PmsCommentReplay>) pmsCommentReplayMapper.getPmsCommentReplay(pmsComment.get(a).getId());
|
List<PmsCommentReplay> pcr = (List<PmsCommentReplay>) pmsCommentReplayMapper.getPmsCommentReplay(pmsComment.get(a).getId());
|
||||||
pmsComment.get(a).setPmsCommentReplay(pcr);//评论回复 逐个添加
|
pmsComment.get(a).setPmsCommentReplay(pcr);//评论回复 逐个添加
|
||||||
|
}
|
||||||
|
detailResult.setPmsComment(pmsComment);
|
||||||
}
|
}
|
||||||
detailResult.setPmsComment(pmsComment);
|
|
||||||
}
|
|
||||||
|
|
||||||
//根据会员等级显示不同的商品价格
|
//根据会员等级显示不同的商品价格
|
||||||
UmsMember member = memberService.getCurrentMember();
|
UmsMember member = memberService.getCurrentMember();
|
||||||
if(member != null) {
|
if (member != null) {
|
||||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||||
if(discount != null) {
|
if (discount != null) {
|
||||||
detailResult.setPrice(detailResult.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
detailResult.setPrice(detailResult.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return detailResult;
|
return detailResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,79 +419,79 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
PmsSkuStockExample example = new PmsSkuStockExample();
|
PmsSkuStockExample example = new PmsSkuStockExample();
|
||||||
PmsSkuStockExample.Criteria criteria = example.createCriteria();
|
PmsSkuStockExample.Criteria criteria = example.createCriteria();
|
||||||
criteria.andProductIdEqualTo(productId);
|
criteria.andProductIdEqualTo(productId);
|
||||||
if(!StringUtils.isEmpty(sp1)) { //mcoooo
|
if (!StringUtils.isEmpty(sp1)) { //mcoooo
|
||||||
criteria.andSp1EqualTo(sp1);
|
criteria.andSp1EqualTo(sp1);
|
||||||
}
|
}
|
||||||
if(!StringUtils.isEmpty(sp2)) { //mcoooo
|
if (!StringUtils.isEmpty(sp2)) { //mcoooo
|
||||||
criteria.andSp2EqualTo(sp2);
|
criteria.andSp2EqualTo(sp2);
|
||||||
}
|
}
|
||||||
if(!StringUtils.isEmpty(sp3)) {
|
if (!StringUtils.isEmpty(sp3)) {
|
||||||
criteria.andSp3EqualTo(sp3);
|
criteria.andSp3EqualTo(sp3);
|
||||||
}
|
}
|
||||||
List<PmsSkuStock> list = skuStockMapper.selectByExample(example);
|
List<PmsSkuStock> list = skuStockMapper.selectByExample(example);
|
||||||
ProductSkuResult skuResult = new ProductSkuResult();
|
ProductSkuResult skuResult = new ProductSkuResult();
|
||||||
for(PmsSkuStock stock : list) {
|
for (PmsSkuStock stock : list) {
|
||||||
BeanUtils.copyProperties(stock, skuResult);
|
BeanUtils.copyProperties(stock, skuResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据会员等级显示不同的商品价格
|
//根据会员等级显示不同的商品价格
|
||||||
UmsMember member = memberService.getCurrentMember();
|
UmsMember member = memberService.getCurrentMember();
|
||||||
if(member != null) {
|
if (member != null) {
|
||||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||||
if(discount != null) {
|
if (discount != null) {
|
||||||
skuResult.setPrice(skuResult.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
skuResult.setPrice(skuResult.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return skuResult;
|
return skuResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PmsProduct> getProductList(Long brandId, Long categoryId, String sortType,
|
public List<PmsProduct> getProductList(Long brandId, Long categoryId, String sortType,
|
||||||
Integer pageSize, Integer pageNum) {
|
Integer pageSize, Integer pageNum) {
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
PmsProductExample example = new PmsProductExample();
|
PmsProductExample example = new PmsProductExample();
|
||||||
PmsProductExample.Criteria criteria = example.createCriteria();
|
PmsProductExample.Criteria criteria = example.createCriteria();
|
||||||
criteria.andDeleteStatusEqualTo(0);
|
criteria.andDeleteStatusEqualTo(0);
|
||||||
if(brandId != null) {
|
if (brandId != null) {
|
||||||
criteria.andBrandIdEqualTo(brandId);
|
criteria.andBrandIdEqualTo(brandId);
|
||||||
}
|
}
|
||||||
if(categoryId != null) {
|
if (categoryId != null) {
|
||||||
criteria.andProductCategoryIdEqualTo(categoryId);
|
criteria.andProductCategoryIdEqualTo(categoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//综合排序
|
//综合排序
|
||||||
if("1".equals(sortType)) {
|
if ("1".equals(sortType)) {
|
||||||
example.setOrderByClause("id asc");
|
example.setOrderByClause("id asc");
|
||||||
}
|
}
|
||||||
//销量
|
//销量
|
||||||
if("2".equals(sortType)) {
|
if ("2".equals(sortType)) {
|
||||||
example.setOrderByClause("sale desc");
|
example.setOrderByClause("sale desc");
|
||||||
}
|
}
|
||||||
//价格升序
|
//价格升序
|
||||||
if("3".equals(sortType)) {
|
if ("3".equals(sortType)) {
|
||||||
example.setOrderByClause("price asc");
|
example.setOrderByClause("price asc");
|
||||||
}
|
}
|
||||||
//价格降序
|
//价格降序
|
||||||
if("4".equals(sortType)) {
|
if ("4".equals(sortType)) {
|
||||||
example.setOrderByClause("price desc");
|
example.setOrderByClause("price desc");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PmsProduct> productList = productMapper.selectByExample(example);
|
List<PmsProduct> productList = productMapper.selectByExample(example);
|
||||||
|
|
||||||
//根据会员等级显示不同的商品价格
|
//根据会员等级显示不同的商品价格
|
||||||
UmsMember member = memberService.getCurrentMember();
|
UmsMember member = memberService.getCurrentMember();
|
||||||
if(member != null) {
|
if (member != null) {
|
||||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||||
if(discount != null) {
|
if (discount != null) {
|
||||||
for(PmsProduct product : productList) {
|
for (PmsProduct product : productList) {
|
||||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return productList;
|
return productList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.buy507.mall.portal.service.impl;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
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.api.CommonResult;
|
||||||
import com.buy507.mall.common.util.MD5Util;
|
import com.buy507.mall.common.util.MD5Util;
|
||||||
import com.buy507.mall.mapper.*;
|
import com.buy507.mall.mapper.*;
|
||||||
@@ -43,9 +45,6 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
import com.alipay.api.internal.util.AlipaySignature;
|
|
||||||
import com.alipay.api.AlipayApiException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 前台订单管理Service
|
* 前台订单管理Service
|
||||||
*/
|
*/
|
||||||
@@ -364,41 +363,41 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|||||||
|
|
||||||
//支付类型: 0->未支付;1->支付宝;2->微信; 3->线下支付; 4->积分支付
|
//支付类型: 0->未支付;1->支付宝;2->微信; 3->线下支付; 4->积分支付
|
||||||
//判断是否为积分专区商品
|
//判断是否为积分专区商品
|
||||||
if(isPointsExchangeStatus) {
|
if (isPointsExchangeStatus) {
|
||||||
orderResult.setPayType(4); // 设置为积分支付
|
orderResult.setPayType(4); // 设置为积分支付
|
||||||
orderResult.setPayTypeName("积分支付");
|
orderResult.setPayTypeName("积分支付");
|
||||||
}else {
|
} else {
|
||||||
// 如果不是积分兑换专区商品,则继续使用其他支付方式
|
// 如果不是积分兑换专区商品,则继续使用其他支付方式
|
||||||
if (order.getPayType() != null) {
|
if (order.getPayType() != null) {
|
||||||
orderResult.setPayType(order.getPayType());
|
orderResult.setPayType(order.getPayType());
|
||||||
if (order.getPayType() == 0) {
|
if (order.getPayType() == 0) {
|
||||||
orderResult.setPayTypeName("未支付");
|
orderResult.setPayTypeName("未支付");
|
||||||
} else if (order.getPayType() == 1) {
|
} else if (order.getPayType() == 1) {
|
||||||
orderResult.setPayTypeName("支付宝支付");
|
orderResult.setPayTypeName("支付宝支付");
|
||||||
} else if (order.getPayType() == 2) {
|
} else if (order.getPayType() == 2) {
|
||||||
orderResult.setPayTypeName("微信支付");
|
orderResult.setPayTypeName("微信支付");
|
||||||
} else if (order.getPayType() == 3) { //mcoo todo
|
} else if (order.getPayType() == 3) { //mcoo todo
|
||||||
orderResult.setPayTypeName("线下支付");
|
orderResult.setPayTypeName("线下支付");
|
||||||
DmsOfflinePaymentRecord paymentRecord = offlinePaymentRecordMapper.selectOneByOrderId(orderId);
|
DmsOfflinePaymentRecord paymentRecord = offlinePaymentRecordMapper.selectOneByOrderId(orderId);
|
||||||
DmsSellerBankAccount bankAccount = sellerBankAccountMapper.selectOneById(paymentRecord.getSellerBankAccountId());
|
DmsSellerBankAccount bankAccount = sellerBankAccountMapper.selectOneById(paymentRecord.getSellerBankAccountId());
|
||||||
OfflinePaymentRecordResult recordResult = new OfflinePaymentRecordResult();
|
OfflinePaymentRecordResult recordResult = new OfflinePaymentRecordResult();
|
||||||
BeanUtils.copyProperties(paymentRecord, recordResult);
|
BeanUtils.copyProperties(paymentRecord, recordResult);
|
||||||
BeanUtils.copyProperties(bankAccount, recordResult);
|
BeanUtils.copyProperties(bankAccount, recordResult);
|
||||||
|
|
||||||
if (recordResult.getConfirmStatus() == 1) {
|
if (recordResult.getConfirmStatus() == 1) {
|
||||||
recordResult.setConfirmStatusName("已审核");
|
recordResult.setConfirmStatusName("已审核");
|
||||||
} else {
|
} else {
|
||||||
recordResult.setConfirmStatusName("未审核");
|
recordResult.setConfirmStatusName("未审核");
|
||||||
}
|
}
|
||||||
orderResult.setPaymentRecord(recordResult);
|
orderResult.setPaymentRecord(recordResult);
|
||||||
} else {
|
} else {
|
||||||
orderResult.setPayTypeName("积分支付");
|
orderResult.setPayTypeName("积分支付");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
orderResult.setPayType(0);
|
orderResult.setPayType(0);
|
||||||
orderResult.setPayTypeName("未支付");
|
orderResult.setPayTypeName("未支付");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
orderResult.setDeliveryTime(order.getDeliveryTime());
|
orderResult.setDeliveryTime(order.getDeliveryTime());
|
||||||
orderResult.setReceiveTime(order.getReceiveTime());
|
orderResult.setReceiveTime(order.getReceiveTime());
|
||||||
@@ -748,7 +747,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
|
|||||||
return CommonResult.validateFailed("未查询到商品信息");
|
return CommonResult.validateFailed("未查询到商品信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
PmsProduct product = new PmsProduct();
|
PmsProduct product = productMapper.selectByPrimaryKey(skuStock.getProductId());
|
||||||
|
|
||||||
// 判断商品是否属于积分兑换区
|
// 判断商品是否属于积分兑换区
|
||||||
boolean isPointsExchangeStatus = product.getPointsExchangeStatus() == 1;
|
boolean isPointsExchangeStatus = product.getPointsExchangeStatus() == 1;
|
||||||
|
|||||||
@@ -61,11 +61,6 @@
|
|||||||
WHERE
|
WHERE
|
||||||
hp.recommend_status = 1
|
hp.recommend_status = 1
|
||||||
AND p.publish_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
|
ORDER BY
|
||||||
hp.sort DESC
|
hp.sort DESC
|
||||||
LIMIT #{offset}, #{limit};
|
LIMIT #{offset}, #{limit};
|
||||||
@@ -83,5 +78,56 @@
|
|||||||
hs.sort DESC
|
hs.sort DESC
|
||||||
LIMIT #{offset}, #{limit};
|
LIMIT #{offset}, #{limit};
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
Reference in New Issue
Block a user