增加商品热榜设置,并购物车按品牌区分
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
|||||||
|
package co.yixiang.app.modules.hotList.rest;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
|
||||||
|
import co.yixiang.annotation.AnonymousAccess;
|
||||||
|
import co.yixiang.modules.evaluation.service.YxEvaluationService;
|
||||||
|
import co.yixiang.modules.hotList.service.YxStoreHotListService;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListDto;
|
||||||
|
import co.yixiang.utils.EvaluationDTO;
|
||||||
|
import co.yixiang.utils.HotListDTO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 商品热榜控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author ssj
|
||||||
|
* @since 2022-10-8
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@Api(value = "商品热门榜单", tags = "商城:热门榜单")
|
||||||
|
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||||
|
public class AppStoreHotListController {
|
||||||
|
private final YxStoreHotListService yxStoreHotListService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 热门榜单列表
|
||||||
|
*/
|
||||||
|
@AnonymousAccess
|
||||||
|
@GetMapping("/hotList")
|
||||||
|
@ApiOperation(value = "热门榜单列表",notes = "热门榜单")
|
||||||
|
public ApiResult<List<HotListDTO>> getYxStoreHotList(){
|
||||||
|
return ApiResult.ok(yxStoreHotListService.getList());
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -10,6 +10,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,4 +40,14 @@ public class AppStoreBrandController {
|
|||||||
public ApiResult<List<BrandDTO>> getYxStoreBrandPageList(){
|
public ApiResult<List<BrandDTO>> getYxStoreBrandPageList(){
|
||||||
return ApiResult.ok(yxStoreBrandService.getList());
|
return ApiResult.ok(yxStoreBrandService.getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品品牌列表
|
||||||
|
*/
|
||||||
|
@AnonymousAccess
|
||||||
|
@GetMapping("/brand/{id}")
|
||||||
|
@ApiOperation(value = "商品品牌详情",notes = "商品品牌详情")
|
||||||
|
public ApiResult<BrandDTO> getYxStoreBrandById(@PathVariable String id){
|
||||||
|
return ApiResult.ok(yxStoreBrandService.getYxStoreBrandById(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ public class BxgIndexController {
|
|||||||
@ApiOperation(value = "首页数据",notes = "首页数据")
|
@ApiOperation(value = "首页数据",notes = "首页数据")
|
||||||
public ApiResult<IndexVo> index(){
|
public ApiResult<IndexVo> index(){
|
||||||
IndexVo indexVo = IndexVo.builder()
|
IndexVo indexVo = IndexVo.builder()
|
||||||
|
//首页图
|
||||||
.banner(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER))
|
.banner(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER))
|
||||||
.bastList(storeProductService.getList(1,6, ProductEnum.TYPE_1.getValue()))
|
.bastList(storeProductService.getList(1,6, ProductEnum.TYPE_1.getValue()))
|
||||||
.evaluationList(evaluationService.getList(1,5))
|
.evaluationList(evaluationService.getList(1,5))
|
||||||
@@ -101,6 +102,7 @@ public class BxgIndexController {
|
|||||||
.firstList(storeProductService.getList(1,6,ProductEnum.TYPE_3.getValue()))
|
.firstList(storeProductService.getList(1,6,ProductEnum.TYPE_3.getValue()))
|
||||||
.likeInfo(storeProductService.getList(1,80,ProductEnum.TYPE_2.getValue()))
|
.likeInfo(storeProductService.getList(1,80,ProductEnum.TYPE_2.getValue()))
|
||||||
.mapKey(systemConfigService.getData(ShopKeyUtils.getTengXunMapKey()))
|
.mapKey(systemConfigService.getData(ShopKeyUtils.getTengXunMapKey()))
|
||||||
|
//菜单
|
||||||
.menus(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_MENUS))
|
.menus(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_MENUS))
|
||||||
.roll(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_ROLL_NEWS))
|
.roll(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_ROLL_NEWS))
|
||||||
.seckillList(storeSeckillService.getList(1, 4))
|
.seckillList(storeSeckillService.getList(1, 4))
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class YxStoreCoupon extends BaseDomain {
|
|||||||
// @ApiModelProperty(value = "优惠券有效期限(单位:天)")
|
// @ApiModelProperty(value = "优惠券有效期限(单位:天)")
|
||||||
// private Integer couponTime;
|
// private Integer couponTime;
|
||||||
|
|
||||||
// /** 优惠券有效期限(单位:天) */
|
// /** 优惠券有效期限(单位:天) */
|
||||||
// @NotNull(message = "请输入有效期限")
|
// @NotNull(message = "请输入有效期限")
|
||||||
// @ApiModelProperty(value = "优惠券有效期限(单位:天;几号到几号)")
|
// @ApiModelProperty(value = "优惠券有效期限(单位:天;几号到几号)")
|
||||||
// private Object useTime;
|
// private Object useTime;
|
||||||
@@ -75,12 +75,12 @@ public class YxStoreCoupon extends BaseDomain {
|
|||||||
/** 优惠券开始使用期限(单位:天) */
|
/** 优惠券开始使用期限(单位:天) */
|
||||||
@NotNull(message = "请输入开始期限")
|
@NotNull(message = "请输入开始期限")
|
||||||
@ApiModelProperty(value = "优惠券使用期限(单位:天)")
|
@ApiModelProperty(value = "优惠券使用期限(单位:天)")
|
||||||
private Object useStartTime;
|
private String useStartTime;
|
||||||
|
|
||||||
/** 优惠券结束使用期限(单位:天) */
|
/** 优惠券结束使用期限(单位:天) */
|
||||||
@NotNull(message = "请输入有效结束期限")
|
@NotNull(message = "请输入有效结束期限")
|
||||||
@ApiModelProperty(value = "优惠券失效期限(单位:天)")
|
@ApiModelProperty(value = "优惠券失效期限(单位:天)")
|
||||||
private Object useEndTime;
|
private String useEndTime;
|
||||||
|
|
||||||
/** 排序 */
|
/** 排序 */
|
||||||
@ApiModelProperty(value = "排序")
|
@ApiModelProperty(value = "排序")
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public class StoreCouponController {
|
|||||||
return new ResponseEntity<>(yxStoreCouponService.save(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(yxStoreCouponService.save(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Log("修改")
|
@Log("修改")
|
||||||
@ApiOperation(value = "修改")
|
@ApiOperation(value = "修改")
|
||||||
@PutMapping(value = "/yxStoreCoupon")
|
@PutMapping(value = "/yxStoreCoupon")
|
||||||
|
|||||||
-1
@@ -218,7 +218,6 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
|
|||||||
// Date endTime = DateUtil.offsetDay(now,storeCoupon.getCouponTime());
|
// Date endTime = DateUtil.offsetDay(now,storeCoupon.getCouponTime());
|
||||||
|
|
||||||
// //有效期改为时间段,不需要偏移,切割开始日期和截止日期
|
// //有效期改为时间段,不需要偏移,切割开始日期和截止日期
|
||||||
// String[] time=storeCoupon.getUseTime().toString().split(",");
|
|
||||||
// DateTime endTime = new DateTime(time[1]);
|
// DateTime endTime = new DateTime(time[1]);
|
||||||
DateTime endTime =new DateTime(storeCoupon.getUseEndTime().toString());
|
DateTime endTime =new DateTime(storeCoupon.getUseEndTime().toString());
|
||||||
YxStoreCouponUser storeCouponUser = YxStoreCouponUser.builder()
|
YxStoreCouponUser storeCouponUser = YxStoreCouponUser.builder()
|
||||||
|
|||||||
+55
-9
@@ -34,7 +34,10 @@ import co.yixiang.modules.product.domain.YxStoreProduct;
|
|||||||
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
|
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
|
||||||
import co.yixiang.modules.product.service.YxStoreProductAttrService;
|
import co.yixiang.modules.product.service.YxStoreProductAttrService;
|
||||||
import co.yixiang.modules.product.service.YxStoreProductService;
|
import co.yixiang.modules.product.service.YxStoreProductService;
|
||||||
|
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
|
||||||
import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
|
import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
|
||||||
|
import co.yixiang.modules.store.domain.YxStoreBrand;
|
||||||
|
import co.yixiang.modules.store.service.mapper.YxStoreBrandMapper;
|
||||||
import co.yixiang.modules.user.service.YxUserService;
|
import co.yixiang.modules.user.service.YxUserService;
|
||||||
import co.yixiang.utils.FileUtil;
|
import co.yixiang.utils.FileUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -48,12 +51,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +63,11 @@ import java.util.stream.Collectors;
|
|||||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||||
public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxStoreCart> implements YxStoreCartService {
|
public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxStoreCart> implements YxStoreCartService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StoreProductMapper storeProductMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YxStoreBrandMapper yxStoreBrandMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IGenerator generator;
|
private IGenerator generator;
|
||||||
|
|
||||||
@@ -146,7 +149,7 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
|
|||||||
*
|
*
|
||||||
* @param uid 用户id
|
* @param uid 用户id
|
||||||
* @param cartIds 购物车id,多个逗号隔开
|
* @param cartIds 购物车id,多个逗号隔开
|
||||||
* @param status 0-购购物车列表
|
* @param status 0-购物车列表
|
||||||
* @return map valid-有效购物车 invalid-失效购物车
|
* @return map valid-有效购物车 invalid-失效购物车
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -250,8 +253,51 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("valid", valid);
|
//最终返回的有效商品的数组
|
||||||
map.put("invalid", invalid);
|
ArrayList cartList=new ArrayList<>();
|
||||||
|
//获取不重复的品牌id数组
|
||||||
|
LinkedHashSet<String> BrandIdList = new LinkedHashSet<>();
|
||||||
|
//有效商品
|
||||||
|
valid.forEach(item->{
|
||||||
|
YxStoreProduct storeProduct = storeProductMapper.selectById(item.getProductId());
|
||||||
|
BrandIdList.add(storeProduct.getBrandId());
|
||||||
|
});
|
||||||
|
//无效商品
|
||||||
|
invalid.forEach(item->{
|
||||||
|
YxStoreProduct storeProduct = storeProductMapper.selectById(item.getProductId());
|
||||||
|
BrandIdList.add(storeProduct.getBrandId());
|
||||||
|
});
|
||||||
|
BrandIdList.forEach(item->{
|
||||||
|
Map<String, Object> map1 = new LinkedHashMap<>();
|
||||||
|
YxStoreBrand yxStoreBrand=yxStoreBrandMapper.selectById(item);
|
||||||
|
Map<String, Object> list = new LinkedHashMap<>();
|
||||||
|
list.put("brandName",yxStoreBrand.getBrandName());
|
||||||
|
list.put("pic",yxStoreBrand.getPic());
|
||||||
|
map1.put("brand",list);
|
||||||
|
//对valid/invalid进行筛选,只要当前品牌下的商品
|
||||||
|
List<YxStoreCartQueryVo> validProductList = new ArrayList<>();
|
||||||
|
List<YxStoreCartQueryVo> invalidProductList = new ArrayList<>();
|
||||||
|
valid.forEach(item1->{
|
||||||
|
YxStoreProduct yxStoreProduct= storeProductMapper.selectById(item1.getProductId());;
|
||||||
|
// //商品品牌id相等
|
||||||
|
if (item.equals(yxStoreProduct.getBrandId())){
|
||||||
|
validProductList.add(item1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
invalid.forEach(item1->{
|
||||||
|
YxStoreProduct yxStoreProduct= storeProductMapper.selectById(item1.getProductId());;
|
||||||
|
//商品品牌id相等
|
||||||
|
if (item.equals(yxStoreProduct.getBrandId())){
|
||||||
|
invalidProductList.add(item1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map1.put("validProductList",validProductList);
|
||||||
|
map1.put("invalidProductList",invalidProductList);
|
||||||
|
cartList.add(map1);
|
||||||
|
});
|
||||||
|
// map.put("valid", valid);
|
||||||
|
// map.put("invalid", invalid);
|
||||||
|
map.put("cartList",cartList);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ public class YxEvaluation implements Serializable {
|
|||||||
private String videoInput;
|
private String videoInput;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 关联商品信息 */
|
/** 关联商品信息 */
|
||||||
@NotNull
|
@NotNull
|
||||||
private String product;
|
private String product;
|
||||||
|
|||||||
+1
-1
@@ -121,7 +121,7 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商户后台获取评测列表
|
* app获取评测列表
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.domain;
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ssj
|
||||||
|
* @date 2022-10-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("yx_store_hot_list")
|
||||||
|
public class YxStoreHotList implements Serializable {
|
||||||
|
|
||||||
|
/** 榜单列表ID */
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
/** 榜单名称 */
|
||||||
|
@NotBlank
|
||||||
|
private String listName;
|
||||||
|
|
||||||
|
|
||||||
|
/** 排序 */
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
|
/** 商品列表 */
|
||||||
|
private String productList;
|
||||||
|
|
||||||
|
|
||||||
|
/** 是否显示 */
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
|
|
||||||
|
/** 添加时间 */
|
||||||
|
@TableField(fill= FieldFill.INSERT)
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(fill= FieldFill.INSERT_UPDATE)
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
/** 删除状态 */
|
||||||
|
private Integer isDel;
|
||||||
|
|
||||||
|
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
public void copy(YxStoreHotList source){
|
||||||
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.rest;
|
||||||
|
|
||||||
|
import co.yixiang.domain.PageResult;
|
||||||
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
|
import co.yixiang.logging.aop.log.Log;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotList;
|
||||||
|
import co.yixiang.modules.hotList.service.YxStoreHotListService;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListDto;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListQueryCriteria;
|
||||||
|
import co.yixiang.modules.hotList.service.vo.YxStoreHotListVo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
/**
|
||||||
|
* @author ssj
|
||||||
|
* @date 2022-10-08
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Api(tags = "hotList管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/yxStoreHotList")
|
||||||
|
public class YxStoreHotListController {
|
||||||
|
|
||||||
|
private final YxStoreHotListService yxStoreHotListService;
|
||||||
|
private final IGenerator generator;
|
||||||
|
|
||||||
|
|
||||||
|
@Log("导出数据")
|
||||||
|
@ApiOperation("导出数据")
|
||||||
|
@GetMapping(value = "/download")
|
||||||
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:list')")
|
||||||
|
public void download(HttpServletResponse response, YxStoreHotListQueryCriteria criteria) throws IOException {
|
||||||
|
yxStoreHotListService.download(generator.convert(yxStoreHotListService.queryAll(criteria), YxStoreHotListDto.class), response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询hotList")
|
||||||
|
@ApiOperation("查询hotList")
|
||||||
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:list')")
|
||||||
|
public ResponseEntity<PageResult<YxStoreHotListVo>> getYxStoreHotLists(YxStoreHotListQueryCriteria criteria, Pageable pageable){
|
||||||
|
return new ResponseEntity<>(yxStoreHotListService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增hotList")
|
||||||
|
@ApiOperation("新增hotList")
|
||||||
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:add')")
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody YxStoreHotList resources){
|
||||||
|
return new ResponseEntity<>(yxStoreHotListService.save(resources),HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改hotList")
|
||||||
|
@ApiOperation("修改hotList")
|
||||||
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:edit')")
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody YxStoreHotList resources){
|
||||||
|
yxStoreHotListService.updateById(resources);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("删除hotList")
|
||||||
|
@ApiOperation("删除hotList")
|
||||||
|
// @PreAuthorize("@el.check('admin','yxStoreHotList:del')")
|
||||||
|
@DeleteMapping
|
||||||
|
public ResponseEntity<Object> deleteAll(@RequestBody Integer[] ids) {
|
||||||
|
Arrays.asList(ids).forEach(id->{
|
||||||
|
yxStoreHotListService.removeById(id);
|
||||||
|
});
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.service;
|
||||||
|
|
||||||
|
import co.yixiang.common.service.BaseService;
|
||||||
|
import co.yixiang.domain.PageResult;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotList;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListDto;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListQueryCriteria;
|
||||||
|
import co.yixiang.modules.hotList.service.vo.YxStoreHotListVo;
|
||||||
|
import co.yixiang.utils.HotListDTO;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* @author ssj
|
||||||
|
* @date 2022-10-08
|
||||||
|
*/
|
||||||
|
public interface YxStoreHotListService extends BaseService<YxStoreHotList> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
* @param criteria 条件
|
||||||
|
* @param pageable 分页参数
|
||||||
|
* @return Map<String,Object>
|
||||||
|
*/
|
||||||
|
PageResult<YxStoreHotListVo> queryAll(YxStoreHotListQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据不分页
|
||||||
|
* @param criteria 条件参数
|
||||||
|
* @return List<YxStoreHotListDto>
|
||||||
|
*/
|
||||||
|
List<YxStoreHotList> queryAll(YxStoreHotListQueryCriteria criteria);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
* @param all 待导出的数据
|
||||||
|
* @param response /
|
||||||
|
* @throws IOException /
|
||||||
|
*/
|
||||||
|
void download(List<YxStoreHotListDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
List<HotListDTO> getList();
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.service.dto;
|
||||||
|
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ssj
|
||||||
|
* @date 2022-10-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class YxStoreHotListDto implements Serializable {
|
||||||
|
|
||||||
|
/** 榜单列表ID */
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 榜单名称 */
|
||||||
|
private String listName;
|
||||||
|
|
||||||
|
/** 排序 */
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**商品列表*/
|
||||||
|
private String productList;
|
||||||
|
|
||||||
|
/** 是否显示 */
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
|
/** 添加时间 */
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
/** 删除状态 */
|
||||||
|
private Integer isDel;
|
||||||
|
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.service.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ssj
|
||||||
|
* @date 2022-10-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class YxStoreHotListQueryCriteria{
|
||||||
|
}
|
||||||
+130
@@ -0,0 +1,130 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.service.impl;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||||
|
import co.yixiang.common.utils.QueryHelpPlus;
|
||||||
|
import co.yixiang.domain.PageResult;
|
||||||
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
|
import co.yixiang.enums.ShopCommonEnum;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotList;
|
||||||
|
import co.yixiang.modules.hotList.service.YxStoreHotListService;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListDto;
|
||||||
|
import co.yixiang.modules.hotList.service.dto.YxStoreHotListQueryCriteria;
|
||||||
|
import co.yixiang.modules.hotList.service.mapper.YxStoreHotListMapper;
|
||||||
|
import co.yixiang.modules.hotList.service.vo.YxStoreHotListVo;
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
|
import co.yixiang.modules.product.service.YxStoreProductService;
|
||||||
|
import co.yixiang.utils.FileUtil;
|
||||||
|
import co.yixiang.utils.HotListDTO;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ssj
|
||||||
|
* @date 2022-10-08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
//@CacheConfig(cacheNames = "yxStoreHotList")
|
||||||
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||||
|
public class YxStoreHotListServiceImpl extends BaseServiceImpl<YxStoreHotListMapper, YxStoreHotList> implements YxStoreHotListService {
|
||||||
|
|
||||||
|
private final IGenerator generator;
|
||||||
|
private final YxStoreProductService yxStoreProductService;
|
||||||
|
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@Override
|
||||||
|
//@Cacheable
|
||||||
|
public PageResult<YxStoreHotListVo> queryAll(YxStoreHotListQueryCriteria criteria, Pageable pageable) {
|
||||||
|
getPage(pageable);
|
||||||
|
PageInfo<YxStoreHotList> page = new PageInfo<>(queryAll(criteria));
|
||||||
|
// PageInfo<YxStoreHotListVo> page1 = new PageInfo<>();
|
||||||
|
// BeanUtils.copyProperties(page,page1);
|
||||||
|
// BeanUtilsBean.getInstance().copyProperties(page1, page);
|
||||||
|
page.getList().forEach(hotList->{
|
||||||
|
List<Integer> productArr = JSONUtil.toList(hotList.getProductList(), Integer.class);
|
||||||
|
List<YxStoreProduct> list1 =new ArrayList<>();
|
||||||
|
productArr.forEach(productId->{
|
||||||
|
LambdaQueryWrapper<YxStoreProduct> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||||
|
.eq(YxStoreProduct::getId, productId);
|
||||||
|
//这里需要有一个非空判断
|
||||||
|
YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(Long.valueOf(productId));
|
||||||
|
list1.add(yxStoreProduct);
|
||||||
|
});
|
||||||
|
hotList.setProductList(JSONUtil.toJsonStr(list1));
|
||||||
|
// hotList.setProductInfo(list1);
|
||||||
|
});
|
||||||
|
return generator.convertPageInfo(page, YxStoreHotListVo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
//@Cacheable
|
||||||
|
public List<YxStoreHotList> queryAll(YxStoreHotListQueryCriteria criteria){
|
||||||
|
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreHotList.class, criteria));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(List<YxStoreHotListDto> all, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
for (YxStoreHotListDto yxStoreHotList : all) {
|
||||||
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("榜单名称", yxStoreHotList.getListName());
|
||||||
|
map.put("排序", yxStoreHotList.getSort());
|
||||||
|
map.put("商品列表", yxStoreHotList.getProductList());
|
||||||
|
map.put("是否显示", yxStoreHotList.getIsShow());
|
||||||
|
map.put("添加时间", yxStoreHotList.getCreateTime());
|
||||||
|
map.put(" updateTime", yxStoreHotList.getUpdateTime());
|
||||||
|
map.put("删除状态", yxStoreHotList.getIsDel());
|
||||||
|
map.put(" tenantId", yxStoreHotList.getTenantId());
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HotListDTO> getList() {
|
||||||
|
LambdaQueryWrapper<YxStoreHotList> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(YxStoreHotList::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||||
|
.orderByAsc(YxStoreHotList::getSort);
|
||||||
|
List<HotListDTO> list = generator.convert(baseMapper.selectList(wrapper),HotListDTO.class);
|
||||||
|
list.forEach(hotListDto->{
|
||||||
|
List<Integer> productArr = JSONUtil.toList(hotListDto.getProductList(), Integer.class);
|
||||||
|
List<YxStoreProduct> list1 =new ArrayList<>();
|
||||||
|
productArr.forEach(productId->{
|
||||||
|
//这里需要有一个非空判断
|
||||||
|
YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(Long.valueOf(productId));
|
||||||
|
list1.add(yxStoreProduct);
|
||||||
|
});
|
||||||
|
hotListDto.setProductInfo(list1);
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.hotList.service.mapper;
|
||||||
|
|
||||||
|
import co.yixiang.common.mapper.CoreMapper;
|
||||||
|
import co.yixiang.modules.hotList.domain.YxStoreHotList;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ssj
|
||||||
|
* @date 2022-10-08
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface YxStoreHotListMapper extends CoreMapper<YxStoreHotList> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package co.yixiang.modules.hotList.service.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class YxStoreHotListVo implements Serializable {
|
||||||
|
/** 榜单列表ID */
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 榜单名称 */
|
||||||
|
private String listName;
|
||||||
|
|
||||||
|
/** 排序 */
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**商品列表*/
|
||||||
|
private String productList;
|
||||||
|
|
||||||
|
/** 是否显示 */
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
|
/** 添加时间 */
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
|
/** 删除状态 */
|
||||||
|
private Integer isDel;
|
||||||
|
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
// private List<YxStoreProduct> productInfo;
|
||||||
|
}
|
||||||
+22
-4
@@ -27,7 +27,9 @@ import co.yixiang.enums.SortEnum;
|
|||||||
import co.yixiang.enums.SpecTypeEnum;
|
import co.yixiang.enums.SpecTypeEnum;
|
||||||
import co.yixiang.exception.BadRequestException;
|
import co.yixiang.exception.BadRequestException;
|
||||||
import co.yixiang.exception.ErrorRequestException;
|
import co.yixiang.exception.ErrorRequestException;
|
||||||
|
import co.yixiang.modules.activity.service.mapper.YxStoreBargainMapper;
|
||||||
import co.yixiang.modules.category.service.YxStoreCategoryService;
|
import co.yixiang.modules.category.service.YxStoreCategoryService;
|
||||||
|
import co.yixiang.modules.store.domain.YxStoreBrand;
|
||||||
import co.yixiang.modules.store.service.YxStoreBrandService;
|
import co.yixiang.modules.store.service.YxStoreBrandService;
|
||||||
import co.yixiang.modules.product.domain.YxStoreProduct;
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
|
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
|
||||||
@@ -53,6 +55,8 @@ import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo;
|
|||||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||||
import co.yixiang.modules.shop.service.YxSystemStoreService;
|
import co.yixiang.modules.shop.service.YxSystemStoreService;
|
||||||
import co.yixiang.modules.store.service.YxStoreBrandService;
|
import co.yixiang.modules.store.service.YxStoreBrandService;
|
||||||
|
import co.yixiang.modules.store.service.mapper.YxStoreBrandMapper;
|
||||||
|
import co.yixiang.modules.store.vo.YxStoreBrandVo;
|
||||||
import co.yixiang.modules.template.domain.YxShippingTemplates;
|
import co.yixiang.modules.template.domain.YxShippingTemplates;
|
||||||
import co.yixiang.modules.template.service.YxShippingTemplatesService;
|
import co.yixiang.modules.template.service.YxShippingTemplatesService;
|
||||||
import co.yixiang.modules.user.service.YxUserService;
|
import co.yixiang.modules.user.service.YxUserService;
|
||||||
@@ -90,6 +94,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
private IGenerator generator;
|
private IGenerator generator;
|
||||||
@Autowired
|
@Autowired
|
||||||
private StoreProductMapper storeProductMapper;
|
private StoreProductMapper storeProductMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YxStoreBrandMapper storeBrandMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private YxStoreCategoryService yxStoreCategoryService;
|
private YxStoreCategoryService yxStoreCategoryService;
|
||||||
|
|
||||||
@@ -243,9 +250,14 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
}
|
}
|
||||||
//多字段模糊查询分类搜索
|
//多字段模糊查询分类搜索
|
||||||
if (StrUtil.isNotBlank(productQueryParam.getSid()) &&
|
if (StrUtil.isNotBlank(productQueryParam.getSid()) &&
|
||||||
!ShopConstants.ZSW_ZERO.equals(productQueryParam.getSid())) {
|
!ShopConstants.ZSW_ZERO.equals(productQueryParam.getBid())) {
|
||||||
wrapper.eq(YxStoreProduct::getCateId, productQueryParam.getSid());
|
wrapper.eq(YxStoreProduct::getCateId, productQueryParam.getSid());
|
||||||
}
|
}
|
||||||
|
//品牌搜索
|
||||||
|
if (StrUtil.isNotBlank(productQueryParam.getBid()) &&
|
||||||
|
!ShopConstants.ZSW_ZERO.equals(productQueryParam.getSid())) {
|
||||||
|
wrapper.eq(YxStoreProduct::getBrandId, productQueryParam.getBid());
|
||||||
|
}
|
||||||
//关键字搜索
|
//关键字搜索
|
||||||
if (StrUtil.isNotEmpty(productQueryParam.getKeyword())) {
|
if (StrUtil.isNotEmpty(productQueryParam.getKeyword())) {
|
||||||
wrapper.and(wrapper1 -> {
|
wrapper.and(wrapper1 -> {
|
||||||
@@ -303,19 +315,24 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ProductVo goodsDetail(Long id, Long uid, String latitude, String longitude) {
|
public ProductVo goodsDetail(Long id, Long uid, String latitude, String longitude) {
|
||||||
LambdaQueryWrapper<YxStoreProduct> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<YxStoreProduct> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||||
.eq(YxStoreProduct::getId, id);
|
.eq(YxStoreProduct::getId, id);
|
||||||
YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper);
|
YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper);
|
||||||
|
|
||||||
if (ObjectUtil.isNull(storeProduct)) {
|
if (ObjectUtil.isNull(storeProduct)) {
|
||||||
throw new ErrorRequestException("商品不存在或已下架");
|
throw new ErrorRequestException("商品不存在或已下架");
|
||||||
}
|
}
|
||||||
|
LambdaQueryWrapper<YxStoreBrand> wrapper1 = new LambdaQueryWrapper<>();
|
||||||
|
wrapper1.eq(YxStoreBrand::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||||
|
.eq(YxStoreBrand::getId, storeProduct.getBrandId());
|
||||||
|
YxStoreBrand storeBrand =storeBrandMapper.selectOne(wrapper1);
|
||||||
//获取商品sku
|
//获取商品sku
|
||||||
Map<String, Object> returnMap = yxStoreProductAttrService.getProductAttrDetail(id);
|
Map<String, Object> returnMap = yxStoreProductAttrService.getProductAttrDetail(id);
|
||||||
ProductVo productVo = new ProductVo();
|
ProductVo productVo = new ProductVo();
|
||||||
YxStoreProductQueryVo storeProductQueryVo = generator.convert(storeProduct, YxStoreProductQueryVo.class);
|
YxStoreProductQueryVo storeProductQueryVo = generator.convert(storeProduct, YxStoreProductQueryVo.class);
|
||||||
|
//获取商品品牌信息
|
||||||
|
YxStoreBrandVo yxStoreBrandVo =generator.convert(storeBrand,YxStoreBrandVo.class);
|
||||||
//设置销量
|
//设置销量
|
||||||
storeProductQueryVo.setSales(storeProductQueryVo.getSales() + storeProductQueryVo.getFicti());
|
storeProductQueryVo.setSales(storeProductQueryVo.getSales() + storeProductQueryVo.getFicti());
|
||||||
|
|
||||||
@@ -360,6 +377,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
productVo.setTempName(tempName);
|
productVo.setTempName(tempName);
|
||||||
|
|
||||||
//设置商品相关信息
|
//设置商品相关信息
|
||||||
|
productVo.setBrandInfo(yxStoreBrandVo);
|
||||||
productVo.setStoreInfo(storeProductQueryVo);
|
productVo.setStoreInfo(storeProductQueryVo);
|
||||||
productVo.setProductAttr((List<YxStoreProductAttrQueryVo>) returnMap.get("productAttr"));
|
productVo.setProductAttr((List<YxStoreProductAttrQueryVo>) returnMap.get("productAttr"));
|
||||||
productVo.setProductValue((Map<String, YxStoreProductAttrValue>) returnMap.get("productValue"));
|
productVo.setProductValue((Map<String, YxStoreProductAttrValue>) returnMap.get("productValue"));
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package co.yixiang.modules.product.vo;
|
package co.yixiang.modules.product.vo;
|
||||||
|
|
||||||
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
|
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
|
||||||
|
import co.yixiang.modules.store.domain.YxStoreBrand;
|
||||||
|
import co.yixiang.modules.store.vo.YxStoreBrandVo;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -47,6 +49,9 @@ public class ProductVo{
|
|||||||
@ApiModelProperty(value = "商品信息")
|
@ApiModelProperty(value = "商品信息")
|
||||||
private YxStoreProductQueryVo storeInfo;
|
private YxStoreProductQueryVo storeInfo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "品牌信息")
|
||||||
|
private YxStoreBrandVo brandInfo;
|
||||||
|
|
||||||
@ApiModelProperty(value = "腾讯地图key")
|
@ApiModelProperty(value = "腾讯地图key")
|
||||||
private String mapKey;
|
private String mapKey;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ public class YxSystemGroupDataServiceImpl extends BaseServiceImpl<SystemGroupDat
|
|||||||
.selectList(Wrappers.<YxSystemGroupData>lambdaQuery()
|
.selectList(Wrappers.<YxSystemGroupData>lambdaQuery()
|
||||||
.eq(YxSystemGroupData::getGroupName,name)
|
.eq(YxSystemGroupData::getGroupName,name)
|
||||||
.eq(YxSystemGroupData::getStatus,CommonEnum.SHOW_STATUS_1.getValue())
|
.eq(YxSystemGroupData::getStatus,CommonEnum.SHOW_STATUS_1.getValue())
|
||||||
.orderByDesc(YxSystemGroupData::getSort));
|
.orderByAsc(YxSystemGroupData::getSort));
|
||||||
|
|
||||||
List<JSONObject> list = systemGroupDatas
|
List<JSONObject> list = systemGroupDatas
|
||||||
.stream()
|
.stream()
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ public class YxStoreBrand implements Serializable {
|
|||||||
@TableId
|
@TableId
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
/** 品牌名称 */
|
/** 品牌名称 */
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String brandName;
|
private String brandName;
|
||||||
@@ -41,10 +40,11 @@ public class YxStoreBrand implements Serializable {
|
|||||||
/** 排序 */
|
/** 排序 */
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
/** 图标 */
|
/** 图标 */
|
||||||
private String pic;
|
private String pic;
|
||||||
|
|
||||||
|
/** 背景图片 */
|
||||||
|
private String backgroundImage;
|
||||||
|
|
||||||
/** 是否展示 */
|
/** 是否展示 */
|
||||||
private Integer isShow;
|
private Integer isShow;
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
public interface YxStoreBrandService extends BaseService<YxStoreBrand> {
|
public interface YxStoreBrandService extends BaseService<YxStoreBrand> {
|
||||||
|
|
||||||
List<BrandDTO> getList();
|
List<BrandDTO> getList();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
* @param criteria 条件
|
* @param criteria 条件
|
||||||
@@ -48,4 +49,6 @@ public interface YxStoreBrandService extends BaseService<YxStoreBrand> {
|
|||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
*/
|
*/
|
||||||
void download(List<YxStoreBrandDto> all, HttpServletResponse response) throws IOException;
|
void download(List<YxStoreBrandDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
BrandDTO getYxStoreBrandById(String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ public class YxStoreBrandDto implements Serializable {
|
|||||||
/** 图标 */
|
/** 图标 */
|
||||||
private String pic;
|
private String pic;
|
||||||
|
|
||||||
|
/**背景图 */
|
||||||
|
private String backgroundImage;
|
||||||
|
|
||||||
/** 是否推荐 */
|
/** 是否推荐 */
|
||||||
private Integer isShow;
|
private Integer isShow;
|
||||||
|
|
||||||
|
|||||||
+15
-2
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package co.yixiang.modules.store.service.impl;
|
package co.yixiang.modules.store.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||||
import co.yixiang.common.utils.QueryHelpPlus;
|
import co.yixiang.common.utils.QueryHelpPlus;
|
||||||
import co.yixiang.domain.PageResult;
|
import co.yixiang.domain.PageResult;
|
||||||
@@ -23,6 +24,7 @@ import co.yixiang.modules.store.service.YxStoreBrandService;
|
|||||||
import co.yixiang.modules.store.service.dto.YxStoreBrandDto;
|
import co.yixiang.modules.store.service.dto.YxStoreBrandDto;
|
||||||
import co.yixiang.modules.store.service.dto.YxStoreBrandQueryCriteria;
|
import co.yixiang.modules.store.service.dto.YxStoreBrandQueryCriteria;
|
||||||
import co.yixiang.modules.store.service.mapper.YxStoreBrandMapper;
|
import co.yixiang.modules.store.service.mapper.YxStoreBrandMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -48,8 +50,8 @@ import java.util.LinkedHashMap;
|
|||||||
public class YxStoreBrandServiceImpl extends BaseServiceImpl<YxStoreBrandMapper, YxStoreBrand> implements YxStoreBrandService {
|
public class YxStoreBrandServiceImpl extends BaseServiceImpl<YxStoreBrandMapper, YxStoreBrand> implements YxStoreBrandService {
|
||||||
|
|
||||||
private final IGenerator generator;
|
private final IGenerator generator;
|
||||||
|
@Autowired
|
||||||
|
private YxStoreBrandMapper yxStoreBrandMapper;
|
||||||
/**
|
/**
|
||||||
* 获取商家品牌树形列表
|
* 获取商家品牌树形列表
|
||||||
* @return List
|
* @return List
|
||||||
@@ -88,6 +90,7 @@ public class YxStoreBrandServiceImpl extends BaseServiceImpl<YxStoreBrandMapper,
|
|||||||
map.put("品牌名称", yxStoreBrand.getBrandName());
|
map.put("品牌名称", yxStoreBrand.getBrandName());
|
||||||
map.put("排序", yxStoreBrand.getSort());
|
map.put("排序", yxStoreBrand.getSort());
|
||||||
map.put("图标", yxStoreBrand.getPic());
|
map.put("图标", yxStoreBrand.getPic());
|
||||||
|
map.put("背景图", yxStoreBrand.getBackgroundImage());
|
||||||
map.put("是否推荐", yxStoreBrand.getIsShow());
|
map.put("是否推荐", yxStoreBrand.getIsShow());
|
||||||
map.put("添加时间", yxStoreBrand.getCreateTime());
|
map.put("添加时间", yxStoreBrand.getCreateTime());
|
||||||
map.put(" updateTime", yxStoreBrand.getUpdateTime());
|
map.put(" updateTime", yxStoreBrand.getUpdateTime());
|
||||||
@@ -97,4 +100,14 @@ public class YxStoreBrandServiceImpl extends BaseServiceImpl<YxStoreBrandMapper,
|
|||||||
}
|
}
|
||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BrandDTO getYxStoreBrandById(String id) {
|
||||||
|
LambdaQueryWrapper<YxStoreBrand> wrapper=new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(YxStoreBrand::getId,id);
|
||||||
|
YxStoreBrand yxStoreBrand=yxStoreBrandMapper.selectOne(wrapper);
|
||||||
|
BrandDTO brandDTO=new BrandDTO();
|
||||||
|
BeanUtil.copyProperties(yxStoreBrand,brandDTO);
|
||||||
|
return brandDTO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2018-2020
|
||||||
|
* All rights reserved, Designed By www.yixiang.co
|
||||||
|
* 注意:
|
||||||
|
* 本软件为www.yixiang.co开发研制,未经购买不得使用
|
||||||
|
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
|
||||||
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
|
*/
|
||||||
|
package co.yixiang.modules.store.vo;
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ssj
|
||||||
|
* @date 2022-09-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("yx_store_brand")
|
||||||
|
public class YxStoreBrandVo implements Serializable {
|
||||||
|
|
||||||
|
/** 商品品牌表ID */
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
/** 品牌名称 */
|
||||||
|
@NotBlank
|
||||||
|
private String brandName;
|
||||||
|
|
||||||
|
/** 品牌描述*/
|
||||||
|
private String brandDescription;
|
||||||
|
|
||||||
|
|
||||||
|
/** 图标 */
|
||||||
|
private String pic;
|
||||||
|
|
||||||
|
/** 图标 */
|
||||||
|
private String backgroundImage;
|
||||||
|
}
|
||||||
@@ -31,6 +31,13 @@ public class BrandDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String pic;
|
private String pic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 背景图url
|
||||||
|
*/
|
||||||
|
private String backgroundImage;
|
||||||
|
|
||||||
|
/** 品牌描述*/
|
||||||
|
private String brandDescription;
|
||||||
// private List<BrandDTO> children = new ArrayList<>();
|
// private List<BrandDTO> children = new ArrayList<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package co.yixiang.utils;
|
||||||
|
|
||||||
|
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Array;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HotListDTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
/** 榜单列表ID */
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 榜单名称 */
|
||||||
|
private String listName;
|
||||||
|
|
||||||
|
/**商品数组*/
|
||||||
|
private String productList;
|
||||||
|
|
||||||
|
// /**商品信息数组**/
|
||||||
|
private List<YxStoreProduct> productInfo;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user