销量和浏览量字段设置
This commit is contained in:
@@ -14,6 +14,7 @@ import com.aida.seller.module.listing.vo.ListingDetailVO;
|
||||
import com.aida.seller.module.listing.vo.ListingMallVO;
|
||||
import com.aida.seller.util.MinioUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -143,6 +144,11 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
|
||||
throw new BusinessException("商品不存在");
|
||||
}
|
||||
|
||||
this.getBaseMapper().update(null,
|
||||
new LambdaUpdateWrapper<ListingEntity>()
|
||||
.eq(ListingEntity::getId, id)
|
||||
.setSql("view_count", "view_count + 1"));
|
||||
|
||||
List<ListingImageEntity> images = listingImageMapper.selectList(
|
||||
new LambdaQueryWrapper<ListingImageEntity>()
|
||||
.eq(ListingImageEntity::getListingId, id)
|
||||
|
||||
@@ -15,4 +15,6 @@ public interface OrderItemMapper extends BaseMapper<OrderItemEntity> {
|
||||
List<AssetsItemVO> selectAssetsPage(@Param("offset") long offset, @Param("size") long size, @Param("dto") AssetsDTO dto);
|
||||
|
||||
Long selectAssetsCount(@Param("dto") AssetsDTO dto);
|
||||
|
||||
void incrementSalesVolumeByOrderIds(@Param("orderIds") List<Long> orderIds);
|
||||
}
|
||||
|
||||
@@ -325,6 +325,26 @@ public class OrderServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||
throw new BusinessException("订单不存在或无权修改");
|
||||
} else {
|
||||
log.info("[Order] PaymentId:{} / OrderId:{}, 更新订单状态", dto.getPaymentId(), dto.getOrderIds());
|
||||
|
||||
if (dto.getStatus() != null && dto.getStatus() == 1) {
|
||||
List<Long> targetOrderIds;
|
||||
if (dto.getOrderIds() != null && !dto.getOrderIds().isEmpty()) {
|
||||
targetOrderIds = dto.getOrderIds();
|
||||
} else if (dto.getPaymentId() != null) {
|
||||
LambdaQueryWrapper<OrderInfoEntity> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(OrderInfoEntity::getPaymentId, dto.getPaymentId());
|
||||
targetOrderIds = this.list(qw).stream()
|
||||
.map(OrderInfoEntity::getId)
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
targetOrderIds = Collections.emptyList();
|
||||
}
|
||||
|
||||
if (!targetOrderIds.isEmpty()) {
|
||||
orderItemMapper.incrementSalesVolumeByOrderIds(targetOrderIds);
|
||||
log.info("[Order] SalesVolume incremented for orderIds: {}", targetOrderIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user