调整
This commit is contained in:
parent
517ade2842
commit
14afc9a83c
@ -82,8 +82,8 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
|
||||
/** 本地文件上传路径 */
|
||||
registry.addResourceHandler(Constants.UPLOAD_TYPE_IMAGE + "/**")
|
||||
.addResourceLocations("file:" + crmebConfig.getImagePath() + "/" + Constants.UPLOAD_TYPE_IMAGE + "/");
|
||||
registry.addResourceHandler(Constants.UPLOAD_TYPE_IMAGE + "/**").addResourceLocations("file:" + crmebConfig.getImagePath() + "/" + Constants.UPLOAD_TYPE_IMAGE + "/");
|
||||
registry.addResourceHandler(Constants.UPLOAD_TYPE_FILE + "/**").addResourceLocations("file:" + crmebConfig.getImagePath() + "/" + Constants.UPLOAD_TYPE_FILE + "/");
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -116,6 +116,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers("/api/admin/getLoginPic").permitAll()
|
||||
// 放行资源路径
|
||||
.antMatchers("/"+ Constants.UPLOAD_TYPE_IMAGE +"/**").anonymous()
|
||||
.antMatchers("/"+ Constants.UPLOAD_TYPE_FILE +"/**").anonymous()
|
||||
// 放行图片、文件上传
|
||||
.antMatchers("/api/admin/upload/image").permitAll()
|
||||
.antMatchers("/api/admin/upload/file").permitAll()
|
||||
|
@ -40,7 +40,7 @@ public class SystemAttachmentController {
|
||||
@RequestParam @Validated Integer pid,
|
||||
@RequestParam(
|
||||
value = "attType",
|
||||
defaultValue = "png,jpeg,jpg,audio/mpeg,text/plain,video/mp4,gif",
|
||||
defaultValue = "image_ext_str",
|
||||
required = false) String attType,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<SystemAttachment> systemAttachmentCommonPage =
|
||||
|
@ -246,9 +246,10 @@ public class Constants {
|
||||
public static final String CART_DEFAULT = "default";
|
||||
public static final String CART_SETMEAL = "setmeal";
|
||||
|
||||
// 楼层渠道
|
||||
public static final Integer HOME_TYPE_1 = 1;
|
||||
public static final Integer HOME_TYPE_2 = 2;
|
||||
// 展示渠道(1首页楼层,2随心配套餐层,3首页精品推荐)
|
||||
public static final String HOME_TYPE_1 = "1";
|
||||
public static final String HOME_TYPE_2 = "2";
|
||||
public static final String HOME_TYPE_3 = "3";
|
||||
|
||||
//config配置的formId
|
||||
public static final int CONFIG_FORM_ID_INDEX = 133; //首页配置
|
||||
|
@ -36,7 +36,7 @@ public class Home implements Serializable {
|
||||
/**
|
||||
* 列表路径
|
||||
*/
|
||||
private String directUrl;
|
||||
private String jumpUrl;
|
||||
/**
|
||||
* 是否有效 1:有效,0:无效
|
||||
*/
|
||||
@ -46,17 +46,17 @@ public class Home implements Serializable {
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 跳转id(list_ids/product_id)
|
||||
* 跳转参数(pId,cIds,pIds,hId)
|
||||
*/
|
||||
private String jumpIds;
|
||||
/**
|
||||
* 跳转类型1,列表0,详情
|
||||
* 跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目
|
||||
*/
|
||||
private Integer jumpType;
|
||||
/**
|
||||
* 渠道:【1首页楼层,2套餐分类层】
|
||||
* 展示渠道:【1首页楼层,2随心配套餐层,3首页精品推荐】
|
||||
*/
|
||||
private Integer type;
|
||||
private String channel;
|
||||
/**
|
||||
* 业务编号:【type=2 套餐分类(eb_category.id)】
|
||||
*/
|
||||
@ -72,6 +72,6 @@ public class Home implements Serializable {
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private List<HomeProducts> products;
|
||||
private List<HomeItem> products;
|
||||
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("eb_home_products")
|
||||
public class HomeProducts implements Serializable {
|
||||
@TableName("eb_home_item")
|
||||
public class HomeItem implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
@ -23,21 +23,33 @@ public class HomeProducts implements Serializable {
|
||||
*/
|
||||
private Integer homeId;
|
||||
/**
|
||||
* 产品编号
|
||||
* 名称
|
||||
*/
|
||||
private Integer productId;
|
||||
private String name;
|
||||
/**
|
||||
* 排序
|
||||
* 标题
|
||||
*/
|
||||
private Integer orderNo;
|
||||
private String title;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 跳转参数(pId,cIds,pIds,hId)
|
||||
*/
|
||||
private String jumpIds;
|
||||
/**
|
||||
* 跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目
|
||||
*/
|
||||
private Integer jumpType;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer orderNo;
|
||||
/**
|
||||
* 跳转地址
|
||||
*/
|
||||
private String directUrl;
|
||||
private String jumpUrl;
|
||||
/**
|
||||
* 是否有效 1:有效 0:无效
|
||||
*/
|
@ -1,7 +1,5 @@
|
||||
package com.zbkj.common.request;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -30,7 +28,7 @@ public class CategorySearchRequest implements Serializable {
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "类型ID | 类型,1 产品分类,2 附件分类,3 文章分类, 4 设置分类, 5 菜单分类, 6 配置分类, 7 秒杀配置")
|
||||
@ApiModelProperty(value = "类型ID | 1 产品分类,2 附件分类,4 设置分类, 5 菜单分类,6 配置分类,7 秒杀配置,8 套餐分类,9 帮助分类")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "状态, 1正常,0失效 -1全部")
|
||||
|
@ -6,17 +6,19 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SetMealRequest", description="套餐导航类型列表")
|
||||
public class SetMealFloorProRequest implements Serializable {
|
||||
@ApiModel(value="FloorProRequest", description="FloorProRequest")
|
||||
public class FloorProRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3481659942630712958L;
|
||||
|
||||
@ApiModelProperty(value = "楼层id")
|
||||
private String homeId;
|
||||
@ApiModelProperty(value = "楼层id", required = true)
|
||||
@NotNull(message = "楼层ID不能为空")
|
||||
private Integer homeId;
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.zbkj.common.request;
|
||||
|
||||
import com.zbkj.common.annotation.StringContains;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="FloorRequest", description="FloorRequest")
|
||||
public class FloorRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3481659942630712958L;
|
||||
|
||||
@ApiModelProperty(value = "门店id")
|
||||
private String storeId;
|
||||
|
||||
@ApiModelProperty(value = "类型id")
|
||||
private String cid;
|
||||
|
||||
@ApiModelProperty(value = "展示渠道:【1首页楼层,2随心配套餐层,3首页精品推荐】", required = true)
|
||||
@StringContains(limitValues = {"1","2","3"}, message = "未知的展示渠道")
|
||||
@NotNull(message = "展示渠道不能为空")
|
||||
private String channel;
|
||||
|
||||
public FloorRequest() {
|
||||
}
|
||||
|
||||
public FloorRequest(String channel, String storeId) {
|
||||
this.channel = channel;
|
||||
this.storeId = storeId;
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package com.zbkj.common.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="SetMealRequest", description="套餐导航类型列表")
|
||||
public class SetMealFloorRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3481659942630712958L;
|
||||
|
||||
@ApiModelProperty(value = "门店id")
|
||||
private String storeId;
|
||||
|
||||
@ApiModelProperty(value = "类型id")
|
||||
private String cid;
|
||||
|
||||
}
|
@ -126,4 +126,5 @@ public class StoreProductAddRequest implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "标签")
|
||||
private String tags;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.zbkj.common.response;
|
||||
|
||||
import com.zbkj.common.vo.HomeItemVo;
|
||||
import com.zbkj.common.vo.HomeVo;
|
||||
import com.zbkj.common.vo.product.ProductAttrVo;
|
||||
import com.zbkj.common.vo.product.ProductInfoVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@ -23,6 +25,11 @@ import java.util.List;
|
||||
@ApiModel(value="IndexProductResponse对象", description="首页商品对象")
|
||||
public class IndexProductResponse {
|
||||
|
||||
@ApiModelProperty(value = "轮播集合")
|
||||
private List<HomeVo> homeVos;
|
||||
|
||||
@ApiModelProperty(value = "类型:0商品,1轮播")
|
||||
private Integer type = 0;
|
||||
|
||||
@ApiModelProperty(value = "商品id")
|
||||
private Integer id;
|
||||
|
@ -94,6 +94,9 @@ public class StoreProductInfoResponse implements Serializable {
|
||||
@ApiModelProperty(value = "商品描述")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "质量检测")
|
||||
private String qualityTest;
|
||||
|
||||
@ApiModelProperty(value = "产品ID")
|
||||
private Integer productId;
|
||||
|
||||
|
@ -16,25 +16,40 @@ import java.util.List;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="HomeProductVo", description="楼层商品信息")
|
||||
public class HomeProductVo implements Serializable {
|
||||
public class HomeItemVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
/**
|
||||
* 产品编号
|
||||
* 标题
|
||||
*/
|
||||
@ApiModelProperty(value = "商品id")
|
||||
private Integer productId;
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 跳转地址
|
||||
* 跳转路径
|
||||
*/
|
||||
@ApiModelProperty(value = "跳转地址")
|
||||
private String directUrl;
|
||||
@ApiModelProperty(value = "跳转路径")
|
||||
private String jumpUrl;
|
||||
/**
|
||||
* 跳转参数(pId,cIds,pIds,hId)
|
||||
*/
|
||||
@ApiModelProperty(value = "跳转参数(pId,cIds,pIds,hId)")
|
||||
private String jumpIds;
|
||||
/**
|
||||
* 跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目
|
||||
*/
|
||||
@ApiModelProperty(value = "跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目")
|
||||
private Integer jumpType;
|
||||
|
||||
@ApiModelProperty(value = "类型 0商品,1轮播图")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "产品属性")
|
||||
private List<ProductAttrVo> productAttr;
|
@ -1,21 +1,13 @@
|
||||
package com.zbkj.common.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.zbkj.common.model.home.HomeProducts;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ -26,7 +18,7 @@ public class HomeVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private Integer id;
|
||||
private Integer homeId;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ -38,28 +30,28 @@ public class HomeVo implements Serializable {
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
/**
|
||||
* 列表路径
|
||||
* 跳转路径
|
||||
*/
|
||||
@ApiModelProperty(value = "列表路径")
|
||||
private String directUrl;
|
||||
@ApiModelProperty(value = "跳转路径")
|
||||
private String jumpUrl;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String imgUrl;
|
||||
/**
|
||||
* 跳转id(list_ids/product_id)
|
||||
* 跳转参数(pId,cIds,pIds,hId)
|
||||
*/
|
||||
@ApiModelProperty(value = "跳转id(list_ids/product_id)")
|
||||
@ApiModelProperty(value = "跳转参数(pId,cIds,pIds,hId)")
|
||||
private String jumpIds;
|
||||
/**
|
||||
* 跳转类型1,列表0,详情
|
||||
* 跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目
|
||||
*/
|
||||
@ApiModelProperty(value = "跳转类型1,列表0,详情")
|
||||
@ApiModelProperty(value = "跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目")
|
||||
private Integer jumpType;
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Object products;
|
||||
private List<HomeItemVo> items;
|
||||
|
||||
}
|
||||
|
@ -2,13 +2,13 @@ package com.zbkj.front.controller;
|
||||
|
||||
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.FloorProRequest;
|
||||
import com.zbkj.common.request.FloorRequest;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.SetMealFloorProRequest;
|
||||
import com.zbkj.common.request.SetMealFloorRequest;
|
||||
import com.zbkj.common.request.SetMealRequest;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.response.SetMealResponse;
|
||||
import com.zbkj.common.vo.HomeProductVo;
|
||||
import com.zbkj.common.vo.HomeItemVo;
|
||||
import com.zbkj.common.vo.HomeVo;
|
||||
import com.zbkj.service.service.EbHomeService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -24,30 +24,30 @@ import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController("HomeController")
|
||||
@RequestMapping("api/front")
|
||||
@RequestMapping("api/front/home")
|
||||
@Api(tags = "楼层")
|
||||
public class HomeController {
|
||||
|
||||
@Autowired private EbHomeService homeService;
|
||||
|
||||
@ApiOperation(value = "套餐导航列表-分页")
|
||||
@ApiOperation(value = "随心配套餐导航-分页")
|
||||
@RequestMapping(value = "/setMeal/type", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SetMealResponse>> selectPageSetMealType(@Validated SetMealRequest entity, @Validated PageParamRequest page) {
|
||||
List<SetMealResponse> list = homeService.selectPageSetMealType(entity, page);
|
||||
return CommonResult.success(CommonPage.restPage(list));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "套餐楼层列表-分页")
|
||||
@RequestMapping(value = "/setMeal/floor", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<HomeVo>> selectPageSetMealFloor(@Validated SetMealFloorRequest entity, @Validated PageParamRequest page) {
|
||||
List<HomeVo> list = homeService.selectPageSetMealFloor(entity, page);
|
||||
@ApiOperation(value = "楼层展示层-分页")
|
||||
@RequestMapping(value = "/floor", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<HomeVo>> selectPageFloor(@Validated FloorRequest entity, @Validated PageParamRequest page) {
|
||||
List<HomeVo> list = homeService.selectPageFloor(entity, page);
|
||||
return CommonResult.success(CommonPage.restPage(list));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "套餐楼层商品-分页")
|
||||
@RequestMapping(value = "/setMeal/floor/pro", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<HomeProductVo>> selectPageSetMealFloorPro(@Validated SetMealFloorProRequest entity, @Validated PageParamRequest page) {
|
||||
List<HomeProductVo> list = homeService.selectPageSetMealFloorPro(entity, page);
|
||||
@ApiOperation(value = "楼层商品层-分页")
|
||||
@RequestMapping(value = "/floor/pro", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<HomeItemVo>> selectPageFloorItem(@Validated FloorProRequest entity, @Validated PageParamRequest page) {
|
||||
List<HomeItemVo> list = homeService.selectPageFloorItem(entity, page);
|
||||
return CommonResult.success(CommonPage.restPage(list));
|
||||
}
|
||||
|
||||
|
@ -3,17 +3,13 @@ package com.zbkj.front.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.common.constants.CategoryConstants;
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.constants.RedisConstatns;
|
||||
import com.zbkj.common.constants.SysConfigConstants;
|
||||
import com.zbkj.common.model.category.Category;
|
||||
import com.zbkj.common.model.express.Express;
|
||||
import com.zbkj.common.model.product.StoreProduct;
|
||||
import com.zbkj.common.model.product.StoreProductAttr;
|
||||
import com.zbkj.common.model.product.StoreProductAttrValue;
|
||||
@ -21,15 +17,12 @@ import com.zbkj.common.model.record.UserVisitRecord;
|
||||
import com.zbkj.common.model.system.SystemUserLevel;
|
||||
import com.zbkj.common.model.user.User;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.GetReplyListRequest;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.ProductListRequest;
|
||||
import com.zbkj.common.request.ProductRequest;
|
||||
import com.zbkj.common.request.*;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.common.utils.CrmebUtil;
|
||||
import com.zbkj.common.utils.RedisUtil;
|
||||
import com.zbkj.common.vo.CategoryTreeVo;
|
||||
import com.zbkj.common.vo.HomeProductVo;
|
||||
import com.zbkj.common.vo.HomeVo;
|
||||
import com.zbkj.common.vo.MyRecord;
|
||||
import com.zbkj.common.vo.ReplyReviewTagsVo;
|
||||
import com.zbkj.common.vo.product.ProductDetailVo;
|
||||
@ -91,8 +84,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
@Autowired
|
||||
private UserVisitRecordService userVisitRecordService;
|
||||
|
||||
@Autowired
|
||||
private StoreProductProblemService storeProductProblemService;
|
||||
@Autowired private EbHomeService ebHomeService;
|
||||
|
||||
@Override
|
||||
public List<CategoryTreeVo> getCategoryTop() {
|
||||
@ -327,7 +319,9 @@ public class ProductServiceImpl implements ProductService {
|
||||
if (CollUtil.isEmpty(storeProductList)) {
|
||||
return CommonPage.restPage(new ArrayList<>());
|
||||
}
|
||||
return resultIndexProductResponse(storeProductList);
|
||||
CommonPage<IndexProductResponse> result = resultIndexProductResponse(storeProductList);
|
||||
addFloor(result.getList());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -343,6 +337,27 @@ public class ProductServiceImpl implements ProductService {
|
||||
return resultIndexProductResponse(storeProductList);
|
||||
}
|
||||
|
||||
private List<IndexProductResponse> addFloor(List<IndexProductResponse> list) {
|
||||
Random random = new Random();
|
||||
if (random.nextBoolean()) {
|
||||
FloorRequest floor = new FloorRequest();
|
||||
floor.setChannel(Constants.HOME_TYPE_3);
|
||||
PageParamRequest page = new PageParamRequest();
|
||||
page.setPage(random.nextInt(4));
|
||||
page.setLimit(2);
|
||||
List<HomeVo> homeVos = ebHomeService.selectPageFloor(floor, page);
|
||||
if (!homeVos.isEmpty()) {
|
||||
IndexProductResponse addItem = new IndexProductResponse();
|
||||
addItem.setHomeVos(homeVos);
|
||||
addItem.setType(1);
|
||||
list.add(addItem);
|
||||
// 使用Collections.shuffle()打乱列表
|
||||
Collections.shuffle(list);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private CommonPage<IndexProductResponse> resultIndexProductResponse(List<StoreProduct> storeProductList) {
|
||||
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
|
||||
Map<Integer, ProductDetailVo> skuDetails = storeProductService.getSkuDetails(storeProductList.stream().map(StoreProduct::getId).collect(Collectors.toList()));
|
||||
|
@ -2,7 +2,7 @@ package com.zbkj.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zbkj.common.model.home.Home;
|
||||
import com.zbkj.common.request.SetMealFloorRequest;
|
||||
import com.zbkj.common.request.FloorRequest;
|
||||
import com.zbkj.common.request.SetMealRequest;
|
||||
import com.zbkj.common.response.SetMealResponse;
|
||||
import com.zbkj.common.vo.HomeVo;
|
||||
@ -14,8 +14,6 @@ public interface HomeDao extends BaseMapper<Home> {
|
||||
|
||||
List<SetMealResponse> selectPageSetMealType(@Param("entity") SetMealRequest entity);
|
||||
|
||||
List<HomeVo> selectPageSetMealFloor(@Param("entity") SetMealFloorRequest entity);
|
||||
|
||||
List<HomeVo> selectHomeType(@Param("homeType") Integer homeType, @Param("storeId") Integer storeId);
|
||||
List<HomeVo> selectPageFloor(@Param("entity") FloorRequest entity);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.zbkj.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zbkj.common.model.home.HomeItem;
|
||||
import com.zbkj.common.vo.HomeItemVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HomeItemDao extends BaseMapper<HomeItem> {
|
||||
|
||||
List<HomeItemVo> selectHomeItem(Integer homeId);
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.zbkj.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zbkj.common.model.home.HomeProducts;
|
||||
import com.zbkj.common.vo.HomeProductVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HomeProductsDao extends BaseMapper<HomeProducts> {
|
||||
|
||||
List<HomeProductVo> selectHomeProduct(Integer homeId);
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package com.zbkj.service.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.common.model.home.HomeProducts;
|
||||
|
||||
public interface EbHomeProductsService extends IService<HomeProducts> {
|
||||
|
||||
}
|
||||
|
@ -2,12 +2,12 @@ package com.zbkj.service.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.common.model.home.Home;
|
||||
import com.zbkj.common.request.FloorProRequest;
|
||||
import com.zbkj.common.request.FloorRequest;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.request.SetMealFloorProRequest;
|
||||
import com.zbkj.common.request.SetMealFloorRequest;
|
||||
import com.zbkj.common.request.SetMealRequest;
|
||||
import com.zbkj.common.response.SetMealResponse;
|
||||
import com.zbkj.common.vo.HomeProductVo;
|
||||
import com.zbkj.common.vo.HomeItemVo;
|
||||
import com.zbkj.common.vo.HomeVo;
|
||||
|
||||
import java.util.List;
|
||||
@ -17,11 +17,11 @@ public interface EbHomeService extends IService<Home> {
|
||||
|
||||
List<SetMealResponse> selectPageSetMealType(SetMealRequest entity, PageParamRequest page);
|
||||
|
||||
List<HomeVo> selectPageSetMealFloor(SetMealFloorRequest entity, PageParamRequest page);
|
||||
|
||||
List<HomeProductVo> selectPageSetMealFloorPro(SetMealFloorProRequest entity, PageParamRequest page);
|
||||
List<HomeVo> selectPageFloor(FloorRequest entity, PageParamRequest page);
|
||||
|
||||
List<HomeVo> getIndexHomeList(Integer storeId);
|
||||
|
||||
List<HomeItemVo> selectPageFloorItem(FloorProRequest entity, PageParamRequest page);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
package com.zbkj.service.service.impl;
|
||||
|
||||
import com.zbkj.common.model.home.HomeProducts;
|
||||
import com.zbkj.service.dao.HomeProductsDao;
|
||||
import com.zbkj.service.service.EbHomeProductsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
@Service
|
||||
public class EbHomeProductsServiceImpl extends ServiceImpl<HomeProductsDao, HomeProducts> implements EbHomeProductsService {
|
||||
|
||||
}
|
@ -7,11 +7,11 @@ import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.*;
|
||||
import com.zbkj.common.response.*;
|
||||
import com.zbkj.common.utils.RedisUtil;
|
||||
import com.zbkj.common.vo.HomeProductVo;
|
||||
import com.zbkj.common.vo.HomeItemVo;
|
||||
import com.zbkj.common.vo.HomeVo;
|
||||
import com.zbkj.common.vo.product.ProductDetailVo;
|
||||
import com.zbkj.service.dao.HomeDao;
|
||||
import com.zbkj.service.dao.HomeProductsDao;
|
||||
import com.zbkj.service.dao.HomeItemDao;
|
||||
import com.zbkj.service.service.EbHomeService;
|
||||
import com.zbkj.service.service.StoreProductService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -28,21 +28,21 @@ public class EbHomeServiceImpl extends ServiceImpl<HomeDao, Home> implements EbH
|
||||
|
||||
@Autowired private RedisUtil redisUtil;
|
||||
@Autowired private HomeDao dao;
|
||||
@Autowired private HomeProductsDao homeProductsDao;
|
||||
@Autowired private HomeItemDao homeItemDao;
|
||||
@Autowired private StoreProductService productService;
|
||||
|
||||
@Override
|
||||
public List<HomeVo> getIndexHomeList(Integer storeId) {
|
||||
List<HomeVo> homeVos = dao.selectHomeType(Constants.HOME_TYPE_1, storeId);
|
||||
List<HomeVo> homeVos = dao.selectPageFloor(new FloorRequest(Constants.HOME_TYPE_1, storeId + ""));
|
||||
for (HomeVo homeVo : homeVos) {
|
||||
// 默认展示5个
|
||||
PageParamRequest fpPage = new PageParamRequest();
|
||||
fpPage.setPage(1);
|
||||
fpPage.setLimit(5);
|
||||
SetMealFloorProRequest fp = new SetMealFloorProRequest();
|
||||
fp.setHomeId(homeVo.getId().toString());
|
||||
List<HomeProductVo> fpResult = selectPageSetMealFloorPro(fp, fpPage);
|
||||
homeVo.setProducts(fpResult);
|
||||
FloorProRequest fp = new FloorProRequest();
|
||||
fp.setHomeId(homeVo.getHomeId());
|
||||
List<HomeItemVo> fpResult = selectPageFloorItem(fp, fpPage);
|
||||
homeVo.setItems(fpResult);
|
||||
}
|
||||
return homeVos;
|
||||
}
|
||||
@ -54,34 +54,39 @@ public class EbHomeServiceImpl extends ServiceImpl<HomeDao, Home> implements EbH
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HomeVo> selectPageSetMealFloor(SetMealFloorRequest entity, PageParamRequest page) {
|
||||
public List<HomeVo> selectPageFloor(FloorRequest entity, PageParamRequest page) {
|
||||
PageHelper.startPage(page.getPage(), page.getLimit());
|
||||
List<HomeVo> list = dao.selectPageSetMealFloor(entity);
|
||||
List<HomeVo> list = dao.selectPageFloor(entity);
|
||||
PageHelper.clearPage();
|
||||
for (HomeVo home : list) {
|
||||
// 默认展示6个
|
||||
PageParamRequest fpPage = new PageParamRequest();
|
||||
fpPage.setPage(1);
|
||||
fpPage.setLimit(6);
|
||||
SetMealFloorProRequest fp = new SetMealFloorProRequest();
|
||||
fp.setHomeId(home.getId().toString());
|
||||
List<HomeProductVo> fpResult = selectPageSetMealFloorPro(fp, fpPage);
|
||||
home.setProducts(CommonPage.restPage(fpResult));
|
||||
fpPage.setLimit(5);
|
||||
FloorProRequest fp = new FloorProRequest();
|
||||
fp.setHomeId(home.getHomeId());
|
||||
List<HomeItemVo> fpResult = selectPageFloorItem(fp, fpPage);
|
||||
home.setItems(fpResult);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HomeProductVo> selectPageSetMealFloorPro(SetMealFloorProRequest entity, PageParamRequest page) {
|
||||
public List<HomeItemVo> selectPageFloorItem(FloorProRequest entity, PageParamRequest page) {
|
||||
PageHelper.startPage(page.getPage(), page.getLimit());
|
||||
List<HomeProductVo> list = homeProductsDao.selectHomeProduct(Integer.parseInt(entity.getHomeId()));
|
||||
List<HomeItemVo> list = homeItemDao.selectHomeItem(entity.getHomeId());
|
||||
PageHelper.clearPage();
|
||||
Map<Integer, ProductDetailVo> skuDetails = productService.getSkuDetails(list.stream().map(HomeProductVo::getProductId).collect(Collectors.toList()));
|
||||
for (HomeProductVo product : list) {
|
||||
ProductDetailVo skuDetail = skuDetails.get(product.getProductId());
|
||||
product.setProductValue(skuDetail.getProductValue());
|
||||
product.setProductAttr(skuDetail.getProductAttr());
|
||||
product.setProductInfo(skuDetail.getProductInfo());
|
||||
List<HomeItemVo> proList = list.stream().filter(i -> i.getType() == 0).collect(Collectors.toList());
|
||||
if (!proList.isEmpty()) {
|
||||
List<Integer> pIds = proList.stream().map(HomeItemVo::getJumpIds).map(Integer::valueOf).collect(Collectors.toList());
|
||||
Map<Integer, ProductDetailVo> skuDetails = productService.getSkuDetails(pIds);
|
||||
for (HomeItemVo itemVo : list) {
|
||||
if (itemVo.getType() != 0) { continue; }
|
||||
ProductDetailVo skuDetail = skuDetails.get(Integer.parseInt(itemVo.getJumpIds()));
|
||||
itemVo.setProductValue(skuDetail.getProductValue());
|
||||
itemVo.setProductAttr(skuDetail.getProductAttr());
|
||||
itemVo.setProductInfo(skuDetail.getProductInfo());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -24,21 +24,16 @@ import com.zbkj.common.model.product.StoreProduct;
|
||||
import com.zbkj.common.model.product.StoreProductAttrValue;
|
||||
import com.zbkj.common.model.system.SystemUserLevel;
|
||||
import com.zbkj.common.model.user.User;
|
||||
import com.zbkj.common.vo.HomeProductVo;
|
||||
import com.zbkj.common.vo.HomeItemVo;
|
||||
import com.zbkj.common.vo.product.ProductAttrValueVo;
|
||||
import com.zbkj.service.dao.StoreCartDao;
|
||||
import com.zbkj.service.service.*;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -206,16 +201,16 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
|
||||
String business = storeCartRequest.getBusiness();
|
||||
List<CartRequest> cartList = storeCartRequest.getCartList();
|
||||
if (cartType.equals(Constants.CART_SETMEAL)) {
|
||||
SetMealFloorProRequest query = new SetMealFloorProRequest();
|
||||
query.setHomeId(business);
|
||||
FloorProRequest query = new FloorProRequest();
|
||||
query.setHomeId(Integer.parseInt(business));
|
||||
PageParamRequest page = new PageParamRequest();
|
||||
page.setPage(1);
|
||||
page.setLimit(999);
|
||||
List<HomeProductVo> list = homeService.selectPageSetMealFloorPro(query, page);
|
||||
cartList = list.stream().map(i -> {
|
||||
List<HomeItemVo> list = homeService.selectPageFloorItem(query, page);
|
||||
cartList = list.stream().filter(i-> i.getType() == 0).map(i -> {
|
||||
CartRequest cart = new CartRequest();
|
||||
cart.setCartNum(1);
|
||||
cart.setProductId(i.getProductId());
|
||||
cart.setProductId(Integer.parseInt(i.getJumpIds()));
|
||||
cart.setProductAttrUnique(((ProductAttrValueVo) i.getProductValue().get(i.getProductAttr().get(0).getAttrValues())).getId() + "");
|
||||
return cart;
|
||||
}).collect(Collectors.toList());
|
||||
|
@ -320,6 +320,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
storeProduct.setOtPrice(minAttrValue.getOtPrice());
|
||||
storeProduct.setCost(minAttrValue.getCost());
|
||||
storeProduct.setStock(attrValueAddRequestList.stream().mapToInt(StoreProductAttrValueAddRequest::getStock).sum());
|
||||
storeProduct.setQualityTest(systemAttachmentService.clearPrefix(storeProduct.getQualityTest()));
|
||||
|
||||
// 默认值设置
|
||||
if (ObjectUtil.isNull(request.getSort())) {
|
||||
@ -501,6 +502,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
storeProduct.setOtPrice(minAttrValue.getOtPrice());
|
||||
storeProduct.setCost(minAttrValue.getCost());
|
||||
storeProduct.setStock(attrValueAddRequestList.stream().mapToInt(StoreProductAttrValueAddRequest::getStock).sum());
|
||||
storeProduct.setQualityTest(systemAttachmentService.clearPrefix(storeProduct.getQualityTest()));
|
||||
|
||||
// attr部分
|
||||
List<StoreProductAttrAddRequest> addRequestList = storeProductRequest.getAttr();
|
||||
|
@ -60,7 +60,9 @@ public class SystemAttachmentServiceImpl extends ServiceImpl<SystemAttachmentDao
|
||||
LambdaQueryWrapper<SystemAttachment> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SystemAttachment::getPid, pid);
|
||||
if(StringUtils.isNotEmpty(attType)){
|
||||
lambdaQueryWrapper.in(SystemAttachment::getAttType, StringUtils.split(attType,","));
|
||||
// 根据前端提交的 image_ext_str / file_ext_str
|
||||
String extStr = systemConfigService.getValueByKey(attType);
|
||||
lambdaQueryWrapper.in(SystemAttachment::getAttType, StringUtils.split(extStr,","));
|
||||
}
|
||||
lambdaQueryWrapper.orderByDesc(SystemAttachment::getAttId);
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zbkj.service.dao.HomeItemDao">
|
||||
|
||||
<select id="selectHomeItem" resultType="com.zbkj.common.vo.HomeItemVo">
|
||||
select name, title, img_url imgUrl, jump_url jumpUrl, jump_ids jumpIds, jump_type jumpType, type from eb_home_item where home_id = #{id} and del_flag = 1 order by order_no
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -2,26 +2,28 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zbkj.service.dao.HomeDao">
|
||||
|
||||
<select id="selectHomeType" resultType="com.zbkj.common.vo.HomeVo">
|
||||
select id, name, title, direct_url directUrl, img_url imgUrl, jump_ids jumpIds, jump_type jumpType
|
||||
from eb_home
|
||||
where del_flag = 1 and type = #{homeType} order by order_no
|
||||
</select>
|
||||
|
||||
<select id="selectPageSetMealType" resultType="com.zbkj.common.response.SetMealResponse">
|
||||
select t.id cid, t.name from (
|
||||
select c.id, c.name, c.sort from eb_home h
|
||||
INNER JOIN eb_home_products hp on h.id = hp.home_id
|
||||
INNER JOIN eb_category c on h.business = c.id
|
||||
where h.del_flag = 1 and hp.del_flag = 1 and h.type = 2
|
||||
group by h.business
|
||||
select c.id, c.name, c.sort from eb_home h
|
||||
INNER JOIN eb_home_item hp on h.id = hp.home_id
|
||||
INNER JOIN eb_category c on h.business = c.id
|
||||
JOIN help_topic b ON b.help_topic_id <![CDATA[<]]> (length(h.channel) - length(replace(h.channel,',','')) + 1)
|
||||
where h.del_flag = 1 and hp.del_flag = 1
|
||||
and substring_index(SUBSTRING_INDEX(h.channel, ',', b.help_topic_id + 1), ',', -1) = 2
|
||||
group by h.business
|
||||
) t order by t.sort
|
||||
</select>
|
||||
|
||||
<select id="selectPageSetMealFloor" resultType="com.zbkj.common.vo.HomeVo">
|
||||
select h.id, h.name, h.title, h.direct_url directUrl, h.img_url imgUrl, h.jump_ids jumpIds, h.jump_type jumpType
|
||||
from eb_home h
|
||||
where h.del_flag = 1 and h.type = 2 and h.business = #{entity.cid} order by h.order_no
|
||||
<select id="selectPageFloor" resultType="com.zbkj.common.vo.HomeVo">
|
||||
select h.id homeId, h.name, h.title, h.img_url imgUrl, h.jump_type jumpType, h.jump_url jumpUrl, h.jump_ids jumpIds
|
||||
from eb_home h
|
||||
JOIN help_topic b ON b.help_topic_id <![CDATA[<]]> (length(h.channel) - length(replace(h.channel,',','')) + 1)
|
||||
where del_flag = 1
|
||||
and substring_index(SUBSTRING_INDEX(h.channel, ',', b.help_topic_id + 1), ',', -1) = #{entity.channel}
|
||||
and ((h.begin_time is null or h.end_time is null) or (h.begin_time <![CDATA[<=]]> NOW() and h.end_time >= NOW()))
|
||||
<if test="entity.channel == 2"> and h.business = #{entity.cid} </if>
|
||||
order by order_no
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zbkj.service.dao.HomeProductsDao">
|
||||
|
||||
<select id="selectHomeProduct" resultType="com.zbkj.common.vo.HomeProductVo">
|
||||
select product_id productId, img_url imgUrl, direct_url directUrl from eb_home_products where home_id = #{id} and del_flag = 1 order by order_no
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user