楼层
This commit is contained in:
parent
964cd199ff
commit
3f6faedb48
@ -7,6 +7,7 @@ import com.zbkj.common.request.PageParamRequest;
|
|||||||
import com.zbkj.common.response.CommonResult;
|
import com.zbkj.common.response.CommonResult;
|
||||||
import com.zbkj.common.vo.HomeVo;
|
import com.zbkj.common.vo.HomeVo;
|
||||||
import com.zbkj.service.service.EbHomeService;
|
import com.zbkj.service.service.EbHomeService;
|
||||||
|
import com.zbkj.service.service.SystemAttachmentService;
|
||||||
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;
|
||||||
@ -16,6 +17,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("api/admin/floor/")
|
@RequestMapping("api/admin/floor/")
|
||||||
@ -24,43 +29,48 @@ public class HomeController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EbHomeService homeService;
|
private EbHomeService homeService;
|
||||||
|
@Autowired
|
||||||
|
private SystemAttachmentService systemAttachmentService;
|
||||||
|
|
||||||
// @PreAuthorize("hasAuthority('admin:home:list')")
|
@PreAuthorize("hasAuthority('admin:home:list')")
|
||||||
@ApiOperation(value = "分页列表")
|
@ApiOperation(value = "分页列表")
|
||||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||||
public CommonResult<CommonPage<HomeVo>> getList(@Validated HomeRequest request, @Validated PageParamRequest pageParamRequest) {
|
public CommonResult<CommonPage<HomeVo>> getList(@Validated HomeRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||||
return CommonResult.success(CommonPage.restPage(homeService.getAdminList(request, pageParamRequest)));
|
return CommonResult.success(CommonPage.restPage(homeService.getAdminList(request, pageParamRequest)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @PreAuthorize("hasAuthority('admin:home:save')")
|
@PreAuthorize("hasAuthority('admin:home:save')")
|
||||||
@ApiOperation(value = "新增")
|
@ApiOperation(value = "新增")
|
||||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||||
public CommonResult<String> save(@RequestBody @Validated HomeRequest request) {
|
public CommonResult<String> save(@RequestBody @Validated HomeRequest request) {
|
||||||
if (homeService.create(request)) {
|
Home home = new Home();
|
||||||
|
BeanUtils.copyProperties(request, home);
|
||||||
|
home.setImgUrl(systemAttachmentService.clearPrefix(home.getImgUrl()));
|
||||||
|
if (homeService.save(home)) {
|
||||||
return CommonResult.success();
|
return CommonResult.success();
|
||||||
} else {
|
} else {
|
||||||
return CommonResult.failed();
|
return CommonResult.failed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @PreAuthorize("hasAuthority('admin:home:delete')")
|
@PreAuthorize("hasAuthority('admin:home:delete')")
|
||||||
@ApiOperation(value = "删除")
|
@ApiOperation(value = "删除")
|
||||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id) {
|
public CommonResult<String> delete(@RequestParam(value = "ids") String ids) {
|
||||||
if (homeService.deleteById(id)) {
|
List<Integer> idList = Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||||
return CommonResult.success();
|
for (Integer id : idList) {
|
||||||
} else {
|
homeService.deleteById(id);
|
||||||
return CommonResult.failed();
|
|
||||||
}
|
}
|
||||||
|
return CommonResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @PreAuthorize("hasAuthority('admin:home:update')")
|
@PreAuthorize("hasAuthority('admin:home:update')")
|
||||||
@ApiOperation(value = "修改")
|
@ApiOperation(value = "修改")
|
||||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated HomeRequest request) {
|
public CommonResult<String> update(@RequestBody HomeRequest request) {
|
||||||
Home upd = new Home();
|
Home upd = new Home();
|
||||||
BeanUtils.copyProperties(request, upd);
|
BeanUtils.copyProperties(request, upd);
|
||||||
upd.setId(id);
|
upd.setImgUrl(systemAttachmentService.clearPrefix(upd.getImgUrl()));
|
||||||
if (homeService.updateById(upd)) {
|
if (homeService.updateById(upd)) {
|
||||||
return CommonResult.success();
|
return CommonResult.success();
|
||||||
} else {
|
} else {
|
||||||
@ -70,8 +80,8 @@ public class HomeController {
|
|||||||
|
|
||||||
@PreAuthorize("hasAuthority('admin:home:info')")
|
@PreAuthorize("hasAuthority('admin:home:info')")
|
||||||
@ApiOperation(value = "详情")
|
@ApiOperation(value = "详情")
|
||||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||||
public CommonResult<HomeVo> info(@RequestParam(value = "id") Integer id) {
|
public CommonResult<HomeVo> info(@PathVariable Integer id) {
|
||||||
Home home = homeService.getById(id);
|
Home home = homeService.getById(id);
|
||||||
HomeVo homeVo = new HomeVo();
|
HomeVo homeVo = new HomeVo();
|
||||||
BeanUtils.copyProperties(home, homeVo);
|
BeanUtils.copyProperties(home, homeVo);
|
||||||
|
@ -7,6 +7,8 @@ import com.zbkj.common.request.PageParamRequest;
|
|||||||
import com.zbkj.common.response.CommonResult;
|
import com.zbkj.common.response.CommonResult;
|
||||||
import com.zbkj.common.vo.HomeItemVo;
|
import com.zbkj.common.vo.HomeItemVo;
|
||||||
import com.zbkj.service.service.EbHomeItemService;
|
import com.zbkj.service.service.EbHomeItemService;
|
||||||
|
import com.zbkj.service.service.StoreProductService;
|
||||||
|
import com.zbkj.service.service.SystemAttachmentService;
|
||||||
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;
|
||||||
@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -28,30 +31,36 @@ public class HomeItemController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EbHomeItemService homeItemService;
|
private EbHomeItemService homeItemService;
|
||||||
|
@Autowired
|
||||||
|
private SystemAttachmentService systemAttachmentService;
|
||||||
|
@Autowired
|
||||||
|
private StoreProductService storeProductService;
|
||||||
|
|
||||||
// @PreAuthorize("hasAuthority('admin:home:list')")
|
@PreAuthorize("hasAuthority('admin:homeItem:list')")
|
||||||
@ApiOperation(value = "分页列表")
|
@ApiOperation(value = "分页列表")
|
||||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||||
public CommonResult<CommonPage<HomeItemVo>> getList(@Validated HomeItemRequest request, @Validated PageParamRequest pageParamRequest) {
|
public CommonResult<CommonPage<HomeItemVo>> getList(@Validated HomeItemRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||||
return CommonResult.success(CommonPage.restPage(homeItemService.getAdminList(request, pageParamRequest)));
|
return CommonResult.success(CommonPage.restPage(homeItemService.getAdminList(request, pageParamRequest)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @PreAuthorize("hasAuthority('admin:home:save')")
|
@PreAuthorize("hasAuthority('admin:homeItem:save')")
|
||||||
@ApiOperation(value = "新增")
|
@ApiOperation(value = "新增")
|
||||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||||
public CommonResult<String> save(@RequestBody @Validated HomeItemRequest request) {
|
public CommonResult<String> save(@RequestBody @Validated List<HomeItemRequest> itemList) {
|
||||||
HomeItem add = new HomeItem();
|
for (HomeItemRequest req : itemList) {
|
||||||
BeanUtils.copyProperties(request, add);
|
HomeItem add = new HomeItem();
|
||||||
if (homeItemService.save(add)) {
|
BeanUtils.copyProperties(req, add);
|
||||||
return CommonResult.success();
|
add.setId(null);
|
||||||
} else {
|
add.setType(add.getJumpType() == 1 || add.getJumpType() == 3 ? 0 : 1);
|
||||||
return CommonResult.failed();
|
add.setImgUrl(systemAttachmentService.clearPrefix(add.getImgUrl()));
|
||||||
|
homeItemService.save(add);
|
||||||
}
|
}
|
||||||
|
return CommonResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @PreAuthorize("hasAuthority('admin:home:delete')")
|
@PreAuthorize("hasAuthority('admin:homeItem:delete')")
|
||||||
@ApiOperation(value = "删除")
|
@ApiOperation(value = "删除")
|
||||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||||
public CommonResult<String> delete(@RequestParam(value = "ids") String ids) {
|
public CommonResult<String> delete(@RequestParam(value = "ids") String ids) {
|
||||||
List<Integer> idList = Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
List<Integer> idList = Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||||
if (homeItemService.removeByIds(idList)) {
|
if (homeItemService.removeByIds(idList)) {
|
||||||
@ -61,13 +70,13 @@ public class HomeItemController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @PreAuthorize("hasAuthority('admin:home:update')")
|
@PreAuthorize("hasAuthority('admin:homeItem:update')")
|
||||||
@ApiOperation(value = "修改")
|
@ApiOperation(value = "修改")
|
||||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated HomeItemRequest request) {
|
public CommonResult<String> update(@RequestBody HomeItemRequest request) {
|
||||||
HomeItem upd = new HomeItem();
|
HomeItem upd = new HomeItem();
|
||||||
BeanUtils.copyProperties(request, upd);
|
BeanUtils.copyProperties(request, upd);
|
||||||
upd.setId(id);
|
upd.setImgUrl(systemAttachmentService.clearPrefix(upd.getImgUrl()));
|
||||||
if (homeItemService.updateById(upd)) {
|
if (homeItemService.updateById(upd)) {
|
||||||
return CommonResult.success();
|
return CommonResult.success();
|
||||||
} else {
|
} else {
|
||||||
@ -75,13 +84,18 @@ public class HomeItemController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('admin:home:info')")
|
@PreAuthorize("hasAuthority('admin:homeItem:info')")
|
||||||
@ApiOperation(value = "详情")
|
@ApiOperation(value = "详情")
|
||||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||||
public CommonResult<HomeItemVo> info(@RequestParam(value = "id") Integer id) {
|
public CommonResult<HomeItemVo> info(@PathVariable Integer id) {
|
||||||
HomeItem homeItem = homeItemService.getById(id);
|
HomeItem homeItem = homeItemService.getById(id);
|
||||||
HomeItemVo homeItemVo = new HomeItemVo();
|
HomeItemVo homeItemVo = new HomeItemVo();
|
||||||
BeanUtils.copyProperties(homeItem, homeItemVo);
|
BeanUtils.copyProperties(homeItem, homeItemVo);
|
||||||
|
if (homeItemVo.getJumpType() == 1 || homeItemVo.getJumpType() == 3) {
|
||||||
|
String[] split = homeItemVo.getJumpIds().split(",");
|
||||||
|
List<Integer> pIds = Arrays.asList(split).stream().map(i -> Integer.parseInt(i)).collect(Collectors.toList());
|
||||||
|
homeItemVo.setJumpIdsText(storeProductService.getName(pIds).values().stream().collect(Collectors.joining(",")));
|
||||||
|
}
|
||||||
return CommonResult.success(homeItemVo);
|
return CommonResult.success(homeItemVo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class SystemHelpController {
|
|||||||
public CommonResult<String> update(@RequestBody SystemHelpRequest request) {
|
public CommonResult<String> update(@RequestBody SystemHelpRequest request) {
|
||||||
SystemHelpProblem entity = new SystemHelpProblem();
|
SystemHelpProblem entity = new SystemHelpProblem();
|
||||||
BeanUtils.copyProperties(request, entity);
|
BeanUtils.copyProperties(request, entity);
|
||||||
if (helpService.save(entity)) {
|
if (helpService.updateById(entity)) {
|
||||||
return CommonResult.success();
|
return CommonResult.success();
|
||||||
} else {
|
} else {
|
||||||
return CommonResult.failed();
|
return CommonResult.failed();
|
||||||
|
@ -66,6 +66,9 @@ public class StoreCart implements Serializable {
|
|||||||
@ApiModelProperty(value = "已添加的商品是否有效状态")
|
@ApiModelProperty(value = "已添加的商品是否有效状态")
|
||||||
private Boolean status;
|
private Boolean status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否选择 0未选,1已选")
|
||||||
|
private Integer isSelect;
|
||||||
|
|
||||||
@ApiModelProperty(value = "团长拼团id")
|
@ApiModelProperty(value = "团长拼团id")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer pinkId;
|
private Integer pinkId;
|
||||||
|
@ -42,6 +42,10 @@ public class HomeItem implements Serializable {
|
|||||||
* 跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目
|
* 跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目
|
||||||
*/
|
*/
|
||||||
private Integer jumpType;
|
private Integer jumpType;
|
||||||
|
/**
|
||||||
|
* 类型 0商品,1轮播图
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
/**
|
/**
|
||||||
* 排序
|
* 排序
|
||||||
*/
|
*/
|
||||||
|
@ -25,13 +25,18 @@ public class StoreProductProblem implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 业务外键id
|
* 业务外键id
|
||||||
*/
|
*/
|
||||||
private Integer businessId;
|
private String businessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户id
|
* 用户id
|
||||||
*/
|
*/
|
||||||
private Integer uid;
|
private Integer uid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内容
|
* 内容
|
||||||
*/
|
*/
|
||||||
|
@ -23,7 +23,7 @@ public class BatchCartRequest {
|
|||||||
@ApiModelProperty(value = "购物车商品信息(cartType=default,必传)")
|
@ApiModelProperty(value = "购物车商品信息(cartType=default,必传)")
|
||||||
private List<CartRequest> cartList;
|
private List<CartRequest> cartList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "业务编号")
|
@ApiModelProperty(value = "业务编号(cartType=setmeal,传 楼层id)")
|
||||||
private String business;
|
private String business;
|
||||||
|
|
||||||
@ApiModelProperty(value = "业务类型(default 默认; setmeal 套餐)", required = true)
|
@ApiModelProperty(value = "业务类型(default 默认; setmeal 套餐)", required = true)
|
||||||
|
@ -24,6 +24,9 @@ public class HomeRequest implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "名称")
|
@ApiModelProperty(value = "名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.zbkj.common.request;
|
||||||
|
|
||||||
|
import com.zbkj.common.annotation.StringContains;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value="OptForCartRequest对象", description="OptForCartRequest对象")
|
||||||
|
public class OptForCartRequest {
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "购物车id(多个用,拼接,若不传则为购物车所有商品)")
|
||||||
|
private String cartIds;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "业务类型(yes 勾选;no 移除)", required = true)
|
||||||
|
@StringContains(limitValues = {"yes", "no"}, message = "未知的类型")
|
||||||
|
private String cartType;
|
||||||
|
|
||||||
|
}
|
@ -31,19 +31,19 @@ public class PreOrderDetailRequest {
|
|||||||
@ApiModelProperty(value = "订单编号(再次购买必填)")
|
@ApiModelProperty(value = "订单编号(再次购买必填)")
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
|
||||||
@ApiModelProperty(value = "砍价商品id")
|
@ApiModelProperty(value = "暂时作废:砍价商品id")
|
||||||
private Integer bargainId = 0;
|
private Integer bargainId = 0;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户砍价活动id")
|
@ApiModelProperty(value = "暂时作废:用户砍价活动id")
|
||||||
private Integer bargainUserId = 0;
|
private Integer bargainUserId = 0;
|
||||||
|
|
||||||
@ApiModelProperty(value = "拼团商品id")
|
@ApiModelProperty(value = "暂时作废:拼团商品id")
|
||||||
private Integer combinationId = 0;
|
private Integer combinationId = 0;
|
||||||
|
|
||||||
@ApiModelProperty(value = "拼团团长id")
|
@ApiModelProperty(value = "暂时作废:拼团团长id")
|
||||||
private Integer pinkId = 0;
|
private Integer pinkId = 0;
|
||||||
|
|
||||||
@ApiModelProperty(value = "秒杀商品id")
|
@ApiModelProperty(value = "暂时作废:秒杀商品id")
|
||||||
private Integer seckillId = 0;
|
private Integer seckillId = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,9 @@ public class StoreProductSearchRequest implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "类型(1:出售中(已上架),2:仓库中(未上架),3:已售罄,4:警戒库存,5:回收站)")
|
@ApiModelProperty(value = "类型(0全部,1:出售中(已上架),2:仓库中(未上架),3:已售罄,4:警戒库存,5:回收站)")
|
||||||
@NotNull(message = "商品类型不能为空")
|
@NotNull(message = "商品类型不能为空")
|
||||||
@Range(min = 1, max = 5, message = "未知的商品类型")
|
@Range(min = 0, max = 5, message = "未知的商品类型")
|
||||||
private int type;
|
private int type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "分类ID, 多个逗号分隔")
|
@ApiModelProperty(value = "分类ID, 多个逗号分隔")
|
||||||
|
@ -29,6 +29,6 @@ public class SystemHelpRequest implements Serializable {
|
|||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@ApiModelProperty(value = "状态 0无效,1有效")
|
@ApiModelProperty(value = "状态 0无效,1有效")
|
||||||
private Integer status;
|
private Boolean status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,9 @@ public class CartInfoResponse implements Serializable {
|
|||||||
@ApiModelProperty(value = "商品规格id")
|
@ApiModelProperty(value = "商品规格id")
|
||||||
private Integer attrId;
|
private Integer attrId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否选择 0未选,1已选")
|
||||||
|
private Integer isSelect = 1;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品属性索引值 (attr_value|attr_value[|....])")
|
@ApiModelProperty(value = "商品属性索引值 (attr_value|attr_value[|....])")
|
||||||
private String suk;
|
private String suk;
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@ -17,6 +18,9 @@ public class HomeItemVo implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "名称")
|
@ApiModelProperty(value = "名称")
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
/**
|
||||||
@ -24,6 +28,9 @@ public class HomeItemVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "标题")
|
@ApiModelProperty(value = "标题")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "楼层id")
|
||||||
|
private Integer homeId;
|
||||||
/**
|
/**
|
||||||
* 图片
|
* 图片
|
||||||
*/
|
*/
|
||||||
@ -32,13 +39,16 @@ public class HomeItemVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 跳转路径
|
* 跳转路径
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "跳转路径")
|
// @ApiModelProperty(value = "跳转路径")
|
||||||
private String jumpUrl;
|
// private String jumpUrl;
|
||||||
/**
|
/**
|
||||||
* 跳转参数(pId,cIds,pIds,hId)
|
* 跳转参数(pId,cIds,pIds,hId)
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "跳转参数(pId,cIds,pIds,hId)")
|
@ApiModelProperty(value = "跳转参数(pId,cIds,pIds,hId)")
|
||||||
private String jumpIds;
|
private String jumpIds;
|
||||||
|
private String jumpIdsText;
|
||||||
|
|
||||||
|
private Map<Integer, String> jumpIdsMap;
|
||||||
/**
|
/**
|
||||||
* 跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目
|
* 跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目
|
||||||
*/
|
*/
|
||||||
@ -48,6 +58,12 @@ public class HomeItemVo implements Serializable {
|
|||||||
@ApiModelProperty(value = "类型 0商品,1轮播图")
|
@ApiModelProperty(value = "类型 0商品,1轮播图")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否有效 1:有效,0:无效")
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序")
|
||||||
|
private Integer orderNo;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品信息")
|
@ApiModelProperty(value = "商品信息")
|
||||||
private ProductInfoVo productInfo;
|
private ProductInfoVo productInfo;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import lombok.experimental.Accessors;
|
|||||||
import org.springframework.data.annotation.Transient;
|
import org.springframework.data.annotation.Transient;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@ -32,8 +33,8 @@ public class HomeVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 跳转路径
|
* 跳转路径
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "跳转路径")
|
// @ApiModelProperty(value = "跳转路径")
|
||||||
private String jumpUrl;
|
// private String jumpUrl;
|
||||||
/**
|
/**
|
||||||
* 图片
|
* 图片
|
||||||
*/
|
*/
|
||||||
@ -44,15 +45,26 @@ public class HomeVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "跳转参数(pId,cIds,pIds,hId)")
|
@ApiModelProperty(value = "跳转参数(pId,cIds,pIds,hId)")
|
||||||
private String jumpIds;
|
private String jumpIds;
|
||||||
|
|
||||||
|
private Map<Integer, String> jumpIdsMap;
|
||||||
/**
|
/**
|
||||||
* 跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目
|
* 跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目")
|
@ApiModelProperty(value = "跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目")
|
||||||
private Integer jumpType;
|
private Integer jumpType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否有效 1:有效,0:无效")
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
@ApiModelProperty(value = "展示渠道:【1首页楼层,2随心配套餐层,3首页精品推荐】")
|
@ApiModelProperty(value = "展示渠道:【1首页楼层,2随心配套餐层,3首页精品推荐】")
|
||||||
private String channel;
|
private String channel;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "业务:channel=2分类id")
|
||||||
|
private Integer business;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序")
|
||||||
|
private Integer orderNo;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<HomeItemVo> items;
|
private List<HomeItemVo> items;
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.zbkj.front.config;
|
package com.zbkj.front.config;
|
||||||
|
|
||||||
|
import com.zbkj.common.config.CrmebConfig;
|
||||||
|
import com.zbkj.common.constants.Constants;
|
||||||
import com.zbkj.common.interceptor.SwaggerInterceptor;
|
import com.zbkj.common.interceptor.SwaggerInterceptor;
|
||||||
import com.zbkj.front.filter.ResponseFilter;
|
import com.zbkj.front.filter.ResponseFilter;
|
||||||
import com.zbkj.front.interceptor.FrontTokenInterceptor;
|
import com.zbkj.front.interceptor.FrontTokenInterceptor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
@ -38,6 +41,8 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
private String password;
|
private String password;
|
||||||
@Value("${swagger.basic.check}")
|
@Value("${swagger.basic.check}")
|
||||||
private Boolean check;
|
private Boolean check;
|
||||||
|
@Autowired
|
||||||
|
CrmebConfig crmebConfig;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -97,6 +102,10 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
.addResourceLocations("classpath:/META-INF/resources/");
|
.addResourceLocations("classpath:/META-INF/resources/");
|
||||||
registry.addResourceHandler("/webjars/**")
|
registry.addResourceHandler("/webjars/**")
|
||||||
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||||
|
|
||||||
|
/** 本地文件上传路径 */
|
||||||
|
registry.addResourceHandler(Constants.UPLOAD_TYPE_IMAGE + "/**").addResourceLocations("file:" + crmebConfig.getImagePath() + "/" + Constants.UPLOAD_TYPE_IMAGE + "/");
|
||||||
|
registry.addResourceHandler(Constants.UPLOAD_TYPE_FILE + "/**").addResourceLocations("file:" + crmebConfig.getImagePath() + "/" + Constants.UPLOAD_TYPE_FILE + "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ -104,7 +113,10 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
{
|
{
|
||||||
//注册过滤器
|
//注册过滤器
|
||||||
FilterRegistrationBean registration = new FilterRegistrationBean(responseFilter());
|
FilterRegistrationBean registration = new FilterRegistrationBean(responseFilter());
|
||||||
registration.addUrlPatterns("/*");
|
// registration.addUrlPatterns("/*");
|
||||||
|
// 仅仅api前缀的请求才会拦截
|
||||||
|
registration.addUrlPatterns("/api/admin/*");
|
||||||
|
registration.addUrlPatterns("/api/front/*");
|
||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,20 @@ public class CartController {
|
|||||||
return CommonResult.success(restPage);
|
return CommonResult.success(restPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 勾选/移选商品
|
||||||
|
* @param optForCartRequest 新增参数
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "勾选/移选商品")
|
||||||
|
@RequestMapping(value = "/optForCart", method = RequestMethod.POST)
|
||||||
|
public CommonResult<String> optForCart(@RequestBody @Validated OptForCartRequest optForCartRequest) {
|
||||||
|
if (storeCartService.optForCart(optForCartRequest)) {
|
||||||
|
return CommonResult.success();
|
||||||
|
} else {
|
||||||
|
return CommonResult.failed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一键加入
|
* 一键加入
|
||||||
* @param storeCartRequest 新增参数
|
* @param storeCartRequest 新增参数
|
||||||
|
@ -85,16 +85,16 @@ public class WeChatController {
|
|||||||
// return CommonResult.success(wechatNewService.getJsSdkConfig(url));
|
// return CommonResult.success(wechatNewService.getJsSdkConfig(url));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 小程序获取授权logo
|
// * 小程序获取授权logo
|
||||||
*/
|
// */
|
||||||
@ApiOperation(value = "小程序获取授权logo")
|
// @ApiOperation(value = "小程序获取授权logo")
|
||||||
@RequestMapping(value = "/getLogo", method = RequestMethod.GET)
|
// @RequestMapping(value = "/getLogo", method = RequestMethod.GET)
|
||||||
public CommonResult<Map<String, String>> getLogo(){
|
// public CommonResult<Map<String, String>> getLogo(){
|
||||||
Map<String, String> map = new HashMap<>();
|
// Map<String, String> map = new HashMap<>();
|
||||||
map.put("logoUrl", userCenterService.getLogo());
|
// map.put("logoUrl", userCenterService.getLogo());
|
||||||
return CommonResult.success(map);
|
// return CommonResult.success(map);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 订阅消息模板列表
|
// * 订阅消息模板列表
|
||||||
|
@ -24,8 +24,6 @@ public interface EbHomeService extends IService<Home> {
|
|||||||
|
|
||||||
List<HomeVo> getAdminList(HomeRequest request, PageParamRequest pageParamRequest);
|
List<HomeVo> getAdminList(HomeRequest request, PageParamRequest pageParamRequest);
|
||||||
|
|
||||||
boolean create(HomeRequest request);
|
|
||||||
|
|
||||||
boolean deleteById(Integer id);
|
boolean deleteById(Integer id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -99,4 +99,12 @@ public interface StoreCartService extends IService<StoreCart> {
|
|||||||
* @param number 数量
|
* @param number 数量
|
||||||
*/
|
*/
|
||||||
Boolean updateCartNum(Integer id, Integer number);
|
Boolean updateCartNum(Integer id, Integer number);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 勾选/移选商品
|
||||||
|
* @param optForCartRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean optForCart(OptForCartRequest optForCartRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -226,4 +226,13 @@ public interface StoreProductService extends IService<StoreProduct> {
|
|||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<StoreProduct> getLeaderboard();
|
List<StoreProduct> getLeaderboard();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取商品名称
|
||||||
|
*
|
||||||
|
* @param prodIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<Integer, String> getName(List<Integer> prodIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,18 +9,25 @@ import com.zbkj.common.model.home.HomeItem;
|
|||||||
import com.zbkj.common.request.HomeItemRequest;
|
import com.zbkj.common.request.HomeItemRequest;
|
||||||
import com.zbkj.common.request.PageParamRequest;
|
import com.zbkj.common.request.PageParamRequest;
|
||||||
import com.zbkj.common.vo.HomeItemVo;
|
import com.zbkj.common.vo.HomeItemVo;
|
||||||
|
import com.zbkj.common.vo.HomeVo;
|
||||||
import com.zbkj.service.dao.HomeItemDao;
|
import com.zbkj.service.dao.HomeItemDao;
|
||||||
|
import com.zbkj.service.service.CategoryService;
|
||||||
import com.zbkj.service.service.EbHomeItemService;
|
import com.zbkj.service.service.EbHomeItemService;
|
||||||
|
import com.zbkj.service.service.StoreProductService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
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 java.util.List;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class EbHomeItemServiceImpl extends ServiceImpl<HomeItemDao, HomeItem> implements EbHomeItemService {
|
public class EbHomeItemServiceImpl extends ServiceImpl<HomeItemDao, HomeItem> implements EbHomeItemService {
|
||||||
|
|
||||||
@Autowired private HomeItemDao dao;
|
@Autowired private HomeItemDao dao;
|
||||||
|
@Autowired private CategoryService categoryService;
|
||||||
|
@Autowired private StoreProductService productService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HomeItemVo> getAdminList(HomeItemRequest request, PageParamRequest pageParamRequest) {
|
public List<HomeItemVo> getAdminList(HomeItemRequest request, PageParamRequest pageParamRequest) {
|
||||||
@ -31,12 +38,38 @@ public class EbHomeItemServiceImpl extends ServiceImpl<HomeItemDao, HomeItem> im
|
|||||||
.or().like(HomeItem::getName, request.getName())
|
.or().like(HomeItem::getName, request.getName())
|
||||||
.or().like(HomeItem::getTitle, request.getName()));
|
.or().like(HomeItem::getTitle, request.getName()));
|
||||||
}
|
}
|
||||||
if (null != request.getJumpType()) {
|
if (null != request.getHomeId()) {
|
||||||
lambdaQueryWrapper.eq(HomeItem::getJumpType, request.getJumpType());
|
lambdaQueryWrapper.eq(HomeItem::getHomeId, request.getHomeId());
|
||||||
}
|
}
|
||||||
lambdaQueryWrapper.orderByDesc(HomeItem::getOrderNo).orderByDesc(HomeItem::getId);
|
lambdaQueryWrapper.orderByDesc(HomeItem::getOrderNo).orderByDesc(HomeItem::getId);
|
||||||
List<HomeItem> itemList = dao.selectList(lambdaQueryWrapper);
|
List<HomeItem> itemList = dao.selectList(lambdaQueryWrapper);
|
||||||
List<HomeItemVo> itemVoArrayList = JSON.parseArray(JSON.toJSONString(itemList), HomeItemVo.class);
|
if (itemList.isEmpty()) {
|
||||||
return itemVoArrayList;
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
Map<Integer, String> cateMap = new HashMap<>();
|
||||||
|
Map<Integer, String> prodMap = new HashMap<>();
|
||||||
|
List<Integer> cateIds = itemList.stream().filter(i -> i.getJumpType() == 2).map(i -> Integer.parseInt(i.getJumpIds())).collect(Collectors.toList());
|
||||||
|
List<Integer> prodIds = itemList.stream().filter(i -> i.getJumpType() == 1 || i.getJumpType() == 3).map(HomeItem::getJumpIds).flatMap(scores -> Arrays.stream(scores.split(","))).map(Integer::parseInt).collect(Collectors.toList());
|
||||||
|
if (!cateIds.isEmpty()) { cateMap = categoryService.getListInId(cateIds); }
|
||||||
|
if (!prodIds.isEmpty()) { prodMap = productService.getName(prodIds); }
|
||||||
|
Map<Integer, String> finalCateMap = cateMap;
|
||||||
|
Map<Integer, String> finalProdMap = prodMap;
|
||||||
|
return itemList.stream().map(i-> {
|
||||||
|
HomeItemVo vo = new HomeItemVo();
|
||||||
|
BeanUtils.copyProperties(i, vo);
|
||||||
|
Map<Integer, String> jumpIdsMap = new HashMap<>();
|
||||||
|
if (i.getJumpType() == 1 || i.getJumpType() == 3) {
|
||||||
|
String[] pSplit = i.getJumpIds().split(",");
|
||||||
|
for (String pId : pSplit) {
|
||||||
|
Integer productId = Integer.parseInt(pId);
|
||||||
|
jumpIdsMap.put(productId, finalProdMap.get(productId));
|
||||||
|
}
|
||||||
|
} else if (i.getJumpType() == 2) {
|
||||||
|
Integer cateId = Integer.parseInt(i.getJumpIds());
|
||||||
|
jumpIdsMap.put(cateId, finalCateMap.get(cateId));
|
||||||
|
}
|
||||||
|
vo.setJumpIdsMap(jumpIdsMap);
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import com.zbkj.common.vo.HomeVo;
|
|||||||
import com.zbkj.common.vo.product.ProductInfoVo;
|
import com.zbkj.common.vo.product.ProductInfoVo;
|
||||||
import com.zbkj.service.dao.HomeDao;
|
import com.zbkj.service.dao.HomeDao;
|
||||||
import com.zbkj.service.dao.HomeItemDao;
|
import com.zbkj.service.dao.HomeItemDao;
|
||||||
|
import com.zbkj.service.service.CategoryService;
|
||||||
import com.zbkj.service.service.EbHomeItemService;
|
import com.zbkj.service.service.EbHomeItemService;
|
||||||
import com.zbkj.service.service.EbHomeService;
|
import com.zbkj.service.service.EbHomeService;
|
||||||
import com.zbkj.service.service.StoreProductService;
|
import com.zbkj.service.service.StoreProductService;
|
||||||
@ -25,10 +26,7 @@ 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.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +38,7 @@ public class EbHomeServiceImpl extends ServiceImpl<HomeDao, Home> implements EbH
|
|||||||
@Autowired private HomeItemDao homeItemDao;
|
@Autowired private HomeItemDao homeItemDao;
|
||||||
@Autowired private EbHomeItemService homeItemService;
|
@Autowired private EbHomeItemService homeItemService;
|
||||||
@Autowired private StoreProductService productService;
|
@Autowired private StoreProductService productService;
|
||||||
|
@Autowired private CategoryService categoryService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<HomeVo> getIndexHomeList(Integer storeId) {
|
public List<HomeVo> getIndexHomeList(Integer storeId) {
|
||||||
@ -69,7 +68,7 @@ public class EbHomeServiceImpl extends ServiceImpl<HomeDao, Home> implements EbH
|
|||||||
List<HomeVo> list = dao.selectPageFloor(entity);
|
List<HomeVo> list = dao.selectPageFloor(entity);
|
||||||
PageHelper.clearPage();
|
PageHelper.clearPage();
|
||||||
for (HomeVo home : list) {
|
for (HomeVo home : list) {
|
||||||
// 默认展示6个
|
// 默认展示5个
|
||||||
PageParamRequest fpPage = new PageParamRequest();
|
PageParamRequest fpPage = new PageParamRequest();
|
||||||
fpPage.setPage(1);
|
fpPage.setPage(1);
|
||||||
fpPage.setLimit(5);
|
fpPage.setLimit(5);
|
||||||
@ -124,21 +123,34 @@ public class EbHomeServiceImpl extends ServiceImpl<HomeDao, Home> implements EbH
|
|||||||
}
|
}
|
||||||
lambdaQueryWrapper.orderByDesc(Home::getOrderNo).orderByDesc(Home::getId);
|
lambdaQueryWrapper.orderByDesc(Home::getOrderNo).orderByDesc(Home::getId);
|
||||||
List<Home> homeList = dao.selectList(lambdaQueryWrapper);
|
List<Home> homeList = dao.selectList(lambdaQueryWrapper);
|
||||||
List<HomeVo> homeVoArrayList = JSON.parseArray(JSON.toJSONString(homeList), HomeVo.class);
|
if (homeList.isEmpty()) {
|
||||||
return homeVoArrayList;
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
Map<Integer, String> cateMap = new HashMap<>();
|
||||||
@Override
|
Map<Integer, String> prodMap = new HashMap<>();
|
||||||
public boolean create(HomeRequest request) {
|
List<Integer> cateIds = homeList.stream().filter(i -> i.getJumpType() == 2).map(i -> Integer.parseInt(i.getJumpIds())).collect(Collectors.toList());
|
||||||
Home home = new Home();
|
List<Integer> prodIds = homeList.stream().filter(i -> i.getJumpType() == 1 || i.getJumpType() == 3).map(Home::getJumpIds).flatMap(scores -> Arrays.stream(scores.split(","))).map(Integer::parseInt).collect(Collectors.toList());
|
||||||
BeanUtils.copyProperties(request, home);
|
if (!cateIds.isEmpty()) { cateMap = categoryService.getListInId(cateIds); }
|
||||||
dao.insert(home);
|
if (!prodIds.isEmpty()) { prodMap = productService.getName(prodIds); }
|
||||||
|
Map<Integer, String> finalCateMap = cateMap;
|
||||||
List<HomeItemVo> items = request.getItems();
|
Map<Integer, String> finalProdMap = prodMap;
|
||||||
List<HomeItem> homeItems = JSON.parseArray(JSON.toJSONString(items), HomeItem.class);
|
return homeList.stream().map(i-> {
|
||||||
homeItems.forEach(i-> i.setHomeId(home.getId()));
|
HomeVo vo = new HomeVo();
|
||||||
homeItemService.saveBatch(homeItems);
|
BeanUtils.copyProperties(i, vo);
|
||||||
return true;
|
Map<Integer, String> jumpIdsMap = new HashMap<>();
|
||||||
|
if (i.getJumpType() == 1 || i.getJumpType() == 3) {
|
||||||
|
String[] pSplit = i.getJumpIds().split(",");
|
||||||
|
for (String pId : pSplit) {
|
||||||
|
Integer productId = Integer.parseInt(pId);
|
||||||
|
jumpIdsMap.put(productId, finalProdMap.get(productId));
|
||||||
|
}
|
||||||
|
} else if (i.getJumpType() == 2) {
|
||||||
|
Integer cateId = Integer.parseInt(i.getJumpIds());
|
||||||
|
jumpIdsMap.put(cateId, finalCateMap.get(cateId));
|
||||||
|
}
|
||||||
|
vo.setJumpIdsMap(jumpIdsMap);
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zbkj.common.model.bargain.StoreBargainUser;
|
||||||
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.constants.Constants;
|
import com.zbkj.common.constants.Constants;
|
||||||
@ -66,6 +67,29 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 勾选/移选商品
|
||||||
|
* @param optForCartRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean optForCart(OptForCartRequest optForCartRequest) {
|
||||||
|
Integer userId = userService.getUserIdException();
|
||||||
|
String cartType = optForCartRequest.getCartType();
|
||||||
|
String cartIds = optForCartRequest.getCartIds();
|
||||||
|
|
||||||
|
LambdaUpdateWrapper<StoreCart> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.set(StoreCart::getIsSelect, (cartType.equals("yes") ? 1 : 0));
|
||||||
|
updateWrapper.eq(StoreCart::getUid, userId);
|
||||||
|
updateWrapper.eq(StoreCart::getStatus, Constants.STATUS_NORMAL);
|
||||||
|
if (StringUtils.isNotEmpty(cartIds)) {
|
||||||
|
List<Integer> ids = Arrays.asList(cartIds.split(",")).stream().map(i -> Integer.parseInt(i)).collect(Collectors.toList());
|
||||||
|
updateWrapper.in(StoreCart::getId, ids);
|
||||||
|
}
|
||||||
|
update(updateWrapper);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
* @param pageParamRequest 分页类参数
|
* @param pageParamRequest 分页类参数
|
||||||
@ -87,11 +111,11 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
|
|||||||
return CommonPage.copyPageInfo(page, new ArrayList<>());
|
return CommonPage.copyPageInfo(page, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = userService.getInfo();
|
// User user = userService.getInfo();
|
||||||
SystemUserLevel userLevel = null;
|
// SystemUserLevel userLevel = null;
|
||||||
if (ObjectUtil.isNotNull(user) && user.getLevel() > 0) {
|
// if (ObjectUtil.isNotNull(user) && user.getLevel() > 0) {
|
||||||
userLevel = systemUserLevelService.getByLevelId(user.getLevel());
|
// userLevel = systemUserLevelService.getByLevelId(user.getLevel());
|
||||||
}
|
// }
|
||||||
|
|
||||||
List<CartInfoResponse> response = new ArrayList<>();
|
List<CartInfoResponse> response = new ArrayList<>();
|
||||||
for (StoreCart storeCart : storeCarts) {
|
for (StoreCart storeCart : storeCarts) {
|
||||||
@ -127,10 +151,10 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
|
|||||||
cartInfoResponse.setAttrId(attrValue.getId());
|
cartInfoResponse.setAttrId(attrValue.getId());
|
||||||
cartInfoResponse.setAttrStatus(attrValue.getStock() > 0);
|
cartInfoResponse.setAttrStatus(attrValue.getStock() > 0);
|
||||||
cartInfoResponse.setStock(attrValue.getStock());
|
cartInfoResponse.setStock(attrValue.getStock());
|
||||||
if (ObjectUtil.isNotNull(userLevel)) {
|
// if (ObjectUtil.isNotNull(userLevel)) {
|
||||||
BigDecimal vipPrice = attrValue.getPrice().multiply(new BigDecimal(userLevel.getDiscount())).divide(new BigDecimal(100), 2 ,BigDecimal.ROUND_HALF_UP);
|
// BigDecimal vipPrice = attrValue.getPrice().multiply(new BigDecimal(userLevel.getDiscount())).divide(new BigDecimal(100), 2 ,BigDecimal.ROUND_HALF_UP);
|
||||||
cartInfoResponse.setVipPrice(vipPrice);
|
// cartInfoResponse.setVipPrice(vipPrice);
|
||||||
}
|
// }
|
||||||
response.add(cartInfoResponse);
|
response.add(cartInfoResponse);
|
||||||
}
|
}
|
||||||
return CommonPage.copyPageInfo(page, response);
|
return CommonPage.copyPageInfo(page, response);
|
||||||
|
@ -86,7 +86,7 @@ public class StoreProductProblemServiceImpl extends ServiceImpl<StoreProductProb
|
|||||||
throw new CrmebException("请选择您要提问的商品");
|
throw new CrmebException("请选择您要提问的商品");
|
||||||
}
|
}
|
||||||
StoreProductProblem add = new StoreProductProblem();
|
StoreProductProblem add = new StoreProductProblem();
|
||||||
add.setBusinessId(Integer.parseInt(businessId));
|
add.setBusinessId(businessId);
|
||||||
add.setUid(user.getUid());
|
add.setUid(user.getUid());
|
||||||
add.setContent(request.getContent());
|
add.setContent(request.getContent());
|
||||||
add.setParentId(pId);
|
add.setParentId(pId);
|
||||||
|
@ -311,7 +311,8 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
|||||||
|
|
||||||
// 查询一条问题
|
// 查询一条问题
|
||||||
LambdaQueryWrapper<StoreProductProblem> lqwSpp = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<StoreProductProblem> lqwSpp = new LambdaQueryWrapper<>();
|
||||||
lqwSpp.eq(StoreProductProblem::getBusinessId, proId);
|
// lqwSpp.eq(StoreProductProblem::getBusinessId, proId);
|
||||||
|
lqwSpp.apply( "FIND_IN_SET ('" + proId + "', business_id)");
|
||||||
int problemNum = storeProductProblemService.count(lqwSpp);
|
int problemNum = storeProductProblemService.count(lqwSpp);
|
||||||
ProductProblemResponse sppRes = null;
|
ProductProblemResponse sppRes = null;
|
||||||
if (problemNum > 0) {
|
if (problemNum > 0) {
|
||||||
|
@ -39,7 +39,6 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
@ -1311,6 +1310,19 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
|||||||
return dao.selectList(lqw);
|
return dao.selectList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Integer, String> getName(List<Integer> productIds) {
|
||||||
|
Map<Integer, String> nameMap = new HashMap<>();
|
||||||
|
LambdaQueryWrapper<StoreProduct> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.select(StoreProduct::getId, StoreProduct::getStoreName);
|
||||||
|
lqw.in(StoreProduct::getId, productIds);
|
||||||
|
List<StoreProduct> list = dao.selectList(lqw);
|
||||||
|
for (StoreProduct sp : list) {
|
||||||
|
nameMap.put(sp.getId(), sp.getStoreName());
|
||||||
|
}
|
||||||
|
return nameMap;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer, StoreProduct> getH5Detail(List<Integer> productIds) {
|
public Map<Integer, StoreProduct> getH5Detail(List<Integer> productIds) {
|
||||||
LambdaQueryWrapper<StoreProduct> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<StoreProduct> lqw = Wrappers.lambdaQuery();
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
select h.id, h.name, h.title, h.img_url imgUrl, h.jump_type jumpType, h.jump_url jumpUrl, h.jump_ids jumpIds
|
select h.id, h.name, h.title, h.img_url imgUrl, h.jump_type jumpType, h.jump_url jumpUrl, h.jump_ids jumpIds
|
||||||
from eb_home h
|
from eb_home h
|
||||||
where FIND_IN_SET(${entity.channel}, h.channel)
|
where FIND_IN_SET(${entity.channel}, h.channel)
|
||||||
<if test="entity.channel == 2"> and h.business = #{entity.cid} </if>
|
<if test="entity.channel == 2 and entity.cid != null"> and h.business = #{entity.cid} </if>
|
||||||
order by order_no
|
order by order_no
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
(select count(1) from eb_store_product_problem c1 where c1.top_id = c.id and c1.top_id <![CDATA[ <> ]]> 0 and c1.is_del = 0) sonNum
|
(select count(1) from eb_store_product_problem c1 where c1.top_id = c.id and c1.top_id <![CDATA[ <> ]]> 0 and c1.is_del = 0) sonNum
|
||||||
from eb_store_product_problem c
|
from eb_store_product_problem c
|
||||||
LEFT JOIN eb_user u on c.uid = u.uid
|
LEFT JOIN eb_user u on c.uid = u.uid
|
||||||
where business_id = #{id} and parent_id = 0 and c.is_del = 0 ORDER BY c.create_time DESC
|
where FIND_IN_SET(#{id}, business_id) and parent_id = 0 and c.is_del = 0 ORDER BY c.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getSonResponseList" resultType="com.zbkj.common.response.ProductProblemResponse">
|
<select id="getSonResponseList" resultType="com.zbkj.common.response.ProductProblemResponse">
|
||||||
|
Loading…
Reference in New Issue
Block a user