master:商品新增privateItem字段,用于区分是否私款;
parent
d157234934
commit
1ddc16e138
|
|
@ -32,14 +32,14 @@ public class ShoppingCartController extends XktBaseController {
|
|||
|
||||
final IShoppingCartService shopCartService;
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller,agent')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,agent')")
|
||||
@ApiOperation(value = "获取用户进货车各状态数量", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/status/num")
|
||||
public R<ShopCartStatusCountResVO> getStatusNum() {
|
||||
return R.ok(BeanUtil.toBean(shopCartService.getStatusNum(), ShopCartStatusCountResVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller,agent')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,agent')")
|
||||
@ApiOperation(value = "电商卖家添加商品到进货车", httpMethod = "POST", response = R.class)
|
||||
@Log(title = "电商卖家添加商品到进货车", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
|
|
@ -47,7 +47,7 @@ public class ShoppingCartController extends XktBaseController {
|
|||
return R.ok(shopCartService.create(BeanUtil.toBean(shopCartVO, ShoppingCartDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller,agent')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,agent')")
|
||||
@ApiOperation(value = "电商卖家编辑进货车商品", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "电商卖家编辑进货车商品", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
|
|
@ -55,14 +55,14 @@ public class ShoppingCartController extends XktBaseController {
|
|||
return R.ok(shopCartService.update(BeanUtil.toBean(editVO, ShoppingCartEditDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller,agent')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,agent')")
|
||||
@ApiOperation(value = "获取用户进货车列表", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/page")
|
||||
public R<Page<ShopCartPageResDTO>> page(@Validated @RequestBody ShopCartPageVO pageVO) {
|
||||
return R.ok(shopCartService.page(BeanUtil.toBean(pageVO, ShopCartPageDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller,agent')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,agent')")
|
||||
@ApiOperation(value = "用户进货车列表点击编辑获取数据", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/edit/{shoppingCartId}")
|
||||
public R<ShopCartEditDetailResVO> getEditInfo(@PathVariable Long shoppingCartId) {
|
||||
|
|
@ -77,7 +77,7 @@ public class ShoppingCartController extends XktBaseController {
|
|||
return R.ok(BeanUtil.copyToList(shopCartService.getList(BeanUtil.toBean(listVO, ShopCartListDTO.class)), ShopCartResVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('seller,agent')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,agent')")
|
||||
@ApiOperation(value = "用户删除进货车商品", httpMethod = "DELETE", response = R.class)
|
||||
@Log(title = "用户删除进货车商品", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping
|
||||
|
|
@ -85,5 +85,14 @@ public class ShoppingCartController extends XktBaseController {
|
|||
return R.ok(shopCartService.delete(BeanUtil.toBean(deleteVO, ShopCartDeleteDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,agent')")
|
||||
@ApiOperation(value = "用户修改进货车明细数量", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "用户修改进货车明细数量", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/detail/quantity")
|
||||
public R<Integer> updateDetailQuantity(@Validated @RequestBody ShopCartDetailQuantityUpdateVO updateQuantityVO) {
|
||||
return R.ok(shopCartService.updateDetailQuantity(BeanUtil.toBean(updateQuantityVO, ShopCartDetailQuantityUpdateDTO.class)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ public class StoreProdPageVO extends BasePageVO {
|
|||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "商品分类ID")
|
||||
private Long prodCateId;
|
||||
@ApiModelProperty(value = "是否私款 0 否 1 是")
|
||||
private Integer privateItem;
|
||||
@ApiModelProperty(value = "档口ID", required = true)
|
||||
@NotNull(message = "档口ID不能为空")
|
||||
private Long storeId;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ public class StoreProdResVO {
|
|||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "商品标题")
|
||||
private String prodTitle;
|
||||
@ApiModelProperty(value = "0 否 1 是")
|
||||
private Integer privateItem;
|
||||
@ApiModelProperty(value = "商品重量")
|
||||
private BigDecimal prodWeight;
|
||||
@ApiModelProperty(value = "生产价格")
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ public class StoreProdVO {
|
|||
@Size(min = 0, max = 60, message = "商品标题不能超过60个字!")
|
||||
@NotBlank(message = "商品标题不能为空!")
|
||||
private String prodTitle;
|
||||
|
||||
@ApiModelProperty(value = "0 否 1 是", required = true)
|
||||
private Integer privateItem;
|
||||
|
||||
@ApiModelProperty(value = "商品重量")
|
||||
private BigDecimal prodWeight;
|
||||
@ApiModelProperty(value = "生产价格")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.userShoppingCart;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class ShopCartDetailQuantityUpdateVO {
|
||||
|
||||
@NotNull(message = "进货车明细ID不可为空!")
|
||||
@ApiModelProperty(value = "进货车明细ID", required = true)
|
||||
private Long shoppingCartDetailId;
|
||||
@NotNull(message = "数量不可为空!")
|
||||
@ApiModelProperty(value = "数量", required = true)
|
||||
private Integer quantity;
|
||||
|
||||
}
|
||||
|
|
@ -427,7 +427,7 @@ public class XktTask {
|
|||
// 5. 打 关注榜 标签,根据关注量,进行排序
|
||||
this.tagAttentionRank(now, yesterday, tagList);
|
||||
// 6. 打 库存榜 标签,根据库存量,进行排序
|
||||
this.tagStockTag(yesterday, oneMonthAgo, tagList);
|
||||
this.tagStockTag(now, yesterday, oneMonthAgo, tagList);
|
||||
// 7. 打 七日上新 标签
|
||||
this.tag7DaysNewTag(now, yesterday, oneWeekAgo, tagList);
|
||||
if (CollectionUtils.isEmpty(tagList)) {
|
||||
|
|
@ -503,8 +503,9 @@ public class XktTask {
|
|||
*/
|
||||
@Transactional
|
||||
public void dailyProdWeight() {
|
||||
// 筛选非私款的商品
|
||||
List<StoreProduct> storeProdList = this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>()
|
||||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED));
|
||||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED).eq(StoreProduct::getPrivateItem, EProductItemType.NON_PRIVATE_ITEM.getValue()));
|
||||
if (CollectionUtils.isEmpty(storeProdList)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -543,7 +544,9 @@ public class XktTask {
|
|||
*/
|
||||
@Transactional
|
||||
public void dailyStoreWeight() {
|
||||
List<StoreProduct> storeProdList = this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>().eq(StoreProduct::getDelFlag, Constants.UNDELETED));
|
||||
// 筛选非私款的商品
|
||||
List<StoreProduct> storeProdList = this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>()
|
||||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED).eq(StoreProduct::getPrivateItem, EProductItemType.NON_PRIVATE_ITEM.getValue()));
|
||||
if (CollectionUtils.isEmpty(storeProdList)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -773,8 +776,10 @@ public class XktTask {
|
|||
final List<Long> storeIdList = memberList.stream().map(StoreMember::getStoreId).collect(Collectors.toList());
|
||||
List<Store> storeList = this.storeMapper.selectList(new LambdaQueryWrapper<Store>()
|
||||
.eq(Store::getDelFlag, Constants.UNDELETED).in(Store::getId, storeIdList));
|
||||
// 非私款商品才会计入权重
|
||||
List<StoreProduct> storeProdList = this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>()
|
||||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED).in(StoreProduct::getStoreId, storeIdList));
|
||||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED).eq(StoreProduct::getPrivateItem, EProductItemType.NON_PRIVATE_ITEM.getValue())
|
||||
.in(StoreProduct::getStoreId, storeIdList));
|
||||
if (CollectionUtils.isEmpty(storeProdList)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -846,15 +851,16 @@ public class XktTask {
|
|||
public void hourPublicStoreProduct() {
|
||||
// 获取当前时间 格式化为 yyyy-MM-dd HH:00:00
|
||||
String hourTime = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:00:00").format(LocalDateTime.now());
|
||||
// 当前整点待发布的商品
|
||||
List<StoreProduct> unpublicList = this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>()
|
||||
// 当前整点待发布的商品 必须为非私款商品
|
||||
List<StoreProduct> unPublicList = this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>()
|
||||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED).eq(StoreProduct::getListingWaySchedule, hourTime)
|
||||
.eq(StoreProduct::getPrivateItem, EProductItemType.NON_PRIVATE_ITEM.getValue())
|
||||
.eq(StoreProduct::getProdStatus, EProductStatus.UN_PUBLISHED.getValue()));
|
||||
if (CollectionUtils.isEmpty(unpublicList)) {
|
||||
if (CollectionUtils.isEmpty(unPublicList)) {
|
||||
return;
|
||||
}
|
||||
System.err.println(unpublicList);
|
||||
final List<String> storeProdIdList = unpublicList.stream().map(StoreProduct::getId).map(String::valueOf).collect(Collectors.toList());
|
||||
System.err.println(unPublicList);
|
||||
final List<String> storeProdIdList = unPublicList.stream().map(StoreProduct::getId).map(String::valueOf).collect(Collectors.toList());
|
||||
// 获取所有的商品的第一张主图
|
||||
List<StoreProdFileResDTO> mainPicList = this.storeProdFileMapper.selectMainPic(storeProdIdList);
|
||||
// 所有的商品主图map
|
||||
|
|
@ -880,11 +886,11 @@ public class XktTask {
|
|||
.stream().collect(Collectors.toMap(StoreProductCategoryAttribute::getStoreProdId, x -> x));
|
||||
// 档口商品对应的档口
|
||||
Map<Long, Store> storeMap = this.storeMapper.selectList(new LambdaQueryWrapper<Store>().eq(Store::getDelFlag, Constants.UNDELETED)
|
||||
.in(Store::getId, unpublicList.stream().map(StoreProduct::getStoreId).collect(Collectors.toList())))
|
||||
.in(Store::getId, unPublicList.stream().map(StoreProduct::getStoreId).collect(Collectors.toList())))
|
||||
.stream().collect(Collectors.toMap(Store::getId, x -> x));
|
||||
// 构建批量操作请求
|
||||
List<BulkOperation> bulkOperations = new ArrayList<>();
|
||||
for (StoreProduct product : unpublicList) {
|
||||
for (StoreProduct product : unPublicList) {
|
||||
final SysProductCategory cate = prodCateMap.get(product.getProdCateId());
|
||||
final SysProductCategory parCate = ObjectUtils.isEmpty(cate) ? null : prodCateMap.get(cate.getParentId());
|
||||
final Store store = storeMap.get(product.getStoreId());
|
||||
|
|
@ -929,7 +935,7 @@ public class XktTask {
|
|||
} catch (Exception e) {
|
||||
log.error("批量插入到 ES 失败", e);
|
||||
}
|
||||
for (StoreProduct product : unpublicList) {
|
||||
for (StoreProduct product : unPublicList) {
|
||||
List<String> mainPicUrlList = mainPicMap.get(product.getId());
|
||||
if (CollUtil.isEmpty(mainPicUrlList)) {
|
||||
return;
|
||||
|
|
@ -1313,6 +1319,7 @@ public class XktTask {
|
|||
*/
|
||||
private void tagSevenDayNew(Date now, Date yesterday, Date fourDaysAgo, Date oneWeekAgo, List<DailyProdTag> tagList) {
|
||||
List<StoreProduct> storeProdList = this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>()
|
||||
.eq(StoreProduct::getPrivateItem, EProductItemType.NON_PRIVATE_ITEM.getValue())
|
||||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED).between(StoreProduct::getCreateTime, oneWeekAgo, fourDaysAgo));
|
||||
if (CollectionUtils.isEmpty(storeProdList)) {
|
||||
return;
|
||||
|
|
@ -1332,6 +1339,7 @@ public class XktTask {
|
|||
*/
|
||||
private void tagThreeDayNew(Date now, Date yesterday, Date fourDaysAgo, List<DailyProdTag> tagList) {
|
||||
List<StoreProduct> storeProdList = this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>()
|
||||
.eq(StoreProduct::getPrivateItem, EProductItemType.NON_PRIVATE_ITEM.getValue())
|
||||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED).between(StoreProduct::getCreateTime, fourDaysAgo, yesterday));
|
||||
if (CollectionUtils.isEmpty(storeProdList)) {
|
||||
return;
|
||||
|
|
@ -1395,7 +1403,7 @@ public class XktTask {
|
|||
*/
|
||||
private void tag7DaysNewTag(Date now, Date yesterday, Date oneWeekAgo, List<DailyStoreTag> tagList) {
|
||||
List<StoreProduct> newProdList = this.storeProdMapper.selectList(new LambdaQueryWrapper<StoreProduct>()
|
||||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED)
|
||||
.eq(StoreProduct::getDelFlag, Constants.UNDELETED).eq(StoreProduct::getPrivateItem, EProductItemType.NON_PRIVATE_ITEM.getValue())
|
||||
.in(StoreProduct::getProdStatus, Collections.singletonList(EProductStatus.ON_SALE.getValue()))
|
||||
.between(StoreProduct::getCreateTime, oneWeekAgo, yesterday));
|
||||
if (CollectionUtils.isEmpty(newProdList)) {
|
||||
|
|
@ -1403,24 +1411,25 @@ public class XktTask {
|
|||
}
|
||||
newProdList.stream().map(StoreProduct::getStoreId).distinct().forEach(x -> {
|
||||
tagList.add(DailyStoreTag.builder().storeId(x).type(StoreTagType.SEVEN_DAY_NEW_RANK.getValue())
|
||||
.tag("七日上新").voucherDate(yesterday).build());
|
||||
.tag("七日上新").voucherDate(now).build());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 给档口打库存标签
|
||||
*
|
||||
* @param now 今天
|
||||
* @param yesterday 昨天
|
||||
* @param oneMonthAgo 一月前
|
||||
* @param tagList 标签列表
|
||||
*/
|
||||
private void tagStockTag(Date yesterday, Date oneMonthAgo, List<DailyStoreTag> tagList) {
|
||||
private void tagStockTag(Date now, Date yesterday, Date oneMonthAgo, List<DailyStoreTag> tagList) {
|
||||
List<DailyStoreTagDTO> top10List = this.stockMapper.selectTop10List(yesterday, oneMonthAgo);
|
||||
if (CollectionUtils.isEmpty(top10List)) {
|
||||
return;
|
||||
}
|
||||
tagList.addAll(top10List.stream().map(x -> DailyStoreTag.builder().storeId(x.getStoreId()).type(StoreTagType.STOCK_RANK.getValue())
|
||||
.tag("库存充足").voucherDate(yesterday).build()).collect(Collectors.toList()));
|
||||
.tag("库存充足").voucherDate(now).build()).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,11 @@ public class StoreProduct extends XktBaseEntity {
|
|||
@Excel(name = "商品标题")
|
||||
private String prodTitle;
|
||||
|
||||
/**
|
||||
* 是否私款 0 否 1 是
|
||||
*/
|
||||
private Integer privateItem;
|
||||
|
||||
/**
|
||||
* 商品重量
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public class StoreProdDTO {
|
|||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "商品标题")
|
||||
private String prodTitle;
|
||||
@ApiModelProperty(value = "0 否 1 是")
|
||||
private Integer privateItem;
|
||||
@ApiModelProperty(value = "商品重量")
|
||||
private BigDecimal prodWeight;
|
||||
@ApiModelProperty(value = "生产价格")
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ public class StoreProdPageDTO extends BasePageDTO {
|
|||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "商品分类ID")
|
||||
private Long prodCateId;
|
||||
@ApiModelProperty(value = "是否私款 0 否 1 是")
|
||||
private Integer privateItem;
|
||||
@ApiModelProperty(value = "档口ID")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(value = "商品状态")
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import java.util.Date;
|
|||
@Accessors(chain = true)
|
||||
public class StoreProdPageResDTO {
|
||||
|
||||
@ApiModelProperty(value = "是否私款 0 否 1 是")
|
||||
private Integer privateItem;
|
||||
@ApiModelProperty(value = "档口商品颜色ID")
|
||||
private Long storeProdColorId;
|
||||
@ApiModelProperty(value = "档口商品ID")
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ public class StoreProdResDTO {
|
|||
private String prodArtNum;
|
||||
@ApiModelProperty(value = "商品标题")
|
||||
private String prodTitle;
|
||||
@ApiModelProperty(value = "0 否 1 是")
|
||||
private Integer privateItem;
|
||||
@ApiModelProperty(value = "商品重量")
|
||||
private BigDecimal prodWeight;
|
||||
@ApiModelProperty(value = "生产价格")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.xkt.dto.userShoppingCart;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class ShopCartDetailQuantityUpdateDTO {
|
||||
|
||||
@ApiModelProperty(value = "进货车明细ID")
|
||||
private Long shoppingCartDetailId;
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Integer quantity;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.xkt.enums;
|
||||
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-04-02 23:42
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum EProductItemType {
|
||||
|
||||
// 非私款
|
||||
NON_PRIVATE_ITEM(0, "非私款"),
|
||||
// 私款
|
||||
PRIVATE_ITEM(1, "私款"),
|
||||
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
private final String label;
|
||||
|
||||
public static EProductItemType of(Integer value) {
|
||||
for (EProductItemType e : EProductItemType.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
throw new ServiceException("未知商品私款状态", HttpStatus.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,13 +18,6 @@ import java.util.List;
|
|||
*/
|
||||
@Repository
|
||||
public interface StoreProductMapper extends BaseMapper<StoreProduct> {
|
||||
/**
|
||||
* 查询档口商品列表
|
||||
*
|
||||
* @param storeProduct 档口商品
|
||||
* @return 档口商品集合
|
||||
*/
|
||||
List<StoreProduct> selectStoreProductList(StoreProduct storeProduct);
|
||||
|
||||
/**
|
||||
* 根据商品货号模糊查询档口商品并返回商品主图
|
||||
|
|
@ -37,6 +30,7 @@ public interface StoreProductMapper extends BaseMapper<StoreProduct> {
|
|||
|
||||
/**
|
||||
* 档口商品ID列表
|
||||
* 过滤掉 私款商品
|
||||
*
|
||||
* @param idList id列表
|
||||
* @return List<ProductESDTO>
|
||||
|
|
|
|||
|
|
@ -68,4 +68,11 @@ public interface IShoppingCartService {
|
|||
*/
|
||||
ShopCartStatusCountResDTO getStatusNum();
|
||||
|
||||
/**
|
||||
* 用户更新进货车明细数量
|
||||
*
|
||||
* @param updateQuantityDTO 更新入参
|
||||
* @return Integer
|
||||
*/
|
||||
Integer updateDetailQuantity(ShopCartDetailQuantityUpdateDTO updateQuantityDTO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -310,6 +310,26 @@ public class ShoppingCartServiceImpl implements IShoppingCartService {
|
|||
return this.shopCartMapper.getStatusNum(SecurityUtils.getUserId(), sixMonthAgo, now);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户更新进货车明细数量
|
||||
*
|
||||
* @param updateQuantityDTO 更新入参
|
||||
* @return Integer
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Integer updateDetailQuantity(ShopCartDetailQuantityUpdateDTO updateQuantityDTO) {
|
||||
// 数量不能小于等于0
|
||||
if (0 >= updateQuantityDTO.getQuantity()) {
|
||||
throw new ServiceException("数量不能小于等于0!", HttpStatus.ERROR);
|
||||
}
|
||||
ShoppingCartDetail detail = Optional.ofNullable(this.shopCartDetailMapper.selectOne(new LambdaQueryWrapper<ShoppingCartDetail>()
|
||||
.eq(ShoppingCartDetail::getId, updateQuantityDTO.getShoppingCartDetailId()).eq(ShoppingCartDetail::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("进货车明细不存在!", HttpStatus.ERROR));
|
||||
detail.setQuantity(updateQuantityDTO.getQuantity());
|
||||
return this.shopCartDetailMapper.updateById(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取档口商品颜色尺码的库存
|
||||
*
|
||||
|
|
|
|||
|
|
@ -217,8 +217,9 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
this.createProdColor(createDTO, storeProd.getId(), storeProd.getStoreId(), storeProd.getProdArtNum());
|
||||
// 新增档口商品其它属性
|
||||
this.createOtherProperties(createDTO, storeProd);
|
||||
// 立即发布 将商品同步到 ES 商品文档,并将商品主图同步到 以图搜款服务中
|
||||
if (Objects.equals(storeProd.getListingWay(), ListingType.RIGHT_NOW.getValue())) {
|
||||
// 非私款的商品 且 立即发布 将商品同步到 ES 商品文档,并将商品主图同步到 以图搜款服务中
|
||||
if (Objects.equals(storeProd.getPrivateItem(), EProductItemType.NON_PRIVATE_ITEM.getValue())
|
||||
&& Objects.equals(storeProd.getListingWay(), ListingType.RIGHT_NOW.getValue())) {
|
||||
// redis中的档口
|
||||
Store store = this.redisCache.getCacheObject(CacheConstants.STORE_KEY + storeProd.getStoreId());
|
||||
// 向ES索引: product_info 创建文档
|
||||
|
|
@ -282,9 +283,10 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
this.updateColorRelation(updateDTO, storeProd.getId(), storeProd.getStoreId(), storeProd.getProdArtNum());
|
||||
// 处理更新逻辑
|
||||
this.updateOtherProperties(updateDTO, storeProd);
|
||||
// 只有在售和尾货状态,更新ES 信息 及 图搜
|
||||
if (Objects.equals(storeProd.getProdStatus(), EProductStatus.ON_SALE.getValue())
|
||||
|| Objects.equals(storeProd.getProdStatus(), EProductStatus.TAIL_GOODS.getValue())) {
|
||||
// 只有非私款商品 且 只有在售和尾货状态,更新ES 信息 及 图搜
|
||||
if (Objects.equals(storeProd.getPrivateItem(), EProductItemType.NON_PRIVATE_ITEM.getValue())
|
||||
&& (Objects.equals(storeProd.getProdStatus(), EProductStatus.ON_SALE.getValue())
|
||||
|| Objects.equals(storeProd.getProdStatus(), EProductStatus.TAIL_GOODS.getValue()))) {
|
||||
// 从redis中获取store
|
||||
Store store = this.redisCache.getCacheObject(CacheConstants.STORE_KEY + storeProd.getStoreId());
|
||||
// 更新索引: product_info 的文档
|
||||
|
|
@ -573,10 +575,16 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
updateProdList.add(storeProduct);
|
||||
});
|
||||
this.storeProdMapper.updateById(updateProdList);
|
||||
// 非私款的商品,才需要更新图搜及ES
|
||||
final List<StoreProduct> nonPrivateProdList = updateProdList.stream()
|
||||
.filter(x -> Objects.equals(x.getPrivateItem(), EProductItemType.NON_PRIVATE_ITEM.getValue())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(nonPrivateProdList)) {
|
||||
return count;
|
||||
}
|
||||
// 非删除商品颜色,则更新ES
|
||||
if (!Objects.equals(prodStatusDTO.getProdStatus(), EProductStatus.REMOVED.getValue())) {
|
||||
// 需要更新状态的商品
|
||||
Map<Long, Integer> updateESProdStatusMap = updateProdList.stream().filter(x -> !Objects.equals(storeProdStatusMap.get(x.getId()), x.getProdStatus()))
|
||||
Map<Long, Integer> updateESProdStatusMap = nonPrivateProdList.stream().filter(x -> !Objects.equals(storeProdStatusMap.get(x.getId()), x.getProdStatus()))
|
||||
.collect(Collectors.toMap(StoreProduct::getId, StoreProduct::getProdStatus));
|
||||
// 没有需要更新商品状态的商品
|
||||
if (MapUtils.isEmpty(updateESProdStatusMap)) {
|
||||
|
|
@ -586,7 +594,7 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
this.updateESProdStatus(updateESProdStatusMap);
|
||||
} else {
|
||||
// 需要删除的商品
|
||||
List<StoreProduct> deleteESProdList = updateProdList.stream().filter(x -> !Objects.equals(storeProdStatusMap.get(x.getId()), x.getProdStatus())).collect(Collectors.toList());
|
||||
List<StoreProduct> deleteESProdList = nonPrivateProdList.stream().filter(x -> !Objects.equals(storeProdStatusMap.get(x.getId()), x.getProdStatus())).collect(Collectors.toList());
|
||||
List<Long> updateESProdIdList = deleteESProdList.stream().map(StoreProduct::getId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(updateESProdIdList)) {
|
||||
return count;
|
||||
|
|
@ -970,6 +978,7 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<StoreProdStatusCateCountResDTO> getStatusCateNum(StoreProdStatusCateNumDTO cateNumDTO) {
|
||||
// 商城首页展示的分类对应的数量,需要过滤掉 私款商品
|
||||
List<StoreProdStatusCateCountDTO> statusCateNumList = this.storeProdMapper.getStatusCateNum(cateNumDTO);
|
||||
List<StoreProdStatusCateCountResDTO> countList = new ArrayList<>();
|
||||
statusCateNumList.stream().collect(Collectors.groupingBy(StoreProdStatusCateCountDTO::getProdStatus))
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
pc.`name` AS prodCateName,
|
||||
spc.prod_status,
|
||||
spc.create_time,
|
||||
sf.file_url AS mainPicUrl
|
||||
sf.file_url AS mainPicUrl,
|
||||
sp.private_item
|
||||
FROM
|
||||
store_product_color spc
|
||||
JOIN store_product sp ON spc.store_prod_id = sp.id
|
||||
|
|
@ -50,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
<if test="prodArtNum != null and prodArtNum != ''"> and sp.prod_art_num like concat('%', #{prodArtNum}, '%')</if>
|
||||
<if test="prodCateId != null "> and sp.prod_cate_id = #{prodCateId}</if>
|
||||
<if test="privateItem != null "> and sp.private_item = #{privateItem}</if>
|
||||
ORDER BY
|
||||
spc.create_time DESC
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
JOIN sys_product_category spc2 ON spc1.parent_id = spc2.id
|
||||
LEFT JOIN ( SELECT store_prod_id, MIN( price ) AS min_price FROM store_product_color_size GROUP BY store_prod_id ) spcp ON sp.id = spcp.store_prod_id
|
||||
WHERE
|
||||
sp.del_flag = 0 AND sp.id IN
|
||||
sp.del_flag = 0
|
||||
AND sp.private_item = 0
|
||||
AND sp.id IN
|
||||
<foreach item="id" collection="idList" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
|
@ -275,6 +277,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
JOIN sys_product_category spc ON sp.prod_cate_id = spc.id
|
||||
WHERE
|
||||
sp.del_flag = 0
|
||||
AND sp.private_item = 0
|
||||
AND sp.store_id = #{storeId}
|
||||
GROUP BY
|
||||
sp.prod_status,
|
||||
|
|
|
|||
Loading…
Reference in New Issue