This commit is contained in:
tangzh 2025-03-06 23:19:59 +08:00
parent 97cae5e6b6
commit 1e9be01e18
39 changed files with 635 additions and 406 deletions

View File

@ -94,8 +94,8 @@ public class SwaggerConfig{
private ApiInfo apiInfo() { private ApiInfo apiInfo() {
return new ApiInfoBuilder() return new ApiInfoBuilder()
.title("Crmeb Java") .title("Food Admin Java")
.description("Crmeb") .description("Food Admin")
.termsOfServiceUrl("http://host:port") .termsOfServiceUrl("http://host:port")
.version("1.0.0").build(); .version("1.0.0").build();
} }

View File

@ -116,7 +116,7 @@ public class Constants {
//城市数据 redis key //城市数据 redis key
public static final String CITY_LIST = "city_list"; public static final String CITY_LIST = "city_list";
//城市数据 tree redis key //城市数据 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 //城市数据 tree redis key
public static final String CITY_LIST_LEVEL_1 = "city_list_level_1"; 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_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_RECHARGE_MIN_AMOUNT = "store_user_min_recharge"; //最小充值金额
// public static final String CONFIG_KEY_PROGRAM_LOGO = "routine_logo"; //小程序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_PUBLIC_LOGO = "wechat_avatar"; //公众号logo
public static final String CONFIG_KEY_LOGISTICS_APP_CODE = "system_express_app_code"; //快递查询密钥 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 String PRODUCT_TYPE_PINGTUAN_STR= "拼团";
public static final Integer PRODUCT_TYPE_COMPONENT= 4; public static final Integer PRODUCT_TYPE_COMPONENT= 4;
public static final String PRODUCT_TYPE_COMPONENT_STR= "组件"; 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; public static final Integer PRODUCT_TYPE_GROUP = 0;
// 楼层渠道 // 楼层渠道

View File

@ -54,8 +54,7 @@ public class PayComponentProductAddRequest implements Serializable {
@ApiModelProperty(value = "商品详情图片,多图") @ApiModelProperty(value = "商品详情图片,多图")
private String descImgs; private String descImgs;
@ApiModelProperty(value = "运费模板ID", required = true) @ApiModelProperty(value = "运费模板ID")
@NotNull(message = "运费模板不能为空")
private Integer tempId; private Integer tempId;
@ApiModelProperty(value = "库存") @ApiModelProperty(value = "库存")

View File

@ -1,6 +1,5 @@
package com.zbkj.common.request; package com.zbkj.common.request;
import com.zbkj.common.constants.Constants;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -20,7 +19,4 @@ public class SetMealRequest implements Serializable {
@ApiModelProperty(value = "门店id") @ApiModelProperty(value = "门店id")
private String storeId; private String storeId;
@ApiModelProperty(value = "2套餐分类层")
private Integer homeType = Constants.HOME_TYPE_2;
} }

View File

@ -80,7 +80,6 @@ public class StoreCombinationRequest implements Serializable {
private String unitName; private String unitName;
@ApiModelProperty(value = "运费模板ID") @ApiModelProperty(value = "运费模板ID")
@NotNull(message = "运费模板不能为空")
private Integer tempId; private Integer tempId;
@ApiModelProperty(value = "购买数量") @ApiModelProperty(value = "购买数量")

View File

@ -86,15 +86,13 @@ public class StoreProductAddRequest implements Serializable {
@ApiModelProperty(value = "获得积分") @ApiModelProperty(value = "获得积分")
private Integer giveIntegral; private Integer giveIntegral;
@ApiModelProperty(value = "是否单独分佣", required = true) @ApiModelProperty(value = "是否单独分佣")
@NotNull(message = "是否单独分佣不能为空")
private Boolean isSub; private Boolean isSub;
@ApiModelProperty(value = "虚拟销量") @ApiModelProperty(value = "虚拟销量")
private Integer ficti; private Integer ficti;
@ApiModelProperty(value = "运费模板ID", required = true) @ApiModelProperty(value = "运费模板ID")
@NotNull(message = "运费模板不能为空")
private Integer tempId; private Integer tempId;
@ApiModelProperty(value = "规格 0单 1多", required = true) @ApiModelProperty(value = "规格 0单 1多", required = true)

View File

@ -76,8 +76,7 @@ public class StoreSeckillAddRequest {
@NotNull(message = "时间段不能为空") @NotNull(message = "时间段不能为空")
private Integer timeId; private Integer timeId;
@ApiModelProperty(value = "运费模板ID", required = true) @ApiModelProperty(value = "运费模板ID")
@NotNull(message = "运费模板不能为空")
private Integer tempId; private Integer tempId;
@ApiModelProperty(value = "商品属性", required = true) @ApiModelProperty(value = "商品属性", required = true)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1,5 +1,7 @@
package com.zbkj.common.vo; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -7,6 +9,8 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ -32,4 +36,13 @@ public class HomeProductVo implements Serializable {
@ApiModelProperty(value = "跳转地址") @ApiModelProperty(value = "跳转地址")
private String directUrl; private String directUrl;
@ApiModelProperty(value = "产品属性")
private List<ProductAttrVo> productAttr;
@ApiModelProperty(value = "商品属性详情")
private HashMap<String, Object> productValue;
@ApiModelProperty(value = "商品信息")
private ProductInfoVo productInfo;
} }

View File

@ -26,6 +26,7 @@ public class HomeVo implements Serializable {
private static final long serialVersionUID=1L; private static final long serialVersionUID=1L;
private Integer id;
/** /**
* 名称 * 名称
*/ */
@ -59,6 +60,6 @@ public class HomeVo implements Serializable {
@Transient @Transient
@TableField(exist = false) @TableField(exist = false)
private List<HomeProductVo> products; private Object products;
} }

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<ProductAttrVo> productAttr;
@ApiModelProperty(value = "商品属性详情")
private HashMap<String, Object> productValue;
@ApiModelProperty(value = "商品信息")
private ProductInfoVo productInfo;
@ApiModelProperty(value = "收藏标识")
private Boolean userCollect;
}

View File

@ -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;
}

View File

@ -96,8 +96,8 @@ public class SwaggerConfig{
private ApiInfo apiInfo() { private ApiInfo apiInfo() {
return new ApiInfoBuilder() return new ApiInfoBuilder()
.title("Crmeb Java") .title("Food Front Java")
.description("Crmeb") .description("Food Front")
.termsOfServiceUrl("http://host:port") .termsOfServiceUrl("http://host:port")
.version("1.0.0").build(); .version("1.0.0").build();
} }

View File

@ -68,19 +68,21 @@ public class WebConfig implements WebMvcConfigurer {
excludePathPatterns("/api/front/groom/list/**"). excludePathPatterns("/api/front/groom/list/**").
excludePathPatterns("/api/front/config"). excludePathPatterns("/api/front/config").
excludePathPatterns("/api/front/category"). excludePathPatterns("/api/front/category").
excludePathPatterns("/api/front/category/top").
excludePathPatterns("/api/front/seckill/*"). excludePathPatterns("/api/front/seckill/*").
excludePathPatterns("/api/front/seckill/list/*"). excludePathPatterns("/api/front/seckill/list/*").
excludePathPatterns("/api/front/seckill/detail/*"). excludePathPatterns("/api/front/seckill/detail/*").
excludePathPatterns("/api/front/ios/*"). excludePathPatterns("/api/front/ios/*").
excludePathPatterns("/api/front/ios/register/binding/phone"). excludePathPatterns("/api/front/ios/register/binding/phone").
excludePathPatterns("api/front/combination/index"). excludePathPatterns("/api/front/combination/index").
excludePathPatterns("api/front/seckill/index"). excludePathPatterns("/api/front/seckill/index").
excludePathPatterns("api/front/bargain/index"). excludePathPatterns("/api/front/bargain/index").
excludePathPatterns("api/front/combination/index"). excludePathPatterns("/api/front/combination/index").
excludePathPatterns("api/front/index/product/*"). excludePathPatterns("/api/front/index/product/*").
excludePathPatterns("api/front/index/color/config"). excludePathPatterns("/api/front/index/color/config").
excludePathPatterns("api/front/image/domain"). excludePathPatterns("/api/front/image/domain").
excludePathPatterns("api/front/product/leaderboard"). excludePathPatterns("/api/front/product/leaderboard").
excludePathPatterns("/api/front/setMeal/**").
excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**"); excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
} }

View File

@ -7,9 +7,9 @@ import com.zbkj.common.request.SetMealFloorProRequest;
import com.zbkj.common.request.SetMealFloorRequest; import com.zbkj.common.request.SetMealFloorRequest;
import com.zbkj.common.request.SetMealRequest; import com.zbkj.common.request.SetMealRequest;
import com.zbkj.common.response.CommonResult; 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.response.SetMealResponse;
import com.zbkj.common.vo.HomeProductVo;
import com.zbkj.common.vo.HomeVo;
import com.zbkj.service.service.EbHomeService; import com.zbkj.service.service.EbHomeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; 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.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j @Slf4j
@RestController("HomeController") @RestController("HomeController")
@RequestMapping("api/front") @RequestMapping("api/front")
@Api(tags = "楼层") @Api(tags = "楼层")
public class HomeController { public class HomeController {
@Autowired @Autowired private EbHomeService homeService;
private EbHomeService homeService;
@ApiOperation(value = "套餐导航类型列表") @ApiOperation(value = "套餐导航列表-分页")
@RequestMapping(value = "/setMeal/type", method = RequestMethod.GET) @RequestMapping(value = "/setMeal/type", method = RequestMethod.GET)
public CommonResult<CommonPage<SetMealResponse>> selectPageSetMealType(@Validated SetMealRequest entity, @Validated PageParamRequest page) { public CommonResult<CommonPage<SetMealResponse>> selectPageSetMealType(@Validated SetMealRequest entity, @Validated PageParamRequest page) {
return CommonResult.success(homeService.selectPageSetMealType(entity, page)); List<SetMealResponse> list = homeService.selectPageSetMealType(entity, page);
return CommonResult.success(CommonPage.restPage(list));
} }
@ApiOperation(value = "套餐楼层") @ApiOperation(value = "套餐楼层列表-分页")
@RequestMapping(value = "/setMeal/floor", method = RequestMethod.GET) @RequestMapping(value = "/setMeal/floor", method = RequestMethod.GET)
public CommonResult<CommonPage<SetMealFloorResponse>> selectPageSetMealFloor(@Validated SetMealFloorRequest entity, @Validated PageParamRequest page) { public CommonResult<CommonPage<HomeVo>> selectPageSetMealFloor(@Validated SetMealFloorRequest entity, @Validated PageParamRequest page) {
return CommonResult.success(homeService.selectPageSetMealFloor(entity, page)); List<HomeVo> list = homeService.selectPageSetMealFloor(entity, page);
return CommonResult.success(CommonPage.restPage(list));
} }
@ApiOperation(value = "套餐楼层商品") @ApiOperation(value = "套餐楼层商品-分页")
@RequestMapping(value = "/setMeal/floor/pro", method = RequestMethod.GET) @RequestMapping(value = "/setMeal/floor/pro", method = RequestMethod.GET)
public CommonResult<CommonPage<SetMealFloorProResponse>> selectPageSetMealFloorPro(@Validated SetMealFloorProRequest entity, @Validated PageParamRequest page) { public CommonResult<CommonPage<HomeProductVo>> selectPageSetMealFloorPro(@Validated SetMealFloorProRequest entity, @Validated PageParamRequest page) {
return CommonResult.success(homeService.selectPageSetMealFloorPro(entity, page)); List<HomeProductVo> list = homeService.selectPageSetMealFloorPro(entity, page);
return CommonResult.success(CommonPage.restPage(list));
} }

View File

@ -39,24 +39,7 @@ public class IndexController {
* 首页数据 * 首页数据
*/ */
@RequestMapping(value = "/index", method = RequestMethod.GET) @RequestMapping(value = "/index", method = RequestMethod.GET)
@ApiOperation(value="首页数据", notes="首页数据" @ApiOperation(value="首页数据", notes="首页数据")
+ " \n \n"
+ "响应参数:" + " \n"
+ "homeList楼层" + " \n"
+ " --> name名称" + " \n"
+ " --> title标题" + " \n"
+ " --> directUrl列表路径\"" + " \n"
+ " --> image图片" + " \n"
+ " --> jumpIds跳转idlist_ids/product_id" + " \n"
+ " --> jumpType跳转类型1列表0详情" + " \n"
+ " -->--> products商品" + " \n"
+ " -->-->--> productId产品id" + " \n"
+ " -->-->--> imgUrl图片" + " \n"
+ " -->-->--> directUrl跳转地址" + " \n"
+ "logoUrl企业logo" + " \n"
+ "consumerHotline客服电话" + " \n"
+ "telephoneServiceSwitch客服电话服务开关" + " \n"
)
public CommonResult<IndexInfoResponse> getIndexInfo() { public CommonResult<IndexInfoResponse> getIndexInfo() {
return CommonResult.success(indexService.getIndexInfo()); return CommonResult.success(indexService.getIndexInfo());
} }
@ -66,7 +49,7 @@ public class IndexController {
*/ */
@ApiOperation(value = "首页商品列表") @ApiOperation(value = "首页商品列表")
@RequestMapping(value = "/index/product/{type}", method = RequestMethod.GET) @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<CommonPage<IndexProductResponse>> getProductList(@PathVariable(value = "type") Integer type, PageParamRequest pageParamRequest) { public CommonResult<CommonPage<IndexProductResponse>> getProductList(@PathVariable(value = "type") Integer type, PageParamRequest pageParamRequest) {
return CommonResult.success(indexService.findIndexProductList(type, pageParamRequest)); return CommonResult.success(indexService.findIndexProductList(type, pageParamRequest));
} }

View File

@ -41,10 +41,19 @@ public class ProductController {
return CommonResult.success(productService.getHotProductList(pageParamRequest)); return CommonResult.success(productService.getHotProductList(pageParamRequest));
} }
/**
* 获取一级分类
*/
@ApiOperation(value = "获取分类-一级")
@RequestMapping(value = "/category/top", method = RequestMethod.GET)
public CommonResult<List<CategoryTreeVo>> getCategoryTop() {
return CommonResult.success(productService.getCategoryTop());
}
/** /**
* 获取分类 * 获取分类
*/ */
@ApiOperation(value = "获取分类") @ApiOperation(value = "获取分类-树形")
@RequestMapping(value = "/category", method = RequestMethod.GET) @RequestMapping(value = "/category", method = RequestMethod.GET)
public CommonResult<List<CategoryTreeVo>> getCategory() { public CommonResult<List<CategoryTreeVo>> getCategory() {
return CommonResult.success(productService.getCategory()); return CommonResult.success(productService.getCategory());

View File

@ -1,34 +1,34 @@
package com.zbkj.front.pub; //package com.zbkj.front.pub;
//
import com.zbkj.common.constants.Constants; //import com.zbkj.common.constants.Constants;
import com.zbkj.service.service.SystemConfigService; //import com.zbkj.service.service.SystemConfigService;
import io.swagger.annotations.Api; //import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; //import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; //import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; //import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; //import org.springframework.web.bind.annotation.RestController;
//
/** ///**
* @program: crmeb // * @program: crmeb
* @author: 大粽子 // * @author: 大粽子
* @create: 2021-09-23 09:18 // * @create: 2021-09-23 09:18
**/ // **/
@Slf4j //@Slf4j
@RestController //@RestController
@RequestMapping("api/public/jsconfig") //@RequestMapping("api/public/jsconfig")
@Api(tags = "公共JS配置") //@Api(tags = "公共JS配置")
public class GetJSConfig { //public class GetJSConfig {
//
@Autowired // @Autowired
private SystemConfigService systemConfigService; // private SystemConfigService systemConfigService;
//
@PreAuthorize("hasAuthority('public:jsconfig:getcrmebchatconfig')") // @PreAuthorize("hasAuthority('public:jsconfig:getcrmebchatconfig')")
@ApiOperation(value = "CRMEB-chat客服统计") // @ApiOperation(value = "CRMEB-chat客服统计")
@RequestMapping(value = "/getcrmebchatconfig", method = RequestMethod.GET) // @RequestMapping(value = "/getcrmebchatconfig", method = RequestMethod.GET)
public String set(){ // public String set(){
return systemConfigService.getValueByKey(Constants.JS_CONFIG_CRMEB_CHAT_TONGJI); // return systemConfigService.getValueByKey(Constants.JS_CONFIG_CRMEB_CHAT_TONGJI);
} // }
} //}

View File

@ -1,145 +1,145 @@
package com.zbkj.front.pub; //package com.zbkj.front.pub;
//
import com.alibaba.fastjson.JSONObject; //import com.alibaba.fastjson.JSONObject;
import com.zbkj.common.response.CommonResult; //import com.zbkj.common.response.CommonResult;
import com.zbkj.common.utils.RestTemplateUtil; //import com.zbkj.common.utils.RestTemplateUtil;
import io.swagger.annotations.Api; //import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; //import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; //import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; //import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*; //import org.springframework.web.bind.annotation.*;
//
import javax.annotation.Resource; //import javax.annotation.Resource;
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.HashMap; //import java.util.HashMap;
import java.util.Map; //import java.util.Map;
//
//
/** ///**
* 后台管理员表 前端控制器 // * 后台管理员表 前端控制器
//
*/ // */
@Slf4j //@Slf4j
@RestController //@RestController
@RequestMapping("api/public/wechat") //@RequestMapping("api/public/wechat")
@Api(tags = "企业微信消息推送") //@Api(tags = "企业微信消息推送")
public class WeChatPushController { //public class WeChatPushController {
//
private static String url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="; // private static String url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=";
//
@Resource // @Resource
private RestTemplateUtil restTemplateUtil; // private RestTemplateUtil restTemplateUtil;
//
//
/** // /**
* 新增后台管理员表 // * 新增后台管理员表
* @param message string message // * @param message string message
* @author Mr.Zhang // * @author Mr.Zhang
* @since 2020-04-13 // * @since 2020-04-13
*/ // */
@ApiOperation(value = "gitlab钩子") // @ApiOperation(value = "gitlab钩子")
@RequestMapping(value = "/gitlab", method = RequestMethod.POST) // @RequestMapping(value = "/gitlab", method = RequestMethod.POST)
@ApiImplicitParams({ // @ApiImplicitParams({
@ApiImplicitParam(name="message", value="推送消息内容"), // @ApiImplicitParam(name="message", value="推送消息内容"),
@ApiImplicitParam(name="token", value="企业微信群token"), // @ApiImplicitParam(name="token", value="企业微信群token"),
}) // })
public CommonResult<Object> gitlab(@RequestBody String message, // public CommonResult<Object> gitlab(@RequestBody String message,
@RequestParam(name = "token", required = true) String token){ // @RequestParam(name = "token", required = true) String token){
//
Map<String, Object> map = new HashMap<>(); // Map<String, Object> map = new HashMap<>();
map.put("msgtype", "text"); // map.put("msgtype", "text");
//
Map<String, Object> text = new HashMap<>(); // Map<String, Object> text = new HashMap<>();
//
//需要@的人 // //需要@的人
ArrayList<Object> people = new ArrayList<>(); // ArrayList<Object> people = new ArrayList<>();
people.add("@all"); // people.add("@all");
text.put("mentioned_list", people); // text.put("mentioned_list", people);
//
//gitlab 动作标签 // //gitlab 动作标签
JSONObject jsonObject = JSONObject.parseObject(message); // JSONObject jsonObject = JSONObject.parseObject(message);
String action = jsonObject.getString("object_kind"); // String action = jsonObject.getString("object_kind");
String content; // String content;
switch(action){ // switch(action){
case "push": // case "push":
content = jsonObject.getJSONArray("commits").getJSONObject(0).getJSONObject("author").getString("name") + " " + // content = jsonObject.getJSONArray("commits").getJSONObject(0).getJSONObject("author").getString("name") + " " +
action + " " + // action + " " +
jsonObject.getString("ref").replace("refs/heads/", "") + // jsonObject.getString("ref").replace("refs/heads/", "") +
"\n 备注:\n" + // "\n 备注:\n" +
jsonObject.getJSONArray("commits").getJSONObject(0).getString("message"); // jsonObject.getJSONArray("commits").getJSONObject(0).getString("message");
break; // break;
case "tag_push": // case "tag_push":
content = jsonObject.getString("user_name") + " " + // content = jsonObject.getString("user_name") + " " +
action + " " + // action + " " +
jsonObject.getString("ref").replace("refs/heads/", "") + // jsonObject.getString("ref").replace("refs/heads/", "") +
"\n 备注:\n" + // "\n 备注:\n" +
jsonObject.getJSONArray("commits").getJSONObject(0).getString("message"); // jsonObject.getJSONArray("commits").getJSONObject(0).getString("message");
break; // break;
case "note": // case "note":
String author = "未知用户"; // String author = "未知用户";
if(jsonObject.containsKey("commit")){ // if(jsonObject.containsKey("commit")){
author = jsonObject.getJSONObject("commit").getJSONObject("author").getString("name"); // author = jsonObject.getJSONObject("commit").getJSONObject("author").getString("name");
} // }
//
if(jsonObject.containsKey("last_commit")){ // if(jsonObject.containsKey("last_commit")){
author = jsonObject.getJSONObject("last_commit").getJSONObject("author").getString("name"); // author = jsonObject.getJSONObject("last_commit").getJSONObject("author").getString("name");
} // }
//
content = author + // content = author +
" 提交代码到 " + // " 提交代码到 " +
jsonObject.getJSONObject("project").getString("default_branch") + // jsonObject.getJSONObject("project").getString("default_branch") +
"\n 备注:\n" + // "\n 备注:\n" +
jsonObject.getJSONObject("object_attributes").getString("note"); // jsonObject.getJSONObject("object_attributes").getString("note");
break; // break;
case "merge_request": // case "merge_request":
content = jsonObject.getJSONObject("object_attributes").getJSONObject("assignee").getString("name") + " " + // content = jsonObject.getJSONObject("object_attributes").getJSONObject("assignee").getString("name") + " " +
"合并代码, 从 " + // "合并代码, 从 " +
jsonObject.getJSONObject("object_attributes").getString("source_branch") + " ---> " + // jsonObject.getJSONObject("object_attributes").getString("source_branch") + " ---> " +
jsonObject.getJSONObject("object_attributes").getString("target_branch") + // jsonObject.getJSONObject("object_attributes").getString("target_branch") +
"\n 备注:\n" + // "\n 备注:\n" +
jsonObject.getJSONObject("object_attributes").getJSONObject("last_commit").getString("message"); // jsonObject.getJSONObject("object_attributes").getJSONObject("last_commit").getString("message");
break; // break;
default: // default:
content = "gitlab 项目有更新"; // content = "gitlab 项目有更新";
} // }
//
text.put("content", content); // text.put("content", content);
map.put("text", text); // map.put("text", text);
String result = restTemplateUtil.postMapData(url + token, map); // String result = restTemplateUtil.postMapData(url + token, map);
return CommonResult.success(JSONObject.parseObject(result)); // return CommonResult.success(JSONObject.parseObject(result));
} // }
//
/** // /**
* 新增后台管理员表 // * 新增后台管理员表
* @param message string message // * @param message string message
* @author Mr.Zhang // * @author Mr.Zhang
* @since 2020-04-13 // * @since 2020-04-13
*/ // */
@ApiOperation(value = "消息推送") // @ApiOperation(value = "消息推送")
@RequestMapping(value = "/push", method = RequestMethod.GET) // @RequestMapping(value = "/push", method = RequestMethod.GET)
@ApiImplicitParams({ // @ApiImplicitParams({
@ApiImplicitParam(name="message", value="推送消息内容"), // @ApiImplicitParam(name="message", value="推送消息内容"),
@ApiImplicitParam(name="token", value="企业微信群token"), // @ApiImplicitParam(name="token", value="企业微信群token"),
}) // })
public CommonResult<Object> push(@RequestParam(name = "message") String message, // public CommonResult<Object> push(@RequestParam(name = "message") String message,
@RequestParam(name = "token") String token){ // @RequestParam(name = "token") String token){
//
Map<String, Object> map = new HashMap<>(); // Map<String, Object> map = new HashMap<>();
map.put("msgtype", "text"); // map.put("msgtype", "text");
//
Map<String, Object> text = new HashMap<>(); // Map<String, Object> text = new HashMap<>();
//
//需要@的人 // //需要@的人
ArrayList<Object> people = new ArrayList<>(); // ArrayList<Object> people = new ArrayList<>();
people.add("@all"); // people.add("@all");
text.put("mentioned_list", people); // text.put("mentioned_list", people);
text.put("content", message); // text.put("content", message);
map.put("text", text); // map.put("text", text);
String result = restTemplateUtil.postMapData(url + token, map); // String result = restTemplateUtil.postMapData(url + token, map);
return CommonResult.success(JSONObject.parseObject(result)); // return CommonResult.success(JSONObject.parseObject(result));
} // }
} //}
//
//
//

View File

@ -102,4 +102,11 @@ public interface ProductService {
* @return * @return
*/ */
CommonPage<IndexProductResponse> getSalesProductList(PageParamRequest pageParamRequest); CommonPage<IndexProductResponse> getSalesProductList(PageParamRequest pageParamRequest);
/**
* 产品一级分类
* @return
*/
List<CategoryTreeVo> getCategoryTop();
} }

View File

@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.zbkj.common.model.home.Home;
import com.zbkj.common.page.CommonPage; import com.zbkj.common.page.CommonPage;
import com.zbkj.common.response.IndexInfoResponse; import com.zbkj.common.response.IndexInfoResponse;
import com.zbkj.common.response.IndexProductResponse; 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.record.UserVisitRecord;
import com.zbkj.common.model.product.StoreProduct; import com.zbkj.common.model.product.StoreProduct;
import com.zbkj.common.model.system.SystemConfig; import com.zbkj.common.model.system.SystemConfig;
import com.zbkj.common.model.user.User;
import com.zbkj.front.service.IndexService; import com.zbkj.front.service.IndexService;
import com.zbkj.service.delete.ProductUtils; import com.zbkj.service.delete.ProductUtils;
import com.zbkj.service.service.*; import com.zbkj.service.service.*;
@ -66,12 +64,10 @@ public class IndexServiceImpl implements IndexService {
@Override @Override
public IndexInfoResponse getIndexInfo() { public IndexInfoResponse getIndexInfo() {
IndexInfoResponse indexInfoResponse = new IndexInfoResponse(); IndexInfoResponse indexInfoResponse = new IndexInfoResponse();
indexInfoResponse.setHomeList(homeService.getIndexHomeList(0)); // 楼层
indexInfoResponse.setHomeList(homeService.selectHomeType(Constants.HOME_TYPE_1, 0)); // 楼层
indexInfoResponse.setLogoUrl(systemConfigService.getValueByKey(Constants.CONFIG_KEY_SITE_LOGO));// 企业logo地址 indexInfoResponse.setLogoUrl(systemConfigService.getValueByKey(Constants.CONFIG_KEY_SITE_LOGO));// 企业logo地址
indexInfoResponse.setConsumerHotline(systemConfigService.getValueByKey(Constants.CONFIG_KEY_CONSUMER_HOTLINE));// 客服电话 indexInfoResponse.setConsumerHotline(systemConfigService.getValueByKey(Constants.CONFIG_KEY_CONSUMER_HOTLINE));// 客服电话
indexInfoResponse.setTelephoneServiceSwitch(systemConfigService.getValueByKey(Constants.CONFIG_KEY_TELEPHONE_SERVICE_SWITCH));// 客服电话服务 indexInfoResponse.setTelephoneServiceSwitch(systemConfigService.getValueByKey(Constants.CONFIG_KEY_TELEPHONE_SERVICE_SWITCH));// 客服电话服务
// 保存用户访问记录 // 保存用户访问记录
UserVisitRecord visitRecord = new UserVisitRecord(); UserVisitRecord visitRecord = new UserVisitRecord();
visitRecord.setDate(DateUtil.date().toString("yyyy-MM-dd")); visitRecord.setDate(DateUtil.date().toString("yyyy-MM-dd"));

View File

@ -4,11 +4,15 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; 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.github.pagehelper.PageInfo;
import com.zbkj.common.constants.CategoryConstants; import com.zbkj.common.constants.CategoryConstants;
import com.zbkj.common.constants.Constants; import com.zbkj.common.constants.Constants;
import com.zbkj.common.constants.RedisConstatns; import com.zbkj.common.constants.RedisConstatns;
import com.zbkj.common.constants.SysConfigConstants; 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.StoreProduct;
import com.zbkj.common.model.product.StoreProductAttr; import com.zbkj.common.model.product.StoreProductAttr;
import com.zbkj.common.model.product.StoreProductAttrValue; import com.zbkj.common.model.product.StoreProductAttrValue;
@ -33,10 +37,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/** /**
* IndexServiceImpl 接口实现 * IndexServiceImpl 接口实现
@ -84,6 +85,17 @@ public class ProductServiceImpl implements ProductService {
@Autowired @Autowired
private UserVisitRecordService userVisitRecordService; private UserVisitRecordService userVisitRecordService;
@Override
public List<CategoryTreeVo> getCategoryTop() {
LambdaQueryWrapper<Category> 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<Category> list = categoryService.list(lq);
return JSON.parseArray(JSON.toJSONString(list), CategoryTreeVo.class);
}
/** /**
* 获取分类 * 获取分类
* @return List<CategoryTreeVo> * @return List<CategoryTreeVo>
@ -603,7 +615,6 @@ public class ProductServiceImpl implements ProductService {
return productResponseCommonPage; return productResponseCommonPage;
} }
} }

View File

@ -435,7 +435,8 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
*/ */
@Override @Override
public LoginResponse weChatAuthorizeProgramLogin(String code, RegisterThirdUserRequest request) { 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)); logger.info(">>>小程序登陆获取openId>>> {}" + JSON.toJSONString(response));
//检测是否存在 //检测是否存在

View File

@ -1,6 +1,6 @@
# 水月雨 相关配置 # 相关配置
crmeb: crmeb:
version: syy-1.0.0 # 当前代码版本 version: front-1.0.0 # 当前代码版本
# 配置端口 # 配置端口
server: server:
@ -23,7 +23,7 @@ spring:
resources: resources:
static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${crmeb.filePath} static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${crmeb.filePath}
application: application:
name: cemrb-front #这个很重要这在以后的服务与服务之间相互调用一般都是根据这个name name: front-front #这个很重要这在以后的服务与服务之间相互调用一般都是根据这个name
jackson: jackson:
locale: zh_CN locale: zh_CN
time-zone: GMT+8 time-zone: GMT+8
@ -33,11 +33,11 @@ debug: true
logging: logging:
level: level:
io.swagger.*: error io.swagger.*: error
com.zbjk.crmeb: debug com.zbjk.front: debug
org.springframework.boot.autoconfigure: ERROR org.springframework.boot.autoconfigure: ERROR
config: classpath:logback-spring.xml config: classpath:logback-spring.xml
file: file:
path: ./crmeb_log path: ./front_log
# mybatis 配置 # mybatis 配置
mybatis-plus: mybatis-plus:

View File

@ -2,18 +2,20 @@ package com.zbkj.service.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbkj.common.model.home.Home; import com.zbkj.common.model.home.Home;
import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.SetMealFloorRequest; import com.zbkj.common.request.SetMealFloorRequest;
import com.zbkj.common.request.SetMealRequest; import com.zbkj.common.request.SetMealRequest;
import com.zbkj.common.response.SetMealFloorResponse;
import com.zbkj.common.response.SetMealResponse; import com.zbkj.common.response.SetMealResponse;
import com.zbkj.common.vo.HomeVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface HomeDao extends BaseMapper<Home> { public interface HomeDao extends BaseMapper<Home> {
List<SetMealResponse> selectPageSetMealType(@Param("entity") SetMealRequest entity, PageParamRequest page); 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<SetMealFloorResponse> selectPageSetMealFloor(@Param("entity") SetMealFloorRequest entity, PageParamRequest page);
} }

View File

@ -2,14 +2,12 @@ package com.zbkj.service.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbkj.common.model.home.HomeProducts; import com.zbkj.common.model.home.HomeProducts;
import com.zbkj.common.request.PageParamRequest; import com.zbkj.common.vo.HomeProductVo;
import com.zbkj.common.response.SetMealFloorProResponse;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface HomeProductsDao extends BaseMapper<HomeProducts> { public interface HomeProductsDao extends BaseMapper<HomeProducts> {
List<SetMealFloorProResponse> selectPageFloorProduct(@Param("entity") HomeProducts qHp, PageParamRequest page); List<HomeProductVo> selectHomeProduct(Integer homeId);
} }

View File

@ -2,14 +2,12 @@ package com.zbkj.service.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.model.home.Home; import com.zbkj.common.model.home.Home;
import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.PageParamRequest; import com.zbkj.common.request.PageParamRequest;
import com.zbkj.common.request.SetMealFloorProRequest; import com.zbkj.common.request.SetMealFloorProRequest;
import com.zbkj.common.request.SetMealFloorRequest; import com.zbkj.common.request.SetMealFloorRequest;
import com.zbkj.common.request.SetMealRequest; 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.response.SetMealResponse;
import com.zbkj.common.vo.HomeProductVo;
import com.zbkj.common.vo.HomeVo; import com.zbkj.common.vo.HomeVo;
import java.util.List; import java.util.List;
@ -17,13 +15,13 @@ import java.util.List;
public interface EbHomeService extends IService<Home> { public interface EbHomeService extends IService<Home> {
List<HomeVo> selectHomeType(Integer homeType, Integer storeId); List<SetMealResponse> selectPageSetMealType(SetMealRequest entity, PageParamRequest page);
CommonPage<SetMealResponse> selectPageSetMealType(SetMealRequest entity, PageParamRequest page); List<HomeVo> selectPageSetMealFloor(SetMealFloorRequest entity, PageParamRequest page);
CommonPage<SetMealFloorResponse> selectPageSetMealFloor(SetMealFloorRequest entity, PageParamRequest page); List<HomeProductVo> selectPageSetMealFloorPro(SetMealFloorProRequest entity, PageParamRequest page);
CommonPage<SetMealFloorProResponse> selectPageSetMealFloorPro(SetMealFloorProRequest entity, PageParamRequest page); List<HomeVo> getIndexHomeList(Integer storeId);
} }

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.model.product.StoreProductAttr; import com.zbkj.common.model.product.StoreProductAttr;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* StoreProductAttrService 接口 * StoreProductAttrService 接口
@ -40,4 +41,6 @@ public interface StoreProductAttrService extends IService<StoreProductAttr> {
* @return List * @return List
*/ */
List<StoreProductAttr> getListByProductIdAndType(Integer productId, Integer type); List<StoreProductAttr> getListByProductIdAndType(Integer productId, Integer type);
Map<Integer, List<StoreProductAttr>> getListByProductIdAndType(List<Integer> productIds, Integer type);
} }

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.model.product.StoreProductAttrValue; import com.zbkj.common.model.product.StoreProductAttrValue;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* StoreProductAttrValueService 接口 * StoreProductAttrValueService 接口
@ -76,4 +77,6 @@ public interface StoreProductAttrValueService extends IService<StoreProductAttrV
* @return List * @return List
*/ */
List<StoreProductAttrValue> getListByProductIdAndType(Integer productId, Integer type); List<StoreProductAttrValue> getListByProductIdAndType(Integer productId, Integer type);
Map<Integer, List<StoreProductAttrValue>> getListByProductIdAndType(List<Integer> productIds, Integer type);
} }

View File

@ -3,15 +3,18 @@ package com.zbkj.service.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zbkj.common.model.product.StoreProduct; import com.zbkj.common.model.product.StoreProduct;
import com.zbkj.common.request.*; import com.zbkj.common.request.*;
import com.zbkj.common.response.ProductDetailResponse;
import com.zbkj.common.response.StoreProductInfoResponse; import com.zbkj.common.response.StoreProductInfoResponse;
import com.zbkj.common.response.StoreProductResponse; import com.zbkj.common.response.StoreProductResponse;
import com.zbkj.common.response.StoreProductTabsHeader; import com.zbkj.common.response.StoreProductTabsHeader;
import com.zbkj.common.vo.MyRecord; import com.zbkj.common.vo.MyRecord;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.zbkj.common.vo.product.ProductDetailVo;
import org.json.JSONException; import org.json.JSONException;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* StoreProductService 接口 * StoreProductService 接口
@ -19,6 +22,10 @@ import java.util.List;
*/ */
public interface StoreProductService extends IService<StoreProduct> { public interface StoreProductService extends IService<StoreProduct> {
Map<Integer, ProductDetailVo> getSkuDetails(List<Integer> productIds);
ProductDetailVo getSkuDetail(Integer id);
/** /**
* 获取产品列表Admin * 获取产品列表Admin
* @param request 筛选参数 * @param request 筛选参数

View File

@ -1,31 +1,28 @@
package com.zbkj.service.service.impl; package com.zbkj.service.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; 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.github.pagehelper.PageHelper;
import com.zbkj.common.model.article.Article; import com.zbkj.common.constants.Constants;
import com.zbkj.common.model.cat.StoreCart;
import com.zbkj.common.model.home.Home; import com.zbkj.common.model.home.Home;
import com.zbkj.common.model.home.HomeProducts;
import com.zbkj.common.page.CommonPage; import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.*; import com.zbkj.common.request.*;
import com.zbkj.common.response.*; import com.zbkj.common.response.*;
import com.zbkj.common.utils.RedisUtil; import com.zbkj.common.utils.RedisUtil;
import com.zbkj.common.vo.HomeProductVo;
import com.zbkj.common.vo.HomeVo; import com.zbkj.common.vo.HomeVo;
import com.zbkj.common.vo.product.ProductDetailVo;
import com.zbkj.service.dao.HomeDao; import com.zbkj.service.dao.HomeDao;
import com.zbkj.service.dao.HomeProductsDao; import com.zbkj.service.dao.HomeProductsDao;
import com.zbkj.service.service.EbHomeService; import com.zbkj.service.service.EbHomeService;
import com.zbkj.service.service.StoreProductService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
@ -34,61 +31,61 @@ public class EbHomeServiceImpl extends ServiceImpl<HomeDao, Home> implements EbH
@Autowired private RedisUtil redisUtil; @Autowired private RedisUtil redisUtil;
@Autowired private HomeDao dao; @Autowired private HomeDao dao;
@Autowired private HomeProductsDao homeProductsDao; @Autowired private HomeProductsDao homeProductsDao;
@Autowired private StoreProductService productService;
@Override @Override
public List<HomeVo> selectHomeType(Integer homeType, Integer storeId) { public List<HomeVo> getIndexHomeList(Integer storeId) {
String key = "HOME_TYPE_" + homeType + "_" + storeId; List<HomeVo> homeVos = dao.selectHomeType(Constants.HOME_TYPE_1, storeId);
String value = ""; for (HomeVo homeVo : homeVos) {
if (redisUtil.exists(key)) { // 默认展示99个
value = redisUtil.get(key); PageParamRequest fpPage = new PageParamRequest();
} else { fpPage.setPage(1);
LambdaQueryWrapper<Home> qHome = new LambdaQueryWrapper<>(); fpPage.setLimit(99);
qHome.eq(Home::getDelFlag, 1); SetMealFloorProRequest fp = new SetMealFloorProRequest();
qHome.eq(Home::getType, homeType); fp.setHomeId(homeVo.getId().toString());
qHome.orderByDesc(Home::getOrderNo); List<HomeProductVo> fpResult = selectPageSetMealFloorPro(fp, fpPage);
List<Home> hList = dao.selectList(qHome); homeVo.setProducts(fpResult);
for (Home home : hList) {
LambdaQueryWrapper<HomeProducts> qHomePro = new LambdaQueryWrapper<>();
qHomePro.eq(HomeProducts::getHomeId, home.getId());
qHomePro.eq(HomeProducts::getDelFlag, 1);
qHomePro.orderByDesc(HomeProducts::getOrderNo);
List<HomeProducts> products = homeProductsDao.selectList(qHomePro);
home.setProducts(products);
}
value = JSONObject.toJSONString(hList);
redisUtil.set(key, value);
} }
return JSONArray.parseArray(value, HomeVo.class); return homeVos;
} }
@Override @Override
public CommonPage<SetMealResponse> selectPageSetMealType(SetMealRequest entity, PageParamRequest page) { public List<SetMealResponse> selectPageSetMealType(SetMealRequest entity, PageParamRequest page) {
List<SetMealResponse> list = dao.selectPageSetMealType(entity, page); PageHelper.startPage(page.getPage(), page.getLimit());
return CommonPage.restPage(list); return dao.selectPageSetMealType(entity);
} }
@Override @Override
public CommonPage<SetMealFloorResponse> selectPageSetMealFloor(SetMealFloorRequest entity, PageParamRequest page) { public List<HomeVo> selectPageSetMealFloor(SetMealFloorRequest entity, PageParamRequest page) {
List<SetMealFloorResponse> list = dao.selectPageSetMealFloor(entity, page); PageHelper.startPage(page.getPage(), page.getLimit());
for (SetMealFloorResponse res : list) { List<HomeVo> list = dao.selectPageSetMealFloor(entity);
PageHelper.clearPage();
for (HomeVo home : list) {
// 默认展示6个 // 默认展示6个
PageParamRequest pPage = new PageParamRequest(); PageParamRequest fpPage = new PageParamRequest();
pPage.setPage(1); fpPage.setPage(1);
pPage.setLimit(6); fpPage.setLimit(6);
HomeProducts qHp = new HomeProducts(); SetMealFloorProRequest fp = new SetMealFloorProRequest();
qHp.setHomeId(res.getHomeId()); fp.setHomeId(home.getId().toString());
List<SetMealFloorProResponse> pList = homeProductsDao.selectPageFloorProduct(qHp, pPage); List<HomeProductVo> fpResult = selectPageSetMealFloorPro(fp, fpPage);
res.setHomeProducts(CommonPage.restPage(pList)); home.setProducts(CommonPage.restPage(fpResult));
} }
return CommonPage.restPage(list); return list;
} }
@Override @Override
public CommonPage<SetMealFloorProResponse> selectPageSetMealFloorPro(SetMealFloorProRequest entity, PageParamRequest page) { public List<HomeProductVo> selectPageSetMealFloorPro(SetMealFloorProRequest entity, PageParamRequest page) {
HomeProducts qHp = new HomeProducts(); PageHelper.startPage(page.getPage(), page.getLimit());
qHp.setHomeId(Integer.parseInt(entity.getHomeId())); List<HomeProductVo> list = homeProductsDao.selectHomeProduct(Integer.parseInt(entity.getHomeId()));
List<SetMealFloorProResponse> list = homeProductsDao.selectPageFloorProduct(qHp, page); PageHelper.clearPage();
return CommonPage.restPage(list); 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());
}
return list;
} }
} }

View File

@ -12,6 +12,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* StoreProductAttrServiceImpl 接口实现 * StoreProductAttrServiceImpl 接口实现
@ -84,5 +86,15 @@ public class StoreProductAttrServiceImpl extends ServiceImpl<StoreProductAttrDao
lqw.eq(StoreProductAttr::getIsDel, false); lqw.eq(StoreProductAttr::getIsDel, false);
return dao.selectList(lqw); return dao.selectList(lqw);
} }
@Override
public Map<Integer, List<StoreProductAttr>> getListByProductIdAndType(List<Integer> productIds, Integer type) {
LambdaQueryWrapper<StoreProductAttr> lqw = Wrappers.lambdaQuery();
lqw.in(StoreProductAttr::getProductId, productIds);
lqw.eq(StoreProductAttr::getType, type);
lqw.eq(StoreProductAttr::getIsDel, false);
List<StoreProductAttr> list = dao.selectList(lqw);
return list.stream().collect(Collectors.groupingBy(StoreProductAttr::getProductId));
}
} }

View File

@ -16,6 +16,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* StoreProductAttrValueServiceImpl 接口实现 * StoreProductAttrValueServiceImpl 接口实现
@ -177,5 +179,15 @@ public class StoreProductAttrValueServiceImpl extends ServiceImpl<StoreProductAt
lqw.eq(StoreProductAttrValue::getIsDel, false); lqw.eq(StoreProductAttrValue::getIsDel, false);
return dao.selectList(lqw); return dao.selectList(lqw);
} }
@Override
public Map<Integer, List<StoreProductAttrValue>> getListByProductIdAndType(List<Integer> productIds, Integer type) {
LambdaQueryWrapper<StoreProductAttrValue> lqw = Wrappers.lambdaQuery();
lqw.in(StoreProductAttrValue::getProductId, productIds);
lqw.eq(StoreProductAttrValue::getType, type);
lqw.eq(StoreProductAttrValue::getIsDel, false);
List<StoreProductAttrValue> list = dao.selectList(lqw);
return list.stream().collect(Collectors.groupingBy(StoreProductAttrValue::getProductId));
}
} }

View File

@ -27,6 +27,10 @@ import com.zbkj.common.vo.MyRecord;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; 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.dao.StoreProductDao;
import com.zbkj.service.delete.ProductUtils; import com.zbkj.service.delete.ProductUtils;
import com.zbkj.service.service.*; import com.zbkj.service.service.*;
@ -108,6 +112,56 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
private static final Logger logger = LoggerFactory.getLogger(StoreProductServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(StoreProductServiceImpl.class);
@Override
public Map<Integer, ProductDetailVo> getSkuDetails(List<Integer> productIds) {
Map<Integer, ProductDetailVo> result = new HashMap<>();
Map<Integer, StoreProduct> productMap = getH5Detail(productIds);
Map<Integer, List<StoreProductAttr>> attrMap = attrService.getListByProductIdAndType(productIds, Constants.PRODUCT_TYPE_NORMAL);
Map<Integer, List<StoreProductAttrValue>> attrValueMap = storeProductAttrValueService.getListByProductIdAndType(productIds, Constants.PRODUCT_TYPE_NORMAL);
for (Integer productId : productIds) {
ProductDetailVo detailVo = new ProductDetailVo();
List<StoreProductAttrValue> 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<String, Object> 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<StoreProductAttr> attrList = attrService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
// 根据制式设置attr属性
detailVo.setProductAttr(JSON.parseArray(JSON.toJSONString(attrList), ProductAttrVo.class));
// 根据制式设置sku属性
HashMap<String, Object> skuMap = CollUtil.newHashMap();
List<StoreProductAttrValue> 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 * 获取产品列表Admin
* @param request 筛选参数 * @param request 筛选参数
@ -1203,6 +1257,19 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
return dao.selectList(lqw); return dao.selectList(lqw);
} }
private Map<Integer, StoreProduct> getH5Detail(List<Integer> productIds) {
LambdaQueryWrapper<StoreProduct> 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<StoreProduct> list = dao.selectList(lqw);
return list.stream().collect(Collectors.toMap(StoreProduct::getId, value -> value));
}
/** /**
* 获取移动端商品详情 * 获取移动端商品详情
* @param id 商品id * @param id 商品id
@ -1213,7 +1280,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
LambdaQueryWrapper<StoreProduct> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<StoreProduct> lqw = Wrappers.lambdaQuery();
lqw.select(StoreProduct::getId, StoreProduct::getImage, StoreProduct::getStoreName, StoreProduct::getSliderImage, lqw.select(StoreProduct::getId, StoreProduct::getImage, StoreProduct::getStoreName, StoreProduct::getSliderImage,
StoreProduct::getOtPrice, StoreProduct::getStock, StoreProduct::getSales, StoreProduct::getPrice, StoreProduct::getActivity, 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::getId, id);
lqw.eq(StoreProduct::getIsRecycle, false); lqw.eq(StoreProduct::getIsRecycle, false);
lqw.eq(StoreProduct::getIsDel, false); lqw.eq(StoreProduct::getIsDel, false);

View File

@ -2,6 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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"> <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 id="selectPageSetMealType" resultType="com.zbkj.common.response.SetMealResponse">
select t.id cid, t.name from ( select t.id cid, t.name from (
select c.id, c.name, c.sort from eb_home h select c.id, c.name, c.sort from eb_home h
@ -12,10 +18,10 @@
) t order by t.sort ) t order by t.sort
</select> </select>
<select id="selectPageSetMealFloor" resultType="com.zbkj.common.response.SetMealFloorResponse"> <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 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 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
</select> </select>
</mapper> </mapper>

View File

@ -2,8 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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"> <mapper namespace="com.zbkj.service.dao.HomeProductsDao">
<select id="selectPageFloorProduct" resultType="com.zbkj.common.response.SetMealFloorProResponse"> <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 = #{entity.homeId} and del_flag = 1 order by order_no 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> </select>
</mapper> </mapper>