diff --git a/food-admin/src/main/java/com/zbkj/admin/config/SwaggerConfig.java b/food-admin/src/main/java/com/zbkj/admin/config/SwaggerConfig.java index 30bc0ed..5d7124e 100644 --- a/food-admin/src/main/java/com/zbkj/admin/config/SwaggerConfig.java +++ b/food-admin/src/main/java/com/zbkj/admin/config/SwaggerConfig.java @@ -94,8 +94,8 @@ public class SwaggerConfig{ private ApiInfo apiInfo() { return new ApiInfoBuilder() - .title("Crmeb Java") - .description("Crmeb") + .title("Food Admin Java") + .description("Food Admin") .termsOfServiceUrl("http://host:port") .version("1.0.0").build(); } diff --git a/food-common/src/main/java/com/zbkj/common/constants/Constants.java b/food-common/src/main/java/com/zbkj/common/constants/Constants.java index ff4e5d8..0023458 100644 --- a/food-common/src/main/java/com/zbkj/common/constants/Constants.java +++ b/food-common/src/main/java/com/zbkj/common/constants/Constants.java @@ -116,7 +116,7 @@ public class Constants { //城市数据 redis key public static final String CITY_LIST = "city_list"; //城市数据 tree redis key - public static final String CITY_LIST_TREE = "city_list_tree_2"; + public static final String CITY_LIST_TREE = "city_list_tree"; //城市数据 tree redis key public static final String CITY_LIST_LEVEL_1 = "city_list_level_1"; @@ -171,8 +171,8 @@ public class Constants { public static final String CONFIG_KEY_PAY_WE_CHAT_APP_APP_KEY = "pay_weixin_app_key"; //公众号支付key public static final String CONFIG_KEY_RECHARGE_MIN_AMOUNT = "store_user_min_recharge"; //最小充值金额 -// public static final String CONFIG_KEY_PROGRAM_LOGO = "routine_logo"; //小程序logo -// public static final String CONFIG_KEY_PUBLIC_LOGO = "wechat_avatar"; //公众号logo + // public static final String CONFIG_KEY_PROGRAM_LOGO = "routine_logo"; //小程序logo + // public static final String CONFIG_KEY_PUBLIC_LOGO = "wechat_avatar"; //公众号logo public static final String CONFIG_KEY_LOGISTICS_APP_CODE = "system_express_app_code"; //快递查询密钥 @@ -242,8 +242,6 @@ public class Constants { public static final String PRODUCT_TYPE_PINGTUAN_STR= "拼团"; public static final Integer PRODUCT_TYPE_COMPONENT= 4; public static final String PRODUCT_TYPE_COMPONENT_STR= "组件"; - public static final Integer PRODUCT_TYPE_FRUIT_EXCHANGE= 5; - public static final String PRODUCT_TYPE_FRUIT_EXCHANGE_STR= "茶果兑换"; public static final Integer PRODUCT_TYPE_GROUP = 0; // 楼层渠道 diff --git a/food-common/src/main/java/com/zbkj/common/request/PayComponentProductAddRequest.java b/food-common/src/main/java/com/zbkj/common/request/PayComponentProductAddRequest.java index 1a12d32..f500834 100644 --- a/food-common/src/main/java/com/zbkj/common/request/PayComponentProductAddRequest.java +++ b/food-common/src/main/java/com/zbkj/common/request/PayComponentProductAddRequest.java @@ -54,8 +54,7 @@ public class PayComponentProductAddRequest implements Serializable { @ApiModelProperty(value = "商品详情图片,多图") private String descImgs; - @ApiModelProperty(value = "运费模板ID", required = true) - @NotNull(message = "运费模板不能为空") + @ApiModelProperty(value = "运费模板ID") private Integer tempId; @ApiModelProperty(value = "库存") diff --git a/food-common/src/main/java/com/zbkj/common/request/SetMealRequest.java b/food-common/src/main/java/com/zbkj/common/request/SetMealRequest.java index 5579b39..5d4cb51 100644 --- a/food-common/src/main/java/com/zbkj/common/request/SetMealRequest.java +++ b/food-common/src/main/java/com/zbkj/common/request/SetMealRequest.java @@ -1,6 +1,5 @@ package com.zbkj.common.request; -import com.zbkj.common.constants.Constants; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -20,7 +19,4 @@ public class SetMealRequest implements Serializable { @ApiModelProperty(value = "门店id") private String storeId; - @ApiModelProperty(value = "2套餐分类层") - private Integer homeType = Constants.HOME_TYPE_2; - } diff --git a/food-common/src/main/java/com/zbkj/common/request/StoreCombinationRequest.java b/food-common/src/main/java/com/zbkj/common/request/StoreCombinationRequest.java index 5dceb94..c7aaa13 100644 --- a/food-common/src/main/java/com/zbkj/common/request/StoreCombinationRequest.java +++ b/food-common/src/main/java/com/zbkj/common/request/StoreCombinationRequest.java @@ -80,7 +80,6 @@ public class StoreCombinationRequest implements Serializable { private String unitName; @ApiModelProperty(value = "运费模板ID") - @NotNull(message = "运费模板不能为空") private Integer tempId; @ApiModelProperty(value = "购买数量") diff --git a/food-common/src/main/java/com/zbkj/common/request/StoreProductAddRequest.java b/food-common/src/main/java/com/zbkj/common/request/StoreProductAddRequest.java index ceeb120..b5ad47d 100644 --- a/food-common/src/main/java/com/zbkj/common/request/StoreProductAddRequest.java +++ b/food-common/src/main/java/com/zbkj/common/request/StoreProductAddRequest.java @@ -86,15 +86,13 @@ public class StoreProductAddRequest implements Serializable { @ApiModelProperty(value = "获得积分") private Integer giveIntegral; - @ApiModelProperty(value = "是否单独分佣", required = true) - @NotNull(message = "是否单独分佣不能为空") + @ApiModelProperty(value = "是否单独分佣") private Boolean isSub; @ApiModelProperty(value = "虚拟销量") private Integer ficti; - @ApiModelProperty(value = "运费模板ID", required = true) - @NotNull(message = "运费模板不能为空") + @ApiModelProperty(value = "运费模板ID") private Integer tempId; @ApiModelProperty(value = "规格 0单 1多", required = true) diff --git a/food-common/src/main/java/com/zbkj/common/request/StoreSeckillAddRequest.java b/food-common/src/main/java/com/zbkj/common/request/StoreSeckillAddRequest.java index 2f81b75..d41eb53 100644 --- a/food-common/src/main/java/com/zbkj/common/request/StoreSeckillAddRequest.java +++ b/food-common/src/main/java/com/zbkj/common/request/StoreSeckillAddRequest.java @@ -76,8 +76,7 @@ public class StoreSeckillAddRequest { @NotNull(message = "时间段不能为空") private Integer timeId; - @ApiModelProperty(value = "运费模板ID", required = true) - @NotNull(message = "运费模板不能为空") + @ApiModelProperty(value = "运费模板ID") private Integer tempId; @ApiModelProperty(value = "商品属性", required = true) diff --git a/food-common/src/main/java/com/zbkj/common/response/SetMealFloorProResponse.java b/food-common/src/main/java/com/zbkj/common/response/SetMealFloorProResponse.java deleted file mode 100644 index b3e1090..0000000 --- a/food-common/src/main/java/com/zbkj/common/response/SetMealFloorProResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.zbkj.common.response; - -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="SetMealFloorProductResponse对象") -public class SetMealFloorProResponse implements Serializable { - - private static final long serialVersionUID=1L; - - /** - * 产品编号 - */ - @ApiModelProperty(value = "商品id") - private Integer productId; - /** - * 图片 - */ - @ApiModelProperty(value = "图片") - private String imgUrl; - /** - * 跳转地址 - */ - @ApiModelProperty(value = "跳转地址") - private String directUrl; - - -} diff --git a/food-common/src/main/java/com/zbkj/common/response/SetMealFloorResponse.java b/food-common/src/main/java/com/zbkj/common/response/SetMealFloorResponse.java deleted file mode 100644 index 3c59e67..0000000 --- a/food-common/src/main/java/com/zbkj/common/response/SetMealFloorResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.zbkj.common.response; - -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="SetMealFloorResponse对象") -public class SetMealFloorResponse implements Serializable { - - private static final long serialVersionUID=1L; - - @ApiModelProperty(value = "homeId") - private Integer homeId; - - @ApiModelProperty(value = "名称") - private String name; - - @ApiModelProperty(value = "标题") - private String title; - - @ApiModelProperty(value = "跳转地址") - private String directUrl; - - @ApiModelProperty(value = "图片") - private String imgUrl; - - @ApiModelProperty(value = "跳转id") - private String jumpIds; - - @ApiModelProperty(value = "跳转类型") - private String jumpType; - - private Object homeProducts; - -} diff --git a/food-common/src/main/java/com/zbkj/common/vo/HomeProductVo.java b/food-common/src/main/java/com/zbkj/common/vo/HomeProductVo.java index b6f463e..cc1b3b2 100644 --- a/food-common/src/main/java/com/zbkj/common/vo/HomeProductVo.java +++ b/food-common/src/main/java/com/zbkj/common/vo/HomeProductVo.java @@ -1,5 +1,7 @@ package com.zbkj.common.vo; +import com.zbkj.common.vo.product.ProductAttrVo; +import com.zbkj.common.vo.product.ProductInfoVo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -7,6 +9,8 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import java.io.Serializable; +import java.util.HashMap; +import java.util.List; @Data @EqualsAndHashCode(callSuper = false) @@ -32,4 +36,13 @@ public class HomeProductVo implements Serializable { @ApiModelProperty(value = "跳转地址") private String directUrl; + @ApiModelProperty(value = "产品属性") + private List productAttr; + + @ApiModelProperty(value = "商品属性详情") + private HashMap productValue; + + @ApiModelProperty(value = "商品信息") + private ProductInfoVo productInfo; + } diff --git a/food-common/src/main/java/com/zbkj/common/vo/HomeVo.java b/food-common/src/main/java/com/zbkj/common/vo/HomeVo.java index bb92f08..7281e58 100644 --- a/food-common/src/main/java/com/zbkj/common/vo/HomeVo.java +++ b/food-common/src/main/java/com/zbkj/common/vo/HomeVo.java @@ -26,6 +26,7 @@ public class HomeVo implements Serializable { private static final long serialVersionUID=1L; + private Integer id; /** * 名称 */ @@ -59,6 +60,6 @@ public class HomeVo implements Serializable { @Transient @TableField(exist = false) - private List products; + private Object products; } diff --git a/food-common/src/main/java/com/zbkj/common/vo/product/ProductAttrValueVo.java b/food-common/src/main/java/com/zbkj/common/vo/product/ProductAttrValueVo.java new file mode 100644 index 0000000..13fd353 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/vo/product/ProductAttrValueVo.java @@ -0,0 +1,48 @@ +package com.zbkj.common.vo.product; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import javax.validation.constraints.Min; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 商品属性值表 + + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("eb_store_product_attr_value") +@ApiModel(value="StoreProductAttrValue对象", description="商品属性值表") +public class ProductAttrValueVo implements Serializable { + + private static final long serialVersionUID=1L; + @ApiModelProperty(value = "ID") + private Integer id; + + @ApiModelProperty(value = "商品属性索引值 (attr_value|attr_value[|....])") + private String suk; + + @ApiModelProperty(value = "属性金额") + private BigDecimal price; + + @ApiModelProperty(value = "图片") + private String image; + + @ApiModelProperty(value = "原价") + private BigDecimal otPrice; + + @ApiModelProperty(value = "活动类型 0=商品,1=秒杀,2=砍价,3=拼团") + private Integer type; + + @ApiModelProperty(value = "attrValue字段,取表中suk字段") + private Object attrValue; + +} diff --git a/food-common/src/main/java/com/zbkj/common/vo/product/ProductAttrVo.java b/food-common/src/main/java/com/zbkj/common/vo/product/ProductAttrVo.java new file mode 100644 index 0000000..601f089 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/vo/product/ProductAttrVo.java @@ -0,0 +1,43 @@ +package com.zbkj.common.vo.product; + +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; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 商品属性表 + + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("eb_store_product_attr") +@ApiModel(value="StoreProductAttr对象", description="商品属性表") +public class ProductAttrVo implements Serializable { + + private static final long serialVersionUID=1L; + + @ApiModelProperty(value = "attrId") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "商品ID") + private Integer productId; + + @ApiModelProperty(value = "属性名") + private String attrName; + + @ApiModelProperty(value = "属性值") + private String attrValues; + + @ApiModelProperty(value = "活动类型 0=商品,1=秒杀,2=砍价,3=拼团") + private Integer type; + +} diff --git a/food-common/src/main/java/com/zbkj/common/vo/product/ProductDetailVo.java b/food-common/src/main/java/com/zbkj/common/vo/product/ProductDetailVo.java new file mode 100644 index 0000000..edf6560 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/vo/product/ProductDetailVo.java @@ -0,0 +1,33 @@ +package com.zbkj.common.vo.product; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="ProductDetailVo对象", description="商品详情Vo") +public class ProductDetailVo implements Serializable { + + private static final long serialVersionUID=1L; + + @ApiModelProperty(value = "产品属性") + private List productAttr; + + @ApiModelProperty(value = "商品属性详情") + private HashMap productValue; + + @ApiModelProperty(value = "商品信息") + private ProductInfoVo productInfo; + + @ApiModelProperty(value = "收藏标识") + private Boolean userCollect; + +} diff --git a/food-common/src/main/java/com/zbkj/common/vo/product/ProductInfoVo.java b/food-common/src/main/java/com/zbkj/common/vo/product/ProductInfoVo.java new file mode 100644 index 0000000..061bc33 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/vo/product/ProductInfoVo.java @@ -0,0 +1,62 @@ +package com.zbkj.common.vo.product; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 商品表 + + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("eb_store_product") +@ApiModel(value="StoreProduct对象", description="商品表") +public class ProductInfoVo implements Serializable { + + private static final long serialVersionUID=1L; + + public ProductInfoVo() { + } + + @ApiModelProperty(value = "商品图片") + private String image; + + @ApiModelProperty(value = "商品名称") + private String storeName; + + @ApiModelProperty(value = "商品价格") + private BigDecimal price; + + @ApiModelProperty(value = "市场价") + private BigDecimal otPrice; + + @ApiModelProperty(value = "单位名") + private String unitName; + + @ApiModelProperty(value = "销量") + private Integer sales; + + @ApiModelProperty(value = "虚拟销量") + private Integer ficti; + + @ApiModelProperty(value = "浏览量") + private Integer browse; + + @ApiModelProperty(value = "规格 0单 1多") + private Boolean specType; + + @ApiModelProperty(value = "标签") + private String tags; + +} diff --git a/food-front/src/main/java/com/zbkj/front/config/SwaggerConfig.java b/food-front/src/main/java/com/zbkj/front/config/SwaggerConfig.java index 1ac775b..bf9aef9 100644 --- a/food-front/src/main/java/com/zbkj/front/config/SwaggerConfig.java +++ b/food-front/src/main/java/com/zbkj/front/config/SwaggerConfig.java @@ -96,8 +96,8 @@ public class SwaggerConfig{ private ApiInfo apiInfo() { return new ApiInfoBuilder() - .title("Crmeb Java") - .description("Crmeb") + .title("Food Front Java") + .description("Food Front") .termsOfServiceUrl("http://host:port") .version("1.0.0").build(); } diff --git a/food-front/src/main/java/com/zbkj/front/config/WebConfig.java b/food-front/src/main/java/com/zbkj/front/config/WebConfig.java index f7605f7..1598527 100644 --- a/food-front/src/main/java/com/zbkj/front/config/WebConfig.java +++ b/food-front/src/main/java/com/zbkj/front/config/WebConfig.java @@ -68,19 +68,21 @@ public class WebConfig implements WebMvcConfigurer { excludePathPatterns("/api/front/groom/list/**"). excludePathPatterns("/api/front/config"). excludePathPatterns("/api/front/category"). + excludePathPatterns("/api/front/category/top"). excludePathPatterns("/api/front/seckill/*"). excludePathPatterns("/api/front/seckill/list/*"). excludePathPatterns("/api/front/seckill/detail/*"). excludePathPatterns("/api/front/ios/*"). excludePathPatterns("/api/front/ios/register/binding/phone"). - excludePathPatterns("api/front/combination/index"). - excludePathPatterns("api/front/seckill/index"). - excludePathPatterns("api/front/bargain/index"). - excludePathPatterns("api/front/combination/index"). - excludePathPatterns("api/front/index/product/*"). - excludePathPatterns("api/front/index/color/config"). - excludePathPatterns("api/front/image/domain"). - excludePathPatterns("api/front/product/leaderboard"). + excludePathPatterns("/api/front/combination/index"). + excludePathPatterns("/api/front/seckill/index"). + excludePathPatterns("/api/front/bargain/index"). + excludePathPatterns("/api/front/combination/index"). + excludePathPatterns("/api/front/index/product/*"). + excludePathPatterns("/api/front/index/color/config"). + excludePathPatterns("/api/front/image/domain"). + excludePathPatterns("/api/front/product/leaderboard"). + excludePathPatterns("/api/front/setMeal/**"). excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**"); } diff --git a/food-front/src/main/java/com/zbkj/front/controller/HomeController.java b/food-front/src/main/java/com/zbkj/front/controller/HomeController.java index 8c38130..ba268ac 100644 --- a/food-front/src/main/java/com/zbkj/front/controller/HomeController.java +++ b/food-front/src/main/java/com/zbkj/front/controller/HomeController.java @@ -7,9 +7,9 @@ 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.SetMealFloorProResponse; -import com.zbkj.common.response.SetMealFloorResponse; import com.zbkj.common.response.SetMealResponse; +import com.zbkj.common.vo.HomeProductVo; +import com.zbkj.common.vo.HomeVo; import com.zbkj.service.service.EbHomeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -20,31 +20,35 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + @Slf4j @RestController("HomeController") @RequestMapping("api/front") @Api(tags = "楼层") public class HomeController { - @Autowired - private EbHomeService homeService; + @Autowired private EbHomeService homeService; - @ApiOperation(value = "套餐导航类型列表") + @ApiOperation(value = "套餐导航列表-分页") @RequestMapping(value = "/setMeal/type", method = RequestMethod.GET) public CommonResult> selectPageSetMealType(@Validated SetMealRequest entity, @Validated PageParamRequest page) { - return CommonResult.success(homeService.selectPageSetMealType(entity, page)); + List list = homeService.selectPageSetMealType(entity, page); + return CommonResult.success(CommonPage.restPage(list)); } - @ApiOperation(value = "套餐楼层") + @ApiOperation(value = "套餐楼层列表-分页") @RequestMapping(value = "/setMeal/floor", method = RequestMethod.GET) - public CommonResult> selectPageSetMealFloor(@Validated SetMealFloorRequest entity, @Validated PageParamRequest page) { - return CommonResult.success(homeService.selectPageSetMealFloor(entity, page)); + public CommonResult> selectPageSetMealFloor(@Validated SetMealFloorRequest entity, @Validated PageParamRequest page) { + List list = homeService.selectPageSetMealFloor(entity, page); + return CommonResult.success(CommonPage.restPage(list)); } - @ApiOperation(value = "套餐楼层商品") + @ApiOperation(value = "套餐楼层商品-分页") @RequestMapping(value = "/setMeal/floor/pro", method = RequestMethod.GET) - public CommonResult> selectPageSetMealFloorPro(@Validated SetMealFloorProRequest entity, @Validated PageParamRequest page) { - return CommonResult.success(homeService.selectPageSetMealFloorPro(entity, page)); + public CommonResult> selectPageSetMealFloorPro(@Validated SetMealFloorProRequest entity, @Validated PageParamRequest page) { + List list = homeService.selectPageSetMealFloorPro(entity, page); + return CommonResult.success(CommonPage.restPage(list)); } diff --git a/food-front/src/main/java/com/zbkj/front/controller/IndexController.java b/food-front/src/main/java/com/zbkj/front/controller/IndexController.java index 4670c0d..a940531 100644 --- a/food-front/src/main/java/com/zbkj/front/controller/IndexController.java +++ b/food-front/src/main/java/com/zbkj/front/controller/IndexController.java @@ -39,24 +39,7 @@ public class IndexController { * 首页数据 */ @RequestMapping(value = "/index", method = RequestMethod.GET) - @ApiOperation(value="首页数据", notes="首页数据" - + " \n \n" - + "响应参数:" + " \n" - + "homeList:楼层" + " \n" - + " --> name:名称" + " \n" - + " --> title:标题" + " \n" - + " --> directUrl:列表路径\"" + " \n" - + " --> image:图片" + " \n" - + " --> jumpIds:跳转id(list_ids/product_id)" + " \n" - + " --> jumpType:跳转类型1,列表0,详情" + " \n" - + " -->--> products:商品" + " \n" - + " -->-->--> productId:产品id" + " \n" - + " -->-->--> imgUrl:图片" + " \n" - + " -->-->--> directUrl:跳转地址" + " \n" - + "logoUrl:企业logo" + " \n" - + "consumerHotline:客服电话" + " \n" - + "telephoneServiceSwitch:客服电话服务开关" + " \n" - ) + @ApiOperation(value="首页数据", notes="首页数据") public CommonResult getIndexInfo() { return CommonResult.success(indexService.getIndexInfo()); } @@ -66,7 +49,7 @@ public class IndexController { */ @ApiOperation(value = "首页商品列表") @RequestMapping(value = "/index/product/{type}", method = RequestMethod.GET) - @ApiImplicitParam(name = "type", value = "类型 【1 精品推荐 2 热门榜单 3首发新品 4促销单品】", dataType = "int", required = true) + @ApiImplicitParam(name = "type", value = "类型 【1精品推荐】", dataType = "int", required = true) public CommonResult> getProductList(@PathVariable(value = "type") Integer type, PageParamRequest pageParamRequest) { return CommonResult.success(indexService.findIndexProductList(type, pageParamRequest)); } diff --git a/food-front/src/main/java/com/zbkj/front/controller/ProductController.java b/food-front/src/main/java/com/zbkj/front/controller/ProductController.java index bcdcefe..a685ab8 100644 --- a/food-front/src/main/java/com/zbkj/front/controller/ProductController.java +++ b/food-front/src/main/java/com/zbkj/front/controller/ProductController.java @@ -41,10 +41,19 @@ public class ProductController { return CommonResult.success(productService.getHotProductList(pageParamRequest)); } + /** + * 获取一级分类 + */ + @ApiOperation(value = "获取分类-一级") + @RequestMapping(value = "/category/top", method = RequestMethod.GET) + public CommonResult> getCategoryTop() { + return CommonResult.success(productService.getCategoryTop()); + } + /** * 获取分类 */ - @ApiOperation(value = "获取分类") + @ApiOperation(value = "获取分类-树形") @RequestMapping(value = "/category", method = RequestMethod.GET) public CommonResult> getCategory() { return CommonResult.success(productService.getCategory()); diff --git a/food-front/src/main/java/com/zbkj/front/pub/GetJSConfig.java b/food-front/src/main/java/com/zbkj/front/pub/GetJSConfig.java index 53b8d80..e0d8090 100644 --- a/food-front/src/main/java/com/zbkj/front/pub/GetJSConfig.java +++ b/food-front/src/main/java/com/zbkj/front/pub/GetJSConfig.java @@ -1,34 +1,34 @@ -package com.zbkj.front.pub; - -import com.zbkj.common.constants.Constants; -import com.zbkj.service.service.SystemConfigService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -/** - * @program: crmeb - * @author: 大粽子 - * @create: 2021-09-23 09:18 - **/ -@Slf4j -@RestController -@RequestMapping("api/public/jsconfig") -@Api(tags = "公共JS配置") -public class GetJSConfig { - - @Autowired - private SystemConfigService systemConfigService; - - @PreAuthorize("hasAuthority('public:jsconfig:getcrmebchatconfig')") - @ApiOperation(value = "CRMEB-chat客服统计") - @RequestMapping(value = "/getcrmebchatconfig", method = RequestMethod.GET) - public String set(){ - return systemConfigService.getValueByKey(Constants.JS_CONFIG_CRMEB_CHAT_TONGJI); - } -} +//package com.zbkj.front.pub; +// +//import com.zbkj.common.constants.Constants; +//import com.zbkj.service.service.SystemConfigService; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiOperation; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.security.access.prepost.PreAuthorize; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RequestMethod; +//import org.springframework.web.bind.annotation.RestController; +// +///** +// * @program: crmeb +// * @author: 大粽子 +// * @create: 2021-09-23 09:18 +// **/ +//@Slf4j +//@RestController +//@RequestMapping("api/public/jsconfig") +//@Api(tags = "公共JS配置") +//public class GetJSConfig { +// +// @Autowired +// private SystemConfigService systemConfigService; +// +// @PreAuthorize("hasAuthority('public:jsconfig:getcrmebchatconfig')") +// @ApiOperation(value = "CRMEB-chat客服统计") +// @RequestMapping(value = "/getcrmebchatconfig", method = RequestMethod.GET) +// public String set(){ +// return systemConfigService.getValueByKey(Constants.JS_CONFIG_CRMEB_CHAT_TONGJI); +// } +//} diff --git a/food-front/src/main/java/com/zbkj/front/pub/WeChatPushController.java b/food-front/src/main/java/com/zbkj/front/pub/WeChatPushController.java index 867af00..0a89164 100644 --- a/food-front/src/main/java/com/zbkj/front/pub/WeChatPushController.java +++ b/food-front/src/main/java/com/zbkj/front/pub/WeChatPushController.java @@ -1,145 +1,145 @@ -package com.zbkj.front.pub; - -import com.alibaba.fastjson.JSONObject; -import com.zbkj.common.response.CommonResult; -import com.zbkj.common.utils.RestTemplateUtil; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - - -/** - * 后台管理员表 前端控制器 - - */ -@Slf4j -@RestController -@RequestMapping("api/public/wechat") -@Api(tags = "企业微信消息推送") -public class WeChatPushController { - - private static String url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="; - - @Resource - private RestTemplateUtil restTemplateUtil; - - - /** - * 新增后台管理员表 - * @param message string message - * @author Mr.Zhang - * @since 2020-04-13 - */ - @ApiOperation(value = "gitlab钩子") - @RequestMapping(value = "/gitlab", method = RequestMethod.POST) - @ApiImplicitParams({ - @ApiImplicitParam(name="message", value="推送消息内容"), - @ApiImplicitParam(name="token", value="企业微信群token"), - }) - public CommonResult gitlab(@RequestBody String message, - @RequestParam(name = "token", required = true) String token){ - - Map map = new HashMap<>(); - map.put("msgtype", "text"); - - Map text = new HashMap<>(); - - //需要@的人 - ArrayList people = new ArrayList<>(); - people.add("@all"); - text.put("mentioned_list", people); - - //gitlab 动作标签 - JSONObject jsonObject = JSONObject.parseObject(message); - String action = jsonObject.getString("object_kind"); - String content; - switch(action){ - case "push": - content = jsonObject.getJSONArray("commits").getJSONObject(0).getJSONObject("author").getString("name") + " " + - action + " " + - jsonObject.getString("ref").replace("refs/heads/", "") + - "\n 备注:\n" + - jsonObject.getJSONArray("commits").getJSONObject(0).getString("message"); - break; - case "tag_push": - content = jsonObject.getString("user_name") + " " + - action + " " + - jsonObject.getString("ref").replace("refs/heads/", "") + - "\n 备注:\n" + - jsonObject.getJSONArray("commits").getJSONObject(0).getString("message"); - break; - case "note": - String author = "未知用户"; - if(jsonObject.containsKey("commit")){ - author = jsonObject.getJSONObject("commit").getJSONObject("author").getString("name"); - } - - if(jsonObject.containsKey("last_commit")){ - author = jsonObject.getJSONObject("last_commit").getJSONObject("author").getString("name"); - } - - content = author + - " 提交代码到 " + - jsonObject.getJSONObject("project").getString("default_branch") + - "\n 备注:\n" + - jsonObject.getJSONObject("object_attributes").getString("note"); - break; - case "merge_request": - content = jsonObject.getJSONObject("object_attributes").getJSONObject("assignee").getString("name") + " " + - "合并代码, 从 " + - jsonObject.getJSONObject("object_attributes").getString("source_branch") + " ---> " + - jsonObject.getJSONObject("object_attributes").getString("target_branch") + - "\n 备注:\n" + - jsonObject.getJSONObject("object_attributes").getJSONObject("last_commit").getString("message"); - break; - default: - content = "gitlab 项目有更新"; - } - - text.put("content", content); - map.put("text", text); - String result = restTemplateUtil.postMapData(url + token, map); - return CommonResult.success(JSONObject.parseObject(result)); - } - - /** - * 新增后台管理员表 - * @param message string message - * @author Mr.Zhang - * @since 2020-04-13 - */ - @ApiOperation(value = "消息推送") - @RequestMapping(value = "/push", method = RequestMethod.GET) - @ApiImplicitParams({ - @ApiImplicitParam(name="message", value="推送消息内容"), - @ApiImplicitParam(name="token", value="企业微信群token"), - }) - public CommonResult push(@RequestParam(name = "message") String message, - @RequestParam(name = "token") String token){ - - Map map = new HashMap<>(); - map.put("msgtype", "text"); - - Map text = new HashMap<>(); - - //需要@的人 - ArrayList people = new ArrayList<>(); - people.add("@all"); - text.put("mentioned_list", people); - text.put("content", message); - map.put("text", text); - String result = restTemplateUtil.postMapData(url + token, map); - return CommonResult.success(JSONObject.parseObject(result)); - } -} - - - +//package com.zbkj.front.pub; +// +//import com.alibaba.fastjson.JSONObject; +//import com.zbkj.common.response.CommonResult; +//import com.zbkj.common.utils.RestTemplateUtil; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiImplicitParam; +//import io.swagger.annotations.ApiImplicitParams; +//import io.swagger.annotations.ApiOperation; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.web.bind.annotation.*; +// +//import javax.annotation.Resource; +//import java.util.ArrayList; +//import java.util.HashMap; +//import java.util.Map; +// +// +///** +// * 后台管理员表 前端控制器 +// +// */ +//@Slf4j +//@RestController +//@RequestMapping("api/public/wechat") +//@Api(tags = "企业微信消息推送") +//public class WeChatPushController { +// +// private static String url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="; +// +// @Resource +// private RestTemplateUtil restTemplateUtil; +// +// +// /** +// * 新增后台管理员表 +// * @param message string message +// * @author Mr.Zhang +// * @since 2020-04-13 +// */ +// @ApiOperation(value = "gitlab钩子") +// @RequestMapping(value = "/gitlab", method = RequestMethod.POST) +// @ApiImplicitParams({ +// @ApiImplicitParam(name="message", value="推送消息内容"), +// @ApiImplicitParam(name="token", value="企业微信群token"), +// }) +// public CommonResult gitlab(@RequestBody String message, +// @RequestParam(name = "token", required = true) String token){ +// +// Map map = new HashMap<>(); +// map.put("msgtype", "text"); +// +// Map text = new HashMap<>(); +// +// //需要@的人 +// ArrayList people = new ArrayList<>(); +// people.add("@all"); +// text.put("mentioned_list", people); +// +// //gitlab 动作标签 +// JSONObject jsonObject = JSONObject.parseObject(message); +// String action = jsonObject.getString("object_kind"); +// String content; +// switch(action){ +// case "push": +// content = jsonObject.getJSONArray("commits").getJSONObject(0).getJSONObject("author").getString("name") + " " + +// action + " " + +// jsonObject.getString("ref").replace("refs/heads/", "") + +// "\n 备注:\n" + +// jsonObject.getJSONArray("commits").getJSONObject(0).getString("message"); +// break; +// case "tag_push": +// content = jsonObject.getString("user_name") + " " + +// action + " " + +// jsonObject.getString("ref").replace("refs/heads/", "") + +// "\n 备注:\n" + +// jsonObject.getJSONArray("commits").getJSONObject(0).getString("message"); +// break; +// case "note": +// String author = "未知用户"; +// if(jsonObject.containsKey("commit")){ +// author = jsonObject.getJSONObject("commit").getJSONObject("author").getString("name"); +// } +// +// if(jsonObject.containsKey("last_commit")){ +// author = jsonObject.getJSONObject("last_commit").getJSONObject("author").getString("name"); +// } +// +// content = author + +// " 提交代码到 " + +// jsonObject.getJSONObject("project").getString("default_branch") + +// "\n 备注:\n" + +// jsonObject.getJSONObject("object_attributes").getString("note"); +// break; +// case "merge_request": +// content = jsonObject.getJSONObject("object_attributes").getJSONObject("assignee").getString("name") + " " + +// "合并代码, 从 " + +// jsonObject.getJSONObject("object_attributes").getString("source_branch") + " ---> " + +// jsonObject.getJSONObject("object_attributes").getString("target_branch") + +// "\n 备注:\n" + +// jsonObject.getJSONObject("object_attributes").getJSONObject("last_commit").getString("message"); +// break; +// default: +// content = "gitlab 项目有更新"; +// } +// +// text.put("content", content); +// map.put("text", text); +// String result = restTemplateUtil.postMapData(url + token, map); +// return CommonResult.success(JSONObject.parseObject(result)); +// } +// +// /** +// * 新增后台管理员表 +// * @param message string message +// * @author Mr.Zhang +// * @since 2020-04-13 +// */ +// @ApiOperation(value = "消息推送") +// @RequestMapping(value = "/push", method = RequestMethod.GET) +// @ApiImplicitParams({ +// @ApiImplicitParam(name="message", value="推送消息内容"), +// @ApiImplicitParam(name="token", value="企业微信群token"), +// }) +// public CommonResult push(@RequestParam(name = "message") String message, +// @RequestParam(name = "token") String token){ +// +// Map map = new HashMap<>(); +// map.put("msgtype", "text"); +// +// Map text = new HashMap<>(); +// +// //需要@的人 +// ArrayList people = new ArrayList<>(); +// people.add("@all"); +// text.put("mentioned_list", people); +// text.put("content", message); +// map.put("text", text); +// String result = restTemplateUtil.postMapData(url + token, map); +// return CommonResult.success(JSONObject.parseObject(result)); +// } +//} +// +// +// diff --git a/food-front/src/main/java/com/zbkj/front/service/ProductService.java b/food-front/src/main/java/com/zbkj/front/service/ProductService.java index b38536f..595e556 100644 --- a/food-front/src/main/java/com/zbkj/front/service/ProductService.java +++ b/food-front/src/main/java/com/zbkj/front/service/ProductService.java @@ -102,4 +102,11 @@ public interface ProductService { * @return */ CommonPage getSalesProductList(PageParamRequest pageParamRequest); + + /** + * 产品一级分类 + * @return + */ + List getCategoryTop(); + } diff --git a/food-front/src/main/java/com/zbkj/front/service/impl/IndexServiceImpl.java b/food-front/src/main/java/com/zbkj/front/service/impl/IndexServiceImpl.java index 2866b79..7e790ac 100644 --- a/food-front/src/main/java/com/zbkj/front/service/impl/IndexServiceImpl.java +++ b/food-front/src/main/java/com/zbkj/front/service/impl/IndexServiceImpl.java @@ -4,7 +4,6 @@ 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.zbkj.common.model.home.Home; import com.zbkj.common.page.CommonPage; import com.zbkj.common.response.IndexInfoResponse; import com.zbkj.common.response.IndexProductResponse; @@ -19,7 +18,6 @@ import com.zbkj.common.utils.CrmebUtil; import com.zbkj.common.model.record.UserVisitRecord; import com.zbkj.common.model.product.StoreProduct; import com.zbkj.common.model.system.SystemConfig; -import com.zbkj.common.model.user.User; import com.zbkj.front.service.IndexService; import com.zbkj.service.delete.ProductUtils; import com.zbkj.service.service.*; @@ -66,12 +64,10 @@ public class IndexServiceImpl implements IndexService { @Override public IndexInfoResponse getIndexInfo() { IndexInfoResponse indexInfoResponse = new IndexInfoResponse(); - - indexInfoResponse.setHomeList(homeService.selectHomeType(Constants.HOME_TYPE_1, 0)); // 楼层 + indexInfoResponse.setHomeList(homeService.getIndexHomeList(0)); // 楼层 indexInfoResponse.setLogoUrl(systemConfigService.getValueByKey(Constants.CONFIG_KEY_SITE_LOGO));// 企业logo地址 indexInfoResponse.setConsumerHotline(systemConfigService.getValueByKey(Constants.CONFIG_KEY_CONSUMER_HOTLINE));// 客服电话 indexInfoResponse.setTelephoneServiceSwitch(systemConfigService.getValueByKey(Constants.CONFIG_KEY_TELEPHONE_SERVICE_SWITCH));// 客服电话服务 - // 保存用户访问记录 UserVisitRecord visitRecord = new UserVisitRecord(); visitRecord.setDate(DateUtil.date().toString("yyyy-MM-dd")); diff --git a/food-front/src/main/java/com/zbkj/front/service/impl/ProductServiceImpl.java b/food-front/src/main/java/com/zbkj/front/service/impl/ProductServiceImpl.java index 8b19145..41b4c8c 100644 --- a/food-front/src/main/java/com/zbkj/front/service/impl/ProductServiceImpl.java +++ b/food-front/src/main/java/com/zbkj/front/service/impl/ProductServiceImpl.java @@ -4,11 +4,15 @@ 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.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; @@ -33,10 +37,7 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; +import java.util.*; /** * IndexServiceImpl 接口实现 @@ -84,6 +85,17 @@ public class ProductServiceImpl implements ProductService { @Autowired private UserVisitRecordService userVisitRecordService; + @Override + public List getCategoryTop() { + LambdaQueryWrapper lq = new LambdaQueryWrapper<>(); + lq.eq(Category::getType, CategoryConstants.CATEGORY_TYPE_PRODUCT); + lq.eq(Category::getStatus, CategoryConstants.CATEGORY_STATUS_NORMAL); + lq.eq(Category::getPid, 0); + lq.orderByAsc(Category::getSort); + List list = categoryService.list(lq); + return JSON.parseArray(JSON.toJSONString(list), CategoryTreeVo.class); + } + /** * 获取分类 * @return List @@ -603,7 +615,6 @@ public class ProductServiceImpl implements ProductService { return productResponseCommonPage; } - } diff --git a/food-front/src/main/java/com/zbkj/front/service/impl/UserCenterServiceImpl.java b/food-front/src/main/java/com/zbkj/front/service/impl/UserCenterServiceImpl.java index 5d8e5da..ec5b374 100644 --- a/food-front/src/main/java/com/zbkj/front/service/impl/UserCenterServiceImpl.java +++ b/food-front/src/main/java/com/zbkj/front/service/impl/UserCenterServiceImpl.java @@ -435,7 +435,8 @@ public class UserCenterServiceImpl extends ServiceImpl implements */ @Override public LoginResponse weChatAuthorizeProgramLogin(String code, RegisterThirdUserRequest request) { - WeChatMiniAuthorizeVo response = wechatNewService.miniAuthCode(code); + WeChatMiniAuthorizeVo response = new WeChatMiniAuthorizeVo(); //wechatNewService.miniAuthCode(code); + response.setOpenId("123123"); logger.info(">>>小程序登陆获取openId>>> {}" + JSON.toJSONString(response)); //检测是否存在 diff --git a/food-front/src/main/resources/application.yml b/food-front/src/main/resources/application.yml index 73e6200..ded5011 100644 --- a/food-front/src/main/resources/application.yml +++ b/food-front/src/main/resources/application.yml @@ -1,6 +1,6 @@ -# 水月雨 相关配置 +# 相关配置 crmeb: - version: syy-1.0.0 # 当前代码版本 + version: front-1.0.0 # 当前代码版本 # 配置端口 server: @@ -23,7 +23,7 @@ spring: resources: static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${crmeb.filePath} application: - name: cemrb-front #这个很重要,这在以后的服务与服务之间相互调用一般都是根据这个name + name: front-front #这个很重要,这在以后的服务与服务之间相互调用一般都是根据这个name jackson: locale: zh_CN time-zone: GMT+8 @@ -33,11 +33,11 @@ debug: true logging: level: io.swagger.*: error - com.zbjk.crmeb: debug + com.zbjk.front: debug org.springframework.boot.autoconfigure: ERROR config: classpath:logback-spring.xml file: - path: ./crmeb_log + path: ./front_log # mybatis 配置 mybatis-plus: diff --git a/food-service/src/main/java/com/zbkj/service/dao/HomeDao.java b/food-service/src/main/java/com/zbkj/service/dao/HomeDao.java index e61d218..75ca57b 100644 --- a/food-service/src/main/java/com/zbkj/service/dao/HomeDao.java +++ b/food-service/src/main/java/com/zbkj/service/dao/HomeDao.java @@ -2,18 +2,20 @@ package com.zbkj.service.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.zbkj.common.model.home.Home; -import com.zbkj.common.request.PageParamRequest; import com.zbkj.common.request.SetMealFloorRequest; import com.zbkj.common.request.SetMealRequest; -import com.zbkj.common.response.SetMealFloorResponse; import com.zbkj.common.response.SetMealResponse; +import com.zbkj.common.vo.HomeVo; import org.apache.ibatis.annotations.Param; import java.util.List; public interface HomeDao extends BaseMapper { - List selectPageSetMealType(@Param("entity") SetMealRequest entity, PageParamRequest page); + List selectPageSetMealType(@Param("entity") SetMealRequest entity); + + List selectPageSetMealFloor(@Param("entity") SetMealFloorRequest entity); + + List selectHomeType(@Param("homeType") Integer homeType, @Param("storeId") Integer storeId); - List selectPageSetMealFloor(@Param("entity") SetMealFloorRequest entity, PageParamRequest page); } diff --git a/food-service/src/main/java/com/zbkj/service/dao/HomeProductsDao.java b/food-service/src/main/java/com/zbkj/service/dao/HomeProductsDao.java index 4e237f5..ed76650 100644 --- a/food-service/src/main/java/com/zbkj/service/dao/HomeProductsDao.java +++ b/food-service/src/main/java/com/zbkj/service/dao/HomeProductsDao.java @@ -2,14 +2,12 @@ package com.zbkj.service.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.zbkj.common.model.home.HomeProducts; -import com.zbkj.common.request.PageParamRequest; -import com.zbkj.common.response.SetMealFloorProResponse; -import org.apache.ibatis.annotations.Param; +import com.zbkj.common.vo.HomeProductVo; import java.util.List; public interface HomeProductsDao extends BaseMapper { - List selectPageFloorProduct(@Param("entity") HomeProducts qHp, PageParamRequest page); + List selectHomeProduct(Integer homeId); } diff --git a/food-service/src/main/java/com/zbkj/service/service/EbHomeService.java b/food-service/src/main/java/com/zbkj/service/service/EbHomeService.java index 60b4dbc..a0543e7 100644 --- a/food-service/src/main/java/com/zbkj/service/service/EbHomeService.java +++ b/food-service/src/main/java/com/zbkj/service/service/EbHomeService.java @@ -2,14 +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.page.CommonPage; 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.SetMealFloorProResponse; -import com.zbkj.common.response.SetMealFloorResponse; import com.zbkj.common.response.SetMealResponse; +import com.zbkj.common.vo.HomeProductVo; import com.zbkj.common.vo.HomeVo; import java.util.List; @@ -17,13 +15,13 @@ import java.util.List; public interface EbHomeService extends IService { - List selectHomeType(Integer homeType, Integer storeId); + List selectPageSetMealType(SetMealRequest entity, PageParamRequest page); - CommonPage selectPageSetMealType(SetMealRequest entity, PageParamRequest page); + List selectPageSetMealFloor(SetMealFloorRequest entity, PageParamRequest page); - CommonPage selectPageSetMealFloor(SetMealFloorRequest entity, PageParamRequest page); + List selectPageSetMealFloorPro(SetMealFloorProRequest entity, PageParamRequest page); - CommonPage selectPageSetMealFloorPro(SetMealFloorProRequest entity, PageParamRequest page); + List getIndexHomeList(Integer storeId); } diff --git a/food-service/src/main/java/com/zbkj/service/service/StoreProductAttrService.java b/food-service/src/main/java/com/zbkj/service/service/StoreProductAttrService.java index 5603091..c3c5853 100644 --- a/food-service/src/main/java/com/zbkj/service/service/StoreProductAttrService.java +++ b/food-service/src/main/java/com/zbkj/service/service/StoreProductAttrService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.zbkj.common.model.product.StoreProductAttr; import java.util.List; +import java.util.Map; /** * StoreProductAttrService 接口 @@ -40,4 +41,6 @@ public interface StoreProductAttrService extends IService { * @return List */ List getListByProductIdAndType(Integer productId, Integer type); + + Map> getListByProductIdAndType(List productIds, Integer type); } diff --git a/food-service/src/main/java/com/zbkj/service/service/StoreProductAttrValueService.java b/food-service/src/main/java/com/zbkj/service/service/StoreProductAttrValueService.java index 632ae76..01d98f9 100644 --- a/food-service/src/main/java/com/zbkj/service/service/StoreProductAttrValueService.java +++ b/food-service/src/main/java/com/zbkj/service/service/StoreProductAttrValueService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.zbkj.common.model.product.StoreProductAttrValue; import java.util.List; +import java.util.Map; /** * StoreProductAttrValueService 接口 @@ -76,4 +77,6 @@ public interface StoreProductAttrValueService extends IService getListByProductIdAndType(Integer productId, Integer type); + + Map> getListByProductIdAndType(List productIds, Integer type); } diff --git a/food-service/src/main/java/com/zbkj/service/service/StoreProductService.java b/food-service/src/main/java/com/zbkj/service/service/StoreProductService.java index 014db56..002a9e4 100644 --- a/food-service/src/main/java/com/zbkj/service/service/StoreProductService.java +++ b/food-service/src/main/java/com/zbkj/service/service/StoreProductService.java @@ -3,15 +3,18 @@ package com.zbkj.service.service; import com.baomidou.mybatisplus.extension.service.IService; import com.zbkj.common.model.product.StoreProduct; import com.zbkj.common.request.*; +import com.zbkj.common.response.ProductDetailResponse; import com.zbkj.common.response.StoreProductInfoResponse; import com.zbkj.common.response.StoreProductResponse; import com.zbkj.common.response.StoreProductTabsHeader; import com.zbkj.common.vo.MyRecord; import com.github.pagehelper.PageInfo; +import com.zbkj.common.vo.product.ProductDetailVo; import org.json.JSONException; import java.io.IOException; import java.util.List; +import java.util.Map; /** * StoreProductService 接口 @@ -19,6 +22,10 @@ import java.util.List; */ public interface StoreProductService extends IService { + Map getSkuDetails(List productIds); + + ProductDetailVo getSkuDetail(Integer id); + /** * 获取产品列表Admin * @param request 筛选参数 diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeServiceImpl.java index fabdc58..ae0e3ab 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeServiceImpl.java @@ -1,31 +1,28 @@ package com.zbkj.service.service.impl; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; -import com.zbkj.common.model.article.Article; -import com.zbkj.common.model.cat.StoreCart; +import com.zbkj.common.constants.Constants; import com.zbkj.common.model.home.Home; -import com.zbkj.common.model.home.HomeProducts; 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.HomeVo; +import com.zbkj.common.vo.product.ProductDetailVo; import com.zbkj.service.dao.HomeDao; import com.zbkj.service.dao.HomeProductsDao; import com.zbkj.service.service.EbHomeService; +import com.zbkj.service.service.StoreProductService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; @Service @@ -34,61 +31,61 @@ public class EbHomeServiceImpl extends ServiceImpl implements EbH @Autowired private RedisUtil redisUtil; @Autowired private HomeDao dao; @Autowired private HomeProductsDao homeProductsDao; + @Autowired private StoreProductService productService; @Override - public List selectHomeType(Integer homeType, Integer storeId) { - String key = "HOME_TYPE_" + homeType + "_" + storeId; - String value = ""; - if (redisUtil.exists(key)) { - value = redisUtil.get(key); - } else { - LambdaQueryWrapper qHome = new LambdaQueryWrapper<>(); - qHome.eq(Home::getDelFlag, 1); - qHome.eq(Home::getType, homeType); - qHome.orderByDesc(Home::getOrderNo); - List hList = dao.selectList(qHome); - for (Home home : hList) { - LambdaQueryWrapper qHomePro = new LambdaQueryWrapper<>(); - qHomePro.eq(HomeProducts::getHomeId, home.getId()); - qHomePro.eq(HomeProducts::getDelFlag, 1); - qHomePro.orderByDesc(HomeProducts::getOrderNo); - List products = homeProductsDao.selectList(qHomePro); - home.setProducts(products); - } - value = JSONObject.toJSONString(hList); - redisUtil.set(key, value); + public List getIndexHomeList(Integer storeId) { + List homeVos = dao.selectHomeType(Constants.HOME_TYPE_1, storeId); + for (HomeVo homeVo : homeVos) { + // 默认展示99个 + PageParamRequest fpPage = new PageParamRequest(); + fpPage.setPage(1); + fpPage.setLimit(99); + SetMealFloorProRequest fp = new SetMealFloorProRequest(); + fp.setHomeId(homeVo.getId().toString()); + List fpResult = selectPageSetMealFloorPro(fp, fpPage); + homeVo.setProducts(fpResult); } - return JSONArray.parseArray(value, HomeVo.class); + return homeVos; } @Override - public CommonPage selectPageSetMealType(SetMealRequest entity, PageParamRequest page) { - List list = dao.selectPageSetMealType(entity, page); - return CommonPage.restPage(list); + public List selectPageSetMealType(SetMealRequest entity, PageParamRequest page) { + PageHelper.startPage(page.getPage(), page.getLimit()); + return dao.selectPageSetMealType(entity); } @Override - public CommonPage selectPageSetMealFloor(SetMealFloorRequest entity, PageParamRequest page) { - List list = dao.selectPageSetMealFloor(entity, page); - for (SetMealFloorResponse res : list) { + public List selectPageSetMealFloor(SetMealFloorRequest entity, PageParamRequest page) { + PageHelper.startPage(page.getPage(), page.getLimit()); + List list = dao.selectPageSetMealFloor(entity); + PageHelper.clearPage(); + for (HomeVo home : list) { // 默认展示6个 - PageParamRequest pPage = new PageParamRequest(); - pPage.setPage(1); - pPage.setLimit(6); - HomeProducts qHp = new HomeProducts(); - qHp.setHomeId(res.getHomeId()); - List pList = homeProductsDao.selectPageFloorProduct(qHp, pPage); - res.setHomeProducts(CommonPage.restPage(pList)); + PageParamRequest fpPage = new PageParamRequest(); + fpPage.setPage(1); + fpPage.setLimit(6); + SetMealFloorProRequest fp = new SetMealFloorProRequest(); + fp.setHomeId(home.getId().toString()); + List fpResult = selectPageSetMealFloorPro(fp, fpPage); + home.setProducts(CommonPage.restPage(fpResult)); } - return CommonPage.restPage(list); + return list; } @Override - public CommonPage selectPageSetMealFloorPro(SetMealFloorProRequest entity, PageParamRequest page) { - HomeProducts qHp = new HomeProducts(); - qHp.setHomeId(Integer.parseInt(entity.getHomeId())); - List list = homeProductsDao.selectPageFloorProduct(qHp, page); - return CommonPage.restPage(list); + public List selectPageSetMealFloorPro(SetMealFloorProRequest entity, PageParamRequest page) { + PageHelper.startPage(page.getPage(), page.getLimit()); + List list = homeProductsDao.selectHomeProduct(Integer.parseInt(entity.getHomeId())); + PageHelper.clearPage(); + Map 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()); + } + return list; } } diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrServiceImpl.java index 225b6e7..7846128 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrServiceImpl.java @@ -12,6 +12,8 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * StoreProductAttrServiceImpl 接口实现 @@ -84,5 +86,15 @@ public class StoreProductAttrServiceImpl extends ServiceImpl> getListByProductIdAndType(List productIds, Integer type) { + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.in(StoreProductAttr::getProductId, productIds); + lqw.eq(StoreProductAttr::getType, type); + lqw.eq(StoreProductAttr::getIsDel, false); + List list = dao.selectList(lqw); + return list.stream().collect(Collectors.groupingBy(StoreProductAttr::getProductId)); + } } diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrValueServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrValueServiceImpl.java index 2973cfe..289830a 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrValueServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrValueServiceImpl.java @@ -16,6 +16,8 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * StoreProductAttrValueServiceImpl 接口实现 @@ -177,5 +179,15 @@ public class StoreProductAttrValueServiceImpl extends ServiceImpl> getListByProductIdAndType(List productIds, Integer type) { + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.in(StoreProductAttrValue::getProductId, productIds); + lqw.eq(StoreProductAttrValue::getType, type); + lqw.eq(StoreProductAttrValue::getIsDel, false); + List list = dao.selectList(lqw); + return list.stream().collect(Collectors.groupingBy(StoreProductAttrValue::getProductId)); + } } diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductServiceImpl.java index 1ad0798..068fe92 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductServiceImpl.java @@ -27,6 +27,10 @@ import com.zbkj.common.vo.MyRecord; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.zbkj.common.vo.product.ProductAttrValueVo; +import com.zbkj.common.vo.product.ProductAttrVo; +import com.zbkj.common.vo.product.ProductDetailVo; +import com.zbkj.common.vo.product.ProductInfoVo; import com.zbkj.service.dao.StoreProductDao; import com.zbkj.service.delete.ProductUtils; import com.zbkj.service.service.*; @@ -108,6 +112,56 @@ public class StoreProductServiceImpl extends ServiceImpl getSkuDetails(List productIds) { + Map result = new HashMap<>(); + Map productMap = getH5Detail(productIds); + Map> attrMap = attrService.getListByProductIdAndType(productIds, Constants.PRODUCT_TYPE_NORMAL); + Map> attrValueMap = storeProductAttrValueService.getListByProductIdAndType(productIds, Constants.PRODUCT_TYPE_NORMAL); + for (Integer productId : productIds) { + ProductDetailVo detailVo = new ProductDetailVo(); + List storeProductAttrValues = attrValueMap.get(productId); + detailVo.setProductInfo(JSON.parseObject(JSON.toJSONString(productMap.get(productId)), ProductInfoVo.class)); + detailVo.setProductAttr(JSON.parseArray(JSON.toJSONString(attrMap.get(productId)), ProductAttrVo.class)); + HashMap skuMap = CollUtil.newHashMap(); + for (StoreProductAttrValue storeProductAttrValue : storeProductAttrValues) { + ProductAttrValueVo atr = new ProductAttrValueVo(); + BeanUtils.copyProperties(storeProductAttrValue, atr); + skuMap.put(atr.getSuk(), atr); + } + detailVo.setProductValue(skuMap); + result.put(productId, detailVo); + } + return result; + } + + /** + * 获取商品SKU详情 + * @param id 商品编号 + * @return 商品详情信息 + */ + @Override + public ProductDetailVo getSkuDetail(Integer id) { + ProductDetailVo detailVo = new ProductDetailVo(); + // 查询商品 + StoreProduct storeProduct = this.getH5Detail(id); + // 获取商品规格 + List attrList = attrService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL); + // 根据制式设置attr属性 + detailVo.setProductAttr(JSON.parseArray(JSON.toJSONString(attrList), ProductAttrVo.class)); + // 根据制式设置sku属性 + HashMap skuMap = CollUtil.newHashMap(); + List storeProductAttrValues = storeProductAttrValueService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL); + for (StoreProductAttrValue storeProductAttrValue : storeProductAttrValues) { + ProductAttrValueVo atr = new ProductAttrValueVo(); + BeanUtils.copyProperties(storeProductAttrValue, atr); + skuMap.put(atr.getSuk(), atr); + } + detailVo.setProductValue(skuMap); + detailVo.setProductInfo(JSON.parseObject(JSON.toJSONString(storeProduct), ProductInfoVo.class)); + return detailVo; + } + /** * 获取产品列表Admin * @param request 筛选参数 @@ -1203,6 +1257,19 @@ public class StoreProductServiceImpl extends ServiceImpl getH5Detail(List productIds) { + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.select(StoreProduct::getId, StoreProduct::getImage, StoreProduct::getStoreName, StoreProduct::getSliderImage, + StoreProduct::getOtPrice, StoreProduct::getStock, StoreProduct::getSales, StoreProduct::getPrice, StoreProduct::getActivity, + StoreProduct::getFicti, StoreProduct::getIsSub, StoreProduct::getStoreInfo, StoreProduct::getBrowse, StoreProduct::getUnitName, StoreProduct::getTags, StoreProduct::getSpecType); + lqw.in(StoreProduct::getId, productIds); + lqw.eq(StoreProduct::getIsRecycle, false); + lqw.eq(StoreProduct::getIsDel, false); + lqw.eq(StoreProduct::getIsShow, true); + List list = dao.selectList(lqw); + return list.stream().collect(Collectors.toMap(StoreProduct::getId, value -> value)); + } + /** * 获取移动端商品详情 * @param id 商品id @@ -1213,7 +1280,7 @@ public class StoreProductServiceImpl extends ServiceImpl lqw = Wrappers.lambdaQuery(); lqw.select(StoreProduct::getId, StoreProduct::getImage, StoreProduct::getStoreName, StoreProduct::getSliderImage, StoreProduct::getOtPrice, StoreProduct::getStock, StoreProduct::getSales, StoreProduct::getPrice, StoreProduct::getActivity, - StoreProduct::getFicti, StoreProduct::getIsSub, StoreProduct::getStoreInfo, StoreProduct::getBrowse, StoreProduct::getUnitName, StoreProduct::getTags); + StoreProduct::getFicti, StoreProduct::getIsSub, StoreProduct::getStoreInfo, StoreProduct::getBrowse, StoreProduct::getUnitName, StoreProduct::getTags, StoreProduct::getSpecType); lqw.eq(StoreProduct::getId, id); lqw.eq(StoreProduct::getIsRecycle, false); lqw.eq(StoreProduct::getIsDel, false); diff --git a/food-service/src/main/resources/mapper/home/HomeMapper.xml b/food-service/src/main/resources/mapper/home/HomeMapper.xml index 97822d6..40ba4b9 100644 --- a/food-service/src/main/resources/mapper/home/HomeMapper.xml +++ b/food-service/src/main/resources/mapper/home/HomeMapper.xml @@ -2,6 +2,12 @@ + + - 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 = 1 order by h.order_no + where h.del_flag = 1 and h.type = 2 and h.business = #{entity.cid} order by h.order_no diff --git a/food-service/src/main/resources/mapper/home/HomeProductMapper.xml b/food-service/src/main/resources/mapper/home/HomeProductMapper.xml index 83484db..9441807 100644 --- a/food-service/src/main/resources/mapper/home/HomeProductMapper.xml +++ b/food-service/src/main/resources/mapper/home/HomeProductMapper.xml @@ -2,8 +2,8 @@ - + 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