1.0 完成

This commit is contained in:
hupeng
2023-07-31 11:16:50 +08:00
parent 0ae51f9ee7
commit 0e0b2d7624
31 changed files with 516 additions and 233 deletions

View File

@ -33,6 +33,12 @@
<version>${revision}</version>
</dependency>
<!-- Job 定时任务相关 -->
<dependency>
<groupId>co.yixiang.boot</groupId>
<artifactId>yshop-spring-boot-starter-job</artifactId>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>co.yixiang.boot</groupId>

View File

@ -64,6 +64,7 @@ public class AppCartController {
@PreAuthenticated
@PostMapping("/add")
@Operation(summary = "添加购物车")
public CommonResult<Map<String,Object>> add(@Validated @RequestBody AppCartParam cartParam){
Map<String,Object> map = new LinkedHashMap<>();
Long uid = getLoginUserId();

View File

@ -20,6 +20,10 @@ import co.yixiang.yshop.module.product.service.storeproductattrvalue.StoreProduc
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -40,6 +44,7 @@ import static co.yixiang.yshop.module.cart.enums.ErrorCodeConstants.STORE_CART_N
*
* @author yshop
*/
@Slf4j
@Service
@Validated
public class AppStoreCartServiceImpl extends ServiceImpl<StoreCartMapper,StoreCartDO> implements AppStoreCartService {
@ -53,6 +58,7 @@ public class AppStoreCartServiceImpl extends ServiceImpl<StoreCartMapper,StoreCa
@Resource
private StoreProductAttrValueService storeProductAttrValueService;
/**
* 返回当前用户购物车总数量
*
@ -119,7 +125,7 @@ public class AppStoreCartServiceImpl extends ServiceImpl<StoreCartMapper,StoreCa
}
/**
* 检测商品库存
* 检测商品库存 库存加锁
*
* @param uid 用户ID
* @param productId 产品ID
@ -271,9 +277,11 @@ public class AppStoreCartServiceImpl extends ServiceImpl<StoreCartMapper,StoreCa
* 修改购物车支付状态
* @param cartIds
*/
@Async
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
//@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void updateCartPayStatus(List<String> cartIds) {
log.info("==========修改购物车支付状态start===========");
StoreCartDO cartObj = new StoreCartDO();
cartObj.setIsPay(OrderInfoEnum.PAY_STATUS_1.getValue());
storeCartMapper.update(cartObj, Wrappers.<StoreCartDO>lambdaQuery()