master:APP获取商品详情调优;
parent
99b5466e5f
commit
307155c359
|
|
@ -1,91 +0,0 @@
|
|||
package com.ruoyi.web.controller.xkt;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.xkt.domain.StoreProductService;
|
||||
import com.ruoyi.xkt.service.IStoreProductServiceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档口商品服务Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/prod-services")
|
||||
public class StoreProductServiceController extends XktBaseController {
|
||||
@Autowired
|
||||
private IStoreProductServiceService storeProductServiceService;
|
||||
|
||||
/**
|
||||
* 查询档口商品服务列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:service:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(StoreProductService storeProductService) {
|
||||
startPage();
|
||||
List<StoreProductService> list = storeProductServiceService.selectStoreProductServiceList(storeProductService);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出档口商品服务列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:service:export')")
|
||||
@Log(title = "档口商品服务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, StoreProductService storeProductService) {
|
||||
List<StoreProductService> list = storeProductServiceService.selectStoreProductServiceList(storeProductService);
|
||||
ExcelUtil<StoreProductService> util = new ExcelUtil<StoreProductService>(StoreProductService.class);
|
||||
util.exportExcel(response, list, "档口商品服务数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取档口商品服务详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:service:query')")
|
||||
@GetMapping(value = "/{storeProdSvcId}")
|
||||
public R getInfo(@PathVariable("storeProdSvcId") Long storeProdSvcId) {
|
||||
return success(storeProductServiceService.selectStoreProductServiceByStoreProdSvcId(storeProdSvcId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增档口商品服务
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:service:add')")
|
||||
@Log(title = "档口商品服务", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R add(@RequestBody StoreProductService storeProductService) {
|
||||
return success(storeProductServiceService.insertStoreProductService(storeProductService));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改档口商品服务
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:service:edit')")
|
||||
@Log(title = "档口商品服务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R edit(@RequestBody StoreProductService storeProductService) {
|
||||
return success(storeProductServiceService.updateStoreProductService(storeProductService));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除档口商品服务
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:service:remove')")
|
||||
@Log(title = "档口商品服务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{storeProdSvcIds}")
|
||||
public R remove(@PathVariable Long[] storeProdSvcIds) {
|
||||
return success(storeProductServiceService.deleteStoreProductServiceByStoreProdSvcIds(storeProdSvcIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +37,6 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -52,16 +51,9 @@ import java.util.List;
|
|||
@RequestMapping("/rest/v1/website")
|
||||
public class WebsiteController extends XktBaseController {
|
||||
|
||||
|
||||
// TODO 查询先按照storeWeight倒排,之后再按照各种 权重 进行排序
|
||||
// TODO 查询先按照storeWeight倒排,之后再按照各种 权重 进行排序
|
||||
// TODO 查询先按照storeWeight倒排,之后再按照各种 权重 进行排序
|
||||
// TODO 查询先按照storeWeight倒排,之后再按照各种 权重 进行排序
|
||||
// TODO 查询先按照storeWeight倒排,之后再按照各种 权重 进行排序
|
||||
|
||||
|
||||
final IWebsitePCService websitePCService;
|
||||
final IWebsiteAPPService websiteAPPService;
|
||||
|
||||
@ApiOperation(value = "PC 首页 为你推荐", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/pc/index/recommend")
|
||||
public R<Page<PCIndexRecommendDTO>> pcIndexRecommendPage(@Validated @RequestBody IndexSearchVO searchVO) throws IOException {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class StoreProdAppResVO {
|
|||
@ApiModelProperty(value = "规格")
|
||||
private String specification;
|
||||
@ApiModelProperty(value = "商品标签列表")
|
||||
private List<String> tagList;
|
||||
private List<String> tags;
|
||||
@ApiModelProperty(value = "档口文件列表")
|
||||
private List<StoreProdFileVO> fileList;
|
||||
@ApiModelProperty(value = "档口类目属性")
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://47.100.64.234:3377/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: 123456
|
||||
password: hongtu56@Mysql0212
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
|||
|
|
@ -100,13 +100,13 @@ spring:
|
|||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
host: 47.100.64.234
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
port: 6699
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password:
|
||||
password: hongtu56@Redis0212
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ public class ESProductDTO {
|
|||
private String prodCateName;
|
||||
@ApiModelProperty(value = "销量权重")
|
||||
private String saleWeight;
|
||||
@ApiModelProperty(value = "档口权重")
|
||||
private String storeWeight;
|
||||
@ApiModelProperty(value = "推荐权重")
|
||||
private String recommendWeight;
|
||||
@ApiModelProperty(value = "人气权重")
|
||||
|
|
|
|||
|
|
@ -42,8 +42,10 @@ public class StoreProdAppResDTO {
|
|||
private BigDecimal minPrice;
|
||||
@ApiModelProperty(value = "规格")
|
||||
private String specification;
|
||||
@ApiModelProperty(value = "标签字符串")
|
||||
private String tagStr;
|
||||
@ApiModelProperty(value = "标签列表")
|
||||
private List<String> tagList;
|
||||
private List<String> tags;
|
||||
@ApiModelProperty(value = "档口文件列表")
|
||||
private List<StoreProdFileResDTO> fileList;
|
||||
@ApiModelProperty(value = "档口类目属性")
|
||||
|
|
|
|||
|
|
@ -126,5 +126,14 @@ public interface StoreProductMapper extends BaseMapper<StoreProduct> {
|
|||
* @return StoreProdStatusCateCountResDTO
|
||||
*/
|
||||
List<StoreProdStatusCateCountDTO> getStatusCateNum(StoreProdStatusCateNumDTO cateNumDTO);
|
||||
|
||||
/**
|
||||
* 获取APP 档口商品详情
|
||||
*
|
||||
* @param storeProdId 商品ID
|
||||
* @param userId
|
||||
* @return StoreProdAppResDTO
|
||||
*/
|
||||
StoreProdAppResDTO getAppInfo(@Param("storeProdId") Long storeProdId, @Param("userId") Long userId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package com.ruoyi.xkt.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.xkt.domain.StoreProductService;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.xkt.dto.storeProdSvc.StoreProdSvcDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 档口商品服务Mapper接口
|
||||
|
|
@ -12,55 +12,17 @@ import java.util.List;
|
|||
* @date 2025-03-26
|
||||
*/
|
||||
public interface StoreProductServiceMapper extends BaseMapper<StoreProductService> {
|
||||
/**
|
||||
* 查询档口商品服务
|
||||
*
|
||||
* @param id 档口商品服务主键
|
||||
* @return 档口商品服务
|
||||
*/
|
||||
public StoreProductService selectStoreProductServiceByStoreProdSvcId(Long id);
|
||||
|
||||
/**
|
||||
* 查询档口商品服务列表
|
||||
*
|
||||
* @param storeProductService 档口商品服务
|
||||
* @return 档口商品服务集合
|
||||
*/
|
||||
public List<StoreProductService> selectStoreProductServiceList(StoreProductService storeProductService);
|
||||
|
||||
/**
|
||||
* 新增档口商品服务
|
||||
*
|
||||
* @param storeProductService 档口商品服务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStoreProductService(StoreProductService storeProductService);
|
||||
|
||||
/**
|
||||
* 修改档口商品服务
|
||||
*
|
||||
* @param storeProductService 档口商品服务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateStoreProductService(StoreProductService storeProductService);
|
||||
|
||||
/**
|
||||
* 删除档口商品服务
|
||||
*
|
||||
* @param id 档口商品服务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStoreProductServiceByStoreProdSvcId(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除档口商品服务
|
||||
*
|
||||
* @param storeProdSvcIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStoreProductServiceByStoreProdSvcIds(Long[] storeProdSvcIds);
|
||||
|
||||
void updateDelFlagByStoreProdId(Long storeProdId);
|
||||
|
||||
StoreProductService selectByStoreProdId(Long storeProdId);
|
||||
|
||||
/**
|
||||
* 根据商品ID查询档口商品服务
|
||||
*
|
||||
* @param storeProdId 商品ID
|
||||
* @return 档口商品服务
|
||||
*/
|
||||
StoreProdSvcDTO selectSvc(@Param("storeProdId") Long storeProdId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,61 +0,0 @@
|
|||
package com.ruoyi.xkt.service;
|
||||
|
||||
import com.ruoyi.xkt.domain.StoreProductService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档口商品服务Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
public interface IStoreProductServiceService {
|
||||
/**
|
||||
* 查询档口商品服务
|
||||
*
|
||||
* @param storeProdSvcId 档口商品服务主键
|
||||
* @return 档口商品服务
|
||||
*/
|
||||
public StoreProductService selectStoreProductServiceByStoreProdSvcId(Long storeProdSvcId);
|
||||
|
||||
/**
|
||||
* 查询档口商品服务列表
|
||||
*
|
||||
* @param storeProductService 档口商品服务
|
||||
* @return 档口商品服务集合
|
||||
*/
|
||||
public List<StoreProductService> selectStoreProductServiceList(StoreProductService storeProductService);
|
||||
|
||||
/**
|
||||
* 新增档口商品服务
|
||||
*
|
||||
* @param storeProductService 档口商品服务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStoreProductService(StoreProductService storeProductService);
|
||||
|
||||
/**
|
||||
* 修改档口商品服务
|
||||
*
|
||||
* @param storeProductService 档口商品服务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateStoreProductService(StoreProductService storeProductService);
|
||||
|
||||
/**
|
||||
* 批量删除档口商品服务
|
||||
*
|
||||
* @param storeProdSvcIds 需要删除的档口商品服务主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStoreProductServiceByStoreProdSvcIds(Long[] storeProdSvcIds);
|
||||
|
||||
/**
|
||||
* 删除档口商品服务信息
|
||||
*
|
||||
* @param storeProdSvcId 档口商品服务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStoreProductServiceByStoreProdSvcId(Long storeProdSvcId);
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import cn.hutool.core.collection.ListUtil;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import co.elastic.clients.elasticsearch.core.BulkResponse;
|
||||
import co.elastic.clients.elasticsearch.core.CreateResponse;
|
||||
|
|
@ -542,52 +543,25 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public StoreProdAppResDTO getAppInfo(Long storeProdId) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO APP 商品详情也要加上 主图视频及主图
|
||||
// TODO APP 商品详情也要加上 主图视频及主图
|
||||
// TODO APP 商品详情也要加上 主图视频及主图
|
||||
|
||||
|
||||
|
||||
|
||||
StoreProduct storeProd = Optional.ofNullable(this.storeProdMapper.selectOne(new LambdaQueryWrapper<StoreProduct>()
|
||||
.eq(StoreProduct::getId, storeProdId).eq(StoreProduct::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("档口商品不存在!", HttpStatus.ERROR));
|
||||
StoreProdAppResDTO appResDTO = BeanUtil.toBean(storeProd, StoreProdAppResDTO.class).setStoreProdId(storeProd.getId());
|
||||
// 档口文件(商品主图、主图视频、下载的商品详情)
|
||||
List<StoreProdFileResDTO> fileResList = this.storeProdFileMapper.selectListByStoreProdId(storeProdId);
|
||||
// 档口类目属性
|
||||
StoreProductCategoryAttribute cateAttr = this.storeProdCateAttrMapper.selectByStoreProdId(storeProdId);
|
||||
// 档口当前商品颜色列表
|
||||
List<StoreProdColorDTO> colorList = this.storeProdColorMapper.selectListByStoreProdId(storeProdId);
|
||||
// 档口商品颜色尺码列表
|
||||
List<StoreProdColorSizeDTO> sizeList = this.storeProdColorSizeMapper.selectListByStoreProdId(storeProdId);
|
||||
// 档口颜色价格列表
|
||||
List<StoreProdColorPriceSimpleDTO> priceList = this.storeProdColorPriceMapper.selectListByStoreProdId(storeProdId);
|
||||
// 档口商品详情
|
||||
StoreProductDetail prodDetail = this.storeProdDetailMapper.selectByStoreProdId(storeProdId);
|
||||
// 档口服务承诺
|
||||
StoreProductService storeProductSvc = this.storeProdSvcMapper.selectByStoreProdId(storeProdId);
|
||||
// 是否已收藏
|
||||
UserFavorites favorite = this.userFavMapper.selectOne(new LambdaQueryWrapper<UserFavorites>()
|
||||
.eq(UserFavorites::getDelFlag, Constants.UNDELETED).eq(UserFavorites::getStoreProdId, storeProdId)
|
||||
.eq(UserFavorites::getUserId, SecurityUtils.getUserId()));
|
||||
// 获取商品标签
|
||||
List<DailyProdTag> tagList = this.prodTagMapper.selectList(new LambdaQueryWrapper<DailyProdTag>()
|
||||
.eq(DailyProdTag::getDelFlag, Constants.UNDELETED).eq(DailyProdTag::getStoreProdId, storeProdId)
|
||||
.orderByAsc(DailyProdTag::getType));
|
||||
return appResDTO.setFileList(fileResList).setCateAttr(BeanUtil.toBean(cateAttr, StoreProdCateAttrDTO.class))
|
||||
.setTagList(CollectionUtils.isNotEmpty(tagList) ? tagList.stream().map(DailyProdTag::getTag).distinct().collect(Collectors.toList()) : null)
|
||||
.setCollectProd(ObjectUtils.isNotEmpty(favorite) ? Boolean.TRUE : Boolean.FALSE)
|
||||
.setSpecification(colorList.size() + "色" + sizeList.stream().filter(x -> Objects.equals(x.getStandard(), ProductSizeStatus.STANDARD.getValue())).count() + "码")
|
||||
.setMinPrice(priceList.stream().min(Comparator.comparing(StoreProdColorPriceSimpleDTO::getPrice))
|
||||
.orElseThrow(() -> new ServiceException("获取商品价格失败,请联系客服!", HttpStatus.ERROR)).getPrice())
|
||||
.setDetail(ObjectUtils.isEmpty(prodDetail) ? null : prodDetail.getDetail())
|
||||
.setSvc(BeanUtil.toBean(storeProductSvc, StoreProdSvcDTO.class));
|
||||
// 档口商品的基础信息
|
||||
StoreProdAppResDTO appResDTO = this.storeProdMapper.getAppInfo(storeProdId, SecurityUtils.getUserId());
|
||||
StoreProductCategoryAttribute cateAttr = this.storeProdCateAttrMapper.selectOne(new LambdaQueryWrapper<StoreProductCategoryAttribute>()
|
||||
.eq(StoreProductCategoryAttribute::getStoreProdId, storeProdId).eq(StoreProductCategoryAttribute::getDelFlag, Constants.UNDELETED));
|
||||
List<StoreProductColor> colorList = this.storeProdColorMapper.selectList(new LambdaQueryWrapper<StoreProductColor>()
|
||||
.eq(StoreProductColor::getStoreProdId, storeProdId).eq(StoreProductColor::getDelFlag, Constants.UNDELETED));
|
||||
List<StoreProductColorSize> colorSizeList = this.storeProdColorSizeMapper.selectList(new LambdaQueryWrapper<StoreProductColorSize>()
|
||||
.eq(StoreProductColorSize::getStoreProdId, storeProdId).eq(StoreProductColorSize::getDelFlag, Constants.UNDELETED)
|
||||
.eq(StoreProductColorSize::getStandard, ProductSizeStatus.STANDARD.getValue()));
|
||||
return appResDTO.setTags(StringUtils.isNotBlank(appResDTO.getTagStr()) ? StrUtil.split(appResDTO.getTagStr(), ",") : null)
|
||||
// 拼接几色几码
|
||||
.setSpecification((CollectionUtils.isNotEmpty(colorList) ? colorList.size() + "色" : "") +
|
||||
(CollectionUtils.isNotEmpty(colorSizeList) ? colorSizeList.size() + "码" : ""))
|
||||
// 获取商品的属性
|
||||
.setCateAttr(BeanUtil.toBean(cateAttr, StoreProdCateAttrDTO.class))
|
||||
// 获取商品的主图视频及主图
|
||||
.setFileList(this.storeProdFileMapper.selectVideoAndMainPicList(storeProdId))
|
||||
// 获取商品的服务承诺
|
||||
.setSvc(this.storeProdSvcMapper.selectSvc(storeProdId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,95 +0,0 @@
|
|||
package com.ruoyi.xkt.service.impl;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.xkt.domain.StoreProductService;
|
||||
import com.ruoyi.xkt.mapper.StoreProductServiceMapper;
|
||||
import com.ruoyi.xkt.service.IStoreProductServiceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档口商品服务Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Service
|
||||
public class StoreProductServiceServiceImpl implements IStoreProductServiceService {
|
||||
@Autowired
|
||||
private StoreProductServiceMapper storeProductServiceMapper;
|
||||
|
||||
/**
|
||||
* 查询档口商品服务
|
||||
*
|
||||
* @param storeProdSvcId 档口商品服务主键
|
||||
* @return 档口商品服务
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public StoreProductService selectStoreProductServiceByStoreProdSvcId(Long storeProdSvcId) {
|
||||
return storeProductServiceMapper.selectStoreProductServiceByStoreProdSvcId(storeProdSvcId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询档口商品服务列表
|
||||
*
|
||||
* @param storeProductService 档口商品服务
|
||||
* @return 档口商品服务
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<StoreProductService> selectStoreProductServiceList(StoreProductService storeProductService) {
|
||||
return storeProductServiceMapper.selectStoreProductServiceList(storeProductService);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增档口商品服务
|
||||
*
|
||||
* @param storeProductService 档口商品服务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertStoreProductService(StoreProductService storeProductService) {
|
||||
storeProductService.setCreateTime(DateUtils.getNowDate());
|
||||
return storeProductServiceMapper.insertStoreProductService(storeProductService);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改档口商品服务
|
||||
*
|
||||
* @param storeProductService 档口商品服务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateStoreProductService(StoreProductService storeProductService) {
|
||||
storeProductService.setUpdateTime(DateUtils.getNowDate());
|
||||
return storeProductServiceMapper.updateStoreProductService(storeProductService);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除档口商品服务
|
||||
*
|
||||
* @param storeProdSvcIds 需要删除的档口商品服务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteStoreProductServiceByStoreProdSvcIds(Long[] storeProdSvcIds) {
|
||||
return storeProductServiceMapper.deleteStoreProductServiceByStoreProdSvcIds(storeProdSvcIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除档口商品服务信息
|
||||
*
|
||||
* @param storeProdSvcId 档口商品服务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteStoreProductServiceByStoreProdSvcId(Long storeProdSvcId) {
|
||||
return storeProductServiceMapper.deleteStoreProductServiceByStoreProdSvcId(storeProdSvcId);
|
||||
}
|
||||
}
|
||||
|
|
@ -357,11 +357,18 @@ public class StoreServiceImpl implements IStoreService {
|
|||
@Transactional (readOnly = true)
|
||||
public StoreSimpleResDTO getSimpleInfo(Long storeId) {
|
||||
StoreSimpleResDTO simpleDTO = this.storeMapper.getSimpleInfo(storeId);
|
||||
final Long userId = SecurityUtils.getUserId();
|
||||
|
||||
return simpleDTO;
|
||||
|
||||
// TODO 获取用户是否关注档口
|
||||
// TODO 获取用户是否关注档口
|
||||
// TODO 获取用户是否关注档口
|
||||
|
||||
/*final Long userId = SecurityUtils.getUserId();
|
||||
UserSubscriptions userSub = ObjectUtils.isEmpty(userId) ? null
|
||||
: this.userSubMapper.selectOne(new LambdaQueryWrapper<UserSubscriptions>().eq(UserSubscriptions::getUserId, userId)
|
||||
.eq(UserSubscriptions::getStoreId, storeId).eq(UserSubscriptions::getDelFlag, Constants.UNDELETED));
|
||||
return simpleDTO.setFocus(ObjectUtils.isNotEmpty(userSub) ? Boolean.TRUE : Boolean.FALSE);
|
||||
return simpleDTO.setFocus(ObjectUtils.isNotEmpty(userSub) ? Boolean.TRUE : Boolean.FALSE);*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
|
@ -735,10 +734,14 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
|
|||
// 构建最终的查询
|
||||
Query query = new Query.Builder().bool(boolQuery.build()).build();
|
||||
// 执行搜索
|
||||
SearchResponse<ESProductDTO> resList = esClientWrapper.getEsClient().search(s -> s.index(Constants.ES_IDX_PRODUCT_INFO)
|
||||
.query(query).from((searchDTO.getPageNum() - 1) * searchDTO.getPageSize()).size(searchDTO.getPageSize())
|
||||
.sort(sort -> sort.field(f -> f.field(searchDTO.getSort()).order(SortOrder.Desc))),
|
||||
ESProductDTO.class);
|
||||
SearchResponse<ESProductDTO> resList = esClientWrapper.getEsClient()
|
||||
.search(s -> s.index(Constants.ES_IDX_PRODUCT_INFO)
|
||||
.query(query)
|
||||
.from((searchDTO.getPageNum() - 1) * searchDTO.getPageSize())
|
||||
.size(searchDTO.getPageSize())
|
||||
.sort(sort -> sort.field(f -> f.field("storeWeight").order(SortOrder.Desc)))
|
||||
.sort(sort -> sort.field(f -> f.field(searchDTO.getSort()).order(SortOrder.Desc))),
|
||||
ESProductDTO.class);
|
||||
final long total = resList.hits().total().value();
|
||||
final List<ESProductDTO> esProdList = resList.hits().hits().stream().map(x -> x.source().setStoreProdId(x.id())).collect(Collectors.toList());
|
||||
return new Page<>(searchDTO.getPageNum(), searchDTO.getPageSize(), total / searchDTO.getPageSize() + 1, total, esProdList);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||
import co.elastic.clients.elasticsearch._types.SortOrder;
|
||||
import co.elastic.clients.elasticsearch._types.query_dsl.*;
|
||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
|
@ -1672,10 +1673,14 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
|
|||
// 构建最终的查询
|
||||
Query query = new Query.Builder().bool(boolQuery.build()).build();
|
||||
// 执行搜索
|
||||
SearchResponse<ESProductDTO> resList = esClientWrapper.getEsClient().search(s -> s.index(Constants.ES_IDX_PRODUCT_INFO)
|
||||
.query(query).from((searchDTO.getPageNum() - 1) * searchDTO.getPageSize()).size(searchDTO.getPageSize())
|
||||
.sort(sort -> sort.field(f -> f.field(searchDTO.getSort()).order(searchDTO.getOrder()))),
|
||||
ESProductDTO.class);
|
||||
SearchResponse<ESProductDTO> resList = esClientWrapper.getEsClient()
|
||||
.search(s -> s.index(Constants.ES_IDX_PRODUCT_INFO)
|
||||
.query(query)
|
||||
.from((searchDTO.getPageNum() - 1) * searchDTO.getPageSize())
|
||||
.size(searchDTO.getPageSize())
|
||||
.sort(sort -> sort.field(f -> f.field("storeWeight").order(SortOrder.Desc)))
|
||||
.sort(sort -> sort.field(f -> f.field(searchDTO.getSort()).order(searchDTO.getOrder()))),
|
||||
ESProductDTO.class);
|
||||
final long total = resList.hits().total().value();
|
||||
final List<ESProductDTO> esProdList = resList.hits().hits().stream().map(x -> x.source().setStoreProdId(x.id())).collect(Collectors.toList());
|
||||
return new Page<>(searchDTO.getPageNum(), searchDTO.getPageSize(), total / searchDTO.getPageSize() + 1, total, esProdList);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getSimpleInfo" resultType="com.ruoyi.xkt.dto.store.StoreSimpleResDTO">
|
||||
SELECT
|
||||
SELECT DISTINCT
|
||||
s.id AS store_id,
|
||||
s.store_name,
|
||||
s.template_num,
|
||||
|
|
@ -31,11 +31,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
s.qq_account,
|
||||
s.store_address,
|
||||
sc.legal_name,
|
||||
sc.license_name,
|
||||
EXISTS ( SELECT 1 FROM user_subscriptions us LEFT JOIN store ON s.id = us.store_id AND us.del_flag = 0 AND us.user_id = #{userId}) AS focus
|
||||
sc.license_name
|
||||
FROM
|
||||
store s
|
||||
LEFT JOIN store_homepage sh ON s.id = sh.store_id
|
||||
LEFT JOIN store_certificate sc ON s.id = sc.store_id
|
||||
WHERE
|
||||
s.id = #{storeId}
|
||||
|
|
|
|||
|
|
@ -24,17 +24,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectStatusCount" resultType="com.ruoyi.xkt.dto.storeProduct.StoreProdStatusCountDTO">
|
||||
SELECT
|
||||
SUM( CASE WHEN prod_status = 2 THEN 1 ELSE 0 END ) AS onSaleNum,
|
||||
SUM( CASE WHEN prod_status = 3 THEN 1 ELSE 0 END ) AS tailGoodsNum,
|
||||
SUM( CASE WHEN prod_status = 4 THEN 1 ELSE 0 END ) AS offSaleNum
|
||||
FROM
|
||||
store_product
|
||||
WHERE
|
||||
del_flag = 0 AND store_id = #{storeId}
|
||||
</select>
|
||||
|
||||
<select id="selectESDTOList" resultType="com.ruoyi.xkt.dto.storeProduct.ProductESDTO">
|
||||
SELECT DISTINCT
|
||||
sp.id,
|
||||
|
|
@ -259,6 +248,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getStatusCateNum" resultType="com.ruoyi.xkt.dto.storeProduct.StoreProdStatusCateCountDTO">
|
||||
SELECT
|
||||
sp.prod_status,
|
||||
sp.prod_cate_id,
|
||||
spc.`name` AS prodCateName,
|
||||
COUNT( sp.id ) AS cateCount
|
||||
FROM
|
||||
store_product sp
|
||||
LEFT JOIN sys_product_category spc ON sp.prod_cate_id = spc.id
|
||||
WHERE
|
||||
sp.del_flag = 0
|
||||
AND sp.store_id = #{storeId}
|
||||
GROUP BY
|
||||
sp.prod_status,
|
||||
sp.prod_cate_id
|
||||
ORDER BY
|
||||
cateCount DESC
|
||||
</select>
|
||||
|
||||
<select id="getAppInfo" resultType="com.ruoyi.xkt.dto.storeProduct.StoreProdAppResDTO">
|
||||
SELECT DISTINCT
|
||||
sp.id AS storeProdId,
|
||||
sp.store_id,
|
||||
sp.prod_name,
|
||||
sp.prod_art_num,
|
||||
sp.prod_title,
|
||||
sp.create_time,
|
||||
MIN( DISTINCT spcp.price ) AS minPrice,
|
||||
GROUP_CONCAT( DISTINCT dpt.tag ORDER BY dpt.type ASC ) AS tagStr,
|
||||
spd.detail,
|
||||
<if test="userId != null">
|
||||
EXISTS ( SELECT 1 FROM user_favorites uf WHERE sp.id = uf.store_prod_id AND uf.del_flag = 0 AND uf.user_id = #{userId} ) AS collectProd
|
||||
</if>
|
||||
FROM
|
||||
store_product sp
|
||||
LEFT JOIN store s ON sp.store_id = s.id
|
||||
LEFT JOIN store_product_color_price spcp ON sp.id = spcp.store_prod_id AND spcp.del_flag = 0
|
||||
LEFT JOIN daily_prod_tag dpt ON sp.id = dpt.store_prod_id AND dpt.del_flag = 0
|
||||
LEFT JOIN store_product_detail spd ON sp.id = spd.store_prod_id AND spd.del_flag = 0
|
||||
WHERE
|
||||
sp.del_flag = 0 AND sp.id = #{storeProdId}
|
||||
GROUP BY
|
||||
sp.id,
|
||||
spd.detail
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.xkt.mapper.StoreProductServiceMapper">
|
||||
|
||||
<resultMap type="StoreProductService" id="StoreProductServiceResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="storeProdId" column="store_prod_id" />
|
||||
|
|
@ -19,86 +18,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectStoreProductServiceVo">
|
||||
select id, store_prod_id, custom_refund, thirty_day_refund, one_batch_sale, refund_within_three_day, version, del_flag, create_by, create_time, update_by, update_time from store_product_service
|
||||
</sql>
|
||||
|
||||
<select id="selectStoreProductServiceList" parameterType="StoreProductService" resultMap="StoreProductServiceResult">
|
||||
<include refid="selectStoreProductServiceVo"/>
|
||||
<where>
|
||||
<if test="storeProdId != null "> and store_prod_id = #{storeProdId}</if>
|
||||
<if test="customRefund != null and customRefund != ''"> and custom_refund = #{customRefund}</if>
|
||||
<if test="thirtyDayRefund != null and thirtyDayRefund != ''"> and thirty_day_refund = #{thirtyDayRefund}</if>
|
||||
<if test="oneBatchSale != null and oneBatchSale != ''"> and one_batch_sale = #{oneBatchSale}</if>
|
||||
<if test="refundWithinThreeDay != null and refundWithinThreeDay != ''"> and refund_within_three_day = #{refundWithinThreeDay}</if>
|
||||
<if test="version != null "> and version = #{version}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectStoreProductServiceByStoreProdSvcId" parameterType="Long" resultMap="StoreProductServiceResult">
|
||||
<include refid="selectStoreProductServiceVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertStoreProductService" parameterType="StoreProductService" useGeneratedKeys="true" keyProperty="storeProdSvcId">
|
||||
insert into store_product_service
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="storeProdId != null">store_prod_id,</if>
|
||||
<if test="customRefund != null">custom_refund,</if>
|
||||
<if test="thirtyDayRefund != null">thirty_day_refund,</if>
|
||||
<if test="oneBatchSale != null">one_batch_sale,</if>
|
||||
<if test="refundWithinThreeDay != null">refund_within_three_day,</if>
|
||||
<if test="version != null">version,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="storeProdId != null">#{storeProdId},</if>
|
||||
<if test="customRefund != null">#{customRefund},</if>
|
||||
<if test="thirtyDayRefund != null">#{thirtyDayRefund},</if>
|
||||
<if test="oneBatchSale != null">#{oneBatchSale},</if>
|
||||
<if test="refundWithinThreeDay != null">#{refundWithinThreeDay},</if>
|
||||
<if test="version != null">#{version},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateStoreProductService" parameterType="StoreProductService">
|
||||
update store_product_service
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="storeProdId != null">store_prod_id = #{storeProdId},</if>
|
||||
<if test="customRefund != null">custom_refund = #{customRefund},</if>
|
||||
<if test="thirtyDayRefund != null">thirty_day_refund = #{thirtyDayRefund},</if>
|
||||
<if test="oneBatchSale != null">one_batch_sale = #{oneBatchSale},</if>
|
||||
<if test="refundWithinThreeDay != null">refund_within_three_day = #{refundWithinThreeDay},</if>
|
||||
<if test="version != null">version = #{version},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteStoreProductServiceByStoreProdSvcId" parameterType="Long">
|
||||
delete from store_product_service where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteStoreProductServiceByStoreProdSvcIds" parameterType="String">
|
||||
delete from store_product_service where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateDelFlagByStoreProdId" parameterType="Long">
|
||||
UPDATE store_product_service SET del_flag = 2 WHERE store_prod_id = #{storeProdId}
|
||||
</update>
|
||||
|
|
@ -115,5 +34,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
del_flag = 0 AND store_prod_id = #{storeProdId}
|
||||
</select>
|
||||
|
||||
<select id="selectSvc" resultType="com.ruoyi.xkt.dto.storeProdSvc.StoreProdSvcDTO">
|
||||
SELECT
|
||||
custom_refund,
|
||||
thirty_day_refund,
|
||||
one_batch_sale,
|
||||
refund_within_three_day
|
||||
FROM
|
||||
store_product_service
|
||||
WHERE
|
||||
del_flag = 0 AND store_prod_id = #{storeProdId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue