Bläddra i källkod

直播积分数据修改

yuhongqi 1 dag sedan
förälder
incheckning
5cc97366d3

+ 5 - 5
fs-admin/src/main/java/com/fs/company/controller/CompanyController.java

@@ -134,7 +134,7 @@ public class CompanyController extends BaseController
      * 新增企业
      */
     @PreAuthorize("@ss.hasPermi('company:company:add')")
-    @Log(title = "企业", businessType = BusinessType.INSERT)
+    @Log(title = "企业", businessType = BusinessType.INSERT, isStoreLog = true)
     @PostMapping
     public R add(@RequestBody Company company)
     {
@@ -153,7 +153,7 @@ public class CompanyController extends BaseController
      * 修改企业
      */
     @PreAuthorize("@ss.hasPermi('company:company:edit')")
-    @Log(title = "企业", businessType = BusinessType.UPDATE)
+    @Log(title = "企业", businessType = BusinessType.UPDATE, isStoreLog = true)
     @PutMapping
     public AjaxResult edit(@RequestBody Company company)
     {
@@ -186,7 +186,7 @@ public class CompanyController extends BaseController
      * 删除企业
      */
     @PreAuthorize("@ss.hasPermi('company:company:remove')")
-    @Log(title = "企业", businessType = BusinessType.DELETE)
+    @Log(title = "企业", businessType = BusinessType.DELETE, isStoreLog = true)
 	@DeleteMapping("/{companyIds}")
     public AjaxResult remove(@PathVariable Long[] companyIds)
     {
@@ -244,7 +244,7 @@ public class CompanyController extends BaseController
 
 
     @PreAuthorize("@ss.hasPermi('company:company:recharge')")
-    @Log(title = "企业转账", businessType = BusinessType.INSERT)
+    @Log(title = "企业转账", businessType = BusinessType.INSERT, isStoreLog = true)
     @PostMapping(value = "/recharge")
     @Transactional
     @RepeatSubmit
@@ -270,7 +270,7 @@ public class CompanyController extends BaseController
     }
 
     @PreAuthorize("@ss.hasPermi('company:company:deduct')")
-    @Log(title = "企业扣款", businessType = BusinessType.INSERT)
+    @Log(title = "企业扣款", businessType = BusinessType.INSERT, isStoreLog = true)
     @PostMapping(value = "/deduct")
     @Transactional
     @RepeatSubmit

+ 4 - 4
fs-admin/src/main/java/com/fs/qw/controller/QwCompanyController.java

@@ -87,7 +87,7 @@ public class QwCompanyController extends BaseController
      * 导出企微主体列表
      */
     @PreAuthorize("@ss.hasPermi('qw:qwCompany:export')")
-    @Log(title = "企微主体", businessType = BusinessType.EXPORT)
+    @Log(title = "企微主体", businessType = BusinessType.EXPORT, isStoreLog = true)
     @GetMapping("/export")
     public AjaxResult export(QwCompany qwCompany)
     {
@@ -110,7 +110,7 @@ public class QwCompanyController extends BaseController
      * 新增企微主体
      */
     @PreAuthorize("@ss.hasPermi('qw:qwCompany:add')")
-    @Log(title = "企微主体", businessType = BusinessType.INSERT)
+    @Log(title = "企微主体", businessType = BusinessType.INSERT, isStoreLog = true)
     @PostMapping
     public AjaxResult add(@RequestBody QwCompany qwCompany)
     {
@@ -125,7 +125,7 @@ public class QwCompanyController extends BaseController
      * 修改企微主体
      */
     @PreAuthorize("@ss.hasPermi('qw:qwCompany:edit')")
-    @Log(title = "企微主体", businessType = BusinessType.UPDATE)
+    @Log(title = "企微主体", businessType = BusinessType.UPDATE, isStoreLog = true)
     @PutMapping
     public AjaxResult edit(@RequestBody QwCompany qwCompany)
     {
@@ -136,7 +136,7 @@ public class QwCompanyController extends BaseController
      * 删除企微主体
      */
     @PreAuthorize("@ss.hasPermi('qw:qwCompany:remove')")
-    @Log(title = "企微主体", businessType = BusinessType.DELETE)
+    @Log(title = "企微主体", businessType = BusinessType.DELETE, isStoreLog = true)
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)
     {

+ 24 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsStoreAfterSalesServiceImpl.java

@@ -646,6 +646,30 @@ public class FsStoreAfterSalesServiceImpl implements IFsStoreAfterSalesService {
     @Override
     @Transactional
     public R applyAfterSales(long uesrId, FsStoreAfterSalesApplyParam param) {
+        // 查询配置:是否删除历史售后数据
+        try {
+            String deleteAfterSalesConfig = configService.selectConfigByKey("delete_after_sales");
+            if (StringUtils.isNotEmpty(deleteAfterSalesConfig) && "true".equalsIgnoreCase(deleteAfterSalesConfig.trim())) {
+                // 查询历史售后数据,将 is_del 设置为 1
+                FsStoreAfterSales queryAfterSales = new FsStoreAfterSales();
+                queryAfterSales.setOrderId(param.getOrderId());
+                List<FsStoreAfterSales> historyAfterSalesList = fsStoreAfterSalesMapper.selectFsStoreAfterSalesList(queryAfterSales);
+                if (historyAfterSalesList != null && !historyAfterSalesList.isEmpty()) {
+                    for (FsStoreAfterSales historyAfterSales : historyAfterSalesList) {
+                        if (historyAfterSales.getIsDel() != null && historyAfterSales.getIsDel() == 0) {
+                            FsStoreAfterSales updateAfterSales = new FsStoreAfterSales();
+                            updateAfterSales.setId(historyAfterSales.getId());
+                            updateAfterSales.setIsDel(1);
+                            fsStoreAfterSalesMapper.updateFsStoreAfterSales(updateAfterSales);
+                            logger.info("删除历史售后数据,售后ID:{},订单ID:{}", historyAfterSales.getId(), param.getOrderId());
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            logger.error("查询或更新历史售后数据失败", e);
+        }
+        
         FsStoreOrder order = fsStoreOrderMapper.selectFsStoreOrderByOrderId(param.getOrderId());
         if (!order.getUserId().equals(uesrId)) {
             throw new CustomException("非法操作");

+ 25 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreAfterSalesScrmServiceImpl.java

@@ -277,6 +277,31 @@ public class FsStoreAfterSalesScrmServiceImpl implements IFsStoreAfterSalesScrmS
     @Transactional
     public R applyForAfterSales(long userId, FsStoreAfterSalesParam storeAfterSalesParam) {
         logger.info("申请退款请求信息:"+JSONUtil.toJsonStr(storeAfterSalesParam));
+        
+        // 查询配置:是否删除历史售后数据
+        try {
+            String deleteAfterSalesConfig = configService.selectConfigByKey("delete_after_sales");
+            if (StringUtils.isNotEmpty(deleteAfterSalesConfig) && "true".equalsIgnoreCase(deleteAfterSalesConfig.trim())) {
+                // 查询历史售后数据,将 is_del 设置为 1
+                FsStoreAfterSalesScrm queryAfterSales = new FsStoreAfterSalesScrm();
+                queryAfterSales.setOrderCode(storeAfterSalesParam.getOrderCode());
+                List<FsStoreAfterSalesScrm> historyAfterSalesList = fsStoreAfterSalesMapper.selectFsStoreAfterSalesList(queryAfterSales);
+                if (historyAfterSalesList != null && !historyAfterSalesList.isEmpty()) {
+                    for (FsStoreAfterSalesScrm historyAfterSales : historyAfterSalesList) {
+                        if (historyAfterSales.getIsDel() != null && historyAfterSales.getIsDel() == 0) {
+                            FsStoreAfterSalesScrm updateAfterSales = new FsStoreAfterSalesScrm();
+                            updateAfterSales.setId(historyAfterSales.getId());
+                            updateAfterSales.setIsDel(1);
+                            fsStoreAfterSalesMapper.updateFsStoreAfterSales(updateAfterSales);
+                            logger.info("删除历史售后数据,售后ID:{},订单号:{}", historyAfterSales.getId(), storeAfterSalesParam.getOrderCode());
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            logger.error("查询或更新历史售后数据失败", e);
+        }
+        
         FsStoreOrderScrm order=orderService.selectFsStoreOrderByOrderCode(storeAfterSalesParam.getOrderCode());
         Integer orderStatus = order.getStatus();
         if(!order.getUserId().equals(userId)){

+ 71 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java

@@ -363,6 +363,12 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
     @Autowired
     private FsStoreAfterSalesItemScrmMapper fsStoreAfterSalesItemMapper;
 
+    @Autowired
+    private FsStoreAfterSalesScrmMapper fsStoreAfterSalesScrmMapper;
+
+    @Autowired
+    private FsStoreAfterSalesStatusScrmMapper fsStoreAfterSalesStatusScrmMapper;
+
     @Autowired
     private FsPackageOrderMapper fsPackageOrderMapper;
 
@@ -2577,6 +2583,71 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
         if (order.getTuiUserId() != null && order.getTuiUserId() > 0) {
             userService.subTuiMoney(order);
         }
+        // 卓美财务要求,如果退款就必须生成售后订单
+        // 检查配置,如果delete_after_sales为true,创建退款成功的售后订单
+        String deleteAfterSalesConfig = configService.selectConfigByKey("delete_after_sales");
+        if ("true".equals(deleteAfterSalesConfig)) {
+            try {
+                // 检查是否已存在售后订单
+                FsStoreAfterSalesScrm existingAfterSales = new FsStoreAfterSalesScrm();
+                existingAfterSales.setOrderCode(order.getOrderCode());
+                List<FsStoreAfterSalesScrm> existingList = fsStoreAfterSalesScrmMapper.selectFsStoreAfterSalesList(existingAfterSales);
+                
+                // 如果不存在售后订单,则创建
+                if (existingList == null || existingList.isEmpty()) {
+                    // 创建售后订单
+                    FsStoreAfterSalesScrm storeAfterSales = new FsStoreAfterSalesScrm();
+                    storeAfterSales.setOrderCode(order.getOrderCode());
+                    storeAfterSales.setRefundAmount(order.getPayMoney());
+                    storeAfterSales.setServiceType(0); // 0仅退款
+                    storeAfterSales.setReasons("退款成功自动生成售后订单");
+                    storeAfterSales.setExplains("退款成功自动生成售后订单");
+                    storeAfterSales.setExplainImg(null);
+                    storeAfterSales.setStatus(AfterSalesStatusEnum.STATUS_4.getValue()); // 4财务已审核(退款成功)
+                    storeAfterSales.setSalesStatus(3); // 3已完成
+                    storeAfterSales.setCreateTime(Timestamp.valueOf(LocalDateTime.now()));
+                    storeAfterSales.setIsDel(0);
+                    storeAfterSales.setUserId(order.getUserId());
+                    storeAfterSales.setOrderStatus(order.getStatus());
+                    storeAfterSales.setCompanyId(order.getCompanyId());
+                    storeAfterSales.setCompanyUserId(order.getCompanyUserId());
+                    if (order.getPackageJson() != null) {
+                        storeAfterSales.setPackageJson(order.getPackageJson());
+                    }
+                    if (order.getIsPackage() != null) {
+                        storeAfterSales.setIsPackage(order.getIsPackage());
+                    }
+                    fsStoreAfterSalesScrmMapper.insertFsStoreAfterSales(storeAfterSales);
+
+                    // 创建售后商品详情
+                    List<FsStoreOrderItemVO> orderItemVO = fsStoreOrderItemMapper.selectFsStoreOrderItemListByOrderId(order.getId());
+                    if (orderItemVO != null && !orderItemVO.isEmpty()) {
+                        for (FsStoreOrderItemVO item : orderItemVO) {
+                            FsStoreAfterSalesItemScrm afterSalesItem = new FsStoreAfterSalesItemScrm();
+                            afterSalesItem.setStoreAfterSalesId(storeAfterSales.getId());
+                            afterSalesItem.setProductId(item.getProductId());
+                            afterSalesItem.setNum(Math.toIntExact(item.getNum()));
+                            afterSalesItem.setJsonInfo(item.getJsonInfo());
+                            afterSalesItem.setIsDel(0);
+                            fsStoreAfterSalesItemMapper.insertFsStoreAfterSalesItem(afterSalesItem);
+                        }
+                    }
+
+                    // 创建售后状态记录
+                    FsStoreAfterSalesStatusScrm storeAfterSalesStatus = new FsStoreAfterSalesStatusScrm();
+                    storeAfterSalesStatus.setStoreAfterSalesId(storeAfterSales.getId());
+                    storeAfterSalesStatus.setChangeType(AfterSalesStatusEnum.STATUS_4.getValue());
+                    storeAfterSalesStatus.setChangeMessage(AfterSalesStatusEnum.STATUS_4.getDesc());
+                    storeAfterSalesStatus.setChangeTime(Timestamp.valueOf(LocalDateTime.now()));
+                    storeAfterSalesStatus.setOperator("系统");
+                    fsStoreAfterSalesStatusScrmMapper.insertFsStoreAfterSalesStatus(storeAfterSalesStatus);
+                }
+            } catch (Exception e) {
+                logger.error("创建售后订单失败", e);
+                // 不抛出异常,避免影响退款流程
+            }
+        }
+
         return R.ok();
 
     }

+ 26 - 0
fs-service/src/main/java/com/fs/live/service/impl/LiveAfterSalesServiceImpl.java

@@ -410,6 +410,32 @@ public class LiveAfterSalesServiceImpl implements ILiveAfterSalesService {
             log.info("申请售后订单锁获取成功,订单号:{}", param.getOrderCode());
             
             LiveOrder order=liveOrderService.selectOrderIdByOrderCode(param.getOrderCode());
+            
+            // 查询配置:是否删除历史售后数据
+            try {
+                String deleteAfterSalesConfig = configService.selectConfigByKey("delete_after_sales");
+                if (StringUtils.isNotEmpty(deleteAfterSalesConfig) && "true".equalsIgnoreCase(deleteAfterSalesConfig.trim())) {
+                    // 查询历史售后数据,将 is_del 设置为 1
+                    if (order != null && order.getOrderId() != null) {
+                        LiveAfterSales queryAfterSales = new LiveAfterSales();
+                        queryAfterSales.setOrderId(order.getOrderId());
+                        List<LiveAfterSales> historyAfterSalesList = baseMapper.selectLiveAfterSalesList(queryAfterSales);
+                        if (historyAfterSalesList != null && !historyAfterSalesList.isEmpty()) {
+                            for (LiveAfterSales historyAfterSales : historyAfterSalesList) {
+                                if (historyAfterSales.getIsDel() != null && historyAfterSales.getIsDel() == 0) {
+                                    LiveAfterSales updateAfterSales = new LiveAfterSales();
+                                    updateAfterSales.setId(historyAfterSales.getId());
+                                    updateAfterSales.setIsDel(1);
+                                    baseMapper.updateLiveAfterSales(updateAfterSales);
+                                    log.info("删除历史售后数据,售后ID:{},订单ID:{}", historyAfterSales.getId(), order.getOrderId());
+                                }
+                            }
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                log.error("查询或更新历史售后数据失败", e);
+            }
             if(!order.getUserId().equals(userId)){
                 throw new CustomException("非法操作");
             }

+ 2 - 1
fs-service/src/main/java/com/fs/live/service/impl/LiveRedConfServiceImpl.java

@@ -270,7 +270,8 @@ public class LiveRedConfServiceImpl implements ILiveRedConfService {
             liveRedConf.setRedStatus(2L);
             baseMapper.updateLiveRedConf(liveRedConf);
             Set<String> range = CollUtil.newHashSet(String.valueOf(red.getRedId()));
-            finishRedStatusBySetIds(range);
+//            finishRedStatusBySetIds(range);
+            updateDbByRed(liveRedConf);
             return R.error("手慢了,红包已被抢完~");
         }
         // 记录用户红包

+ 94 - 58
fs-user-app/src/main/java/com/fs/app/controller/live/LiveCompletionPointsController.java

@@ -16,6 +16,10 @@ import com.fs.live.domain.LiveCompletionPointsRecord;
 import com.fs.live.mapper.LiveCompletionPointsRecordMapper;
 import com.fs.live.service.ILiveCompletionPointsRecordService;
 import com.fs.live.service.ILiveService;
+import org.redisson.api.RLock;
+import org.redisson.api.RedissonClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -28,6 +32,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 /**
  * 直播完课积分Controller
@@ -36,6 +41,8 @@ import java.util.Map;
 @RequestMapping("/app/live/completion")
 public class LiveCompletionPointsController extends AppBaseController {
 
+    private static final Logger logger = LoggerFactory.getLogger(LiveCompletionPointsController.class);
+
     @Autowired
     private ILiveCompletionPointsRecordService completionPointsRecordService;
 
@@ -51,6 +58,9 @@ public class LiveCompletionPointsController extends AppBaseController {
     @Autowired
     private LiveCompletionPointsRecordMapper completionPointsRecordMapper;
 
+    @Autowired
+    private RedissonClient redissonClient;
+
     /**
      * 领取完课积分
      */
@@ -298,81 +308,107 @@ public class LiveCompletionPointsController extends AppBaseController {
      * 没达到,返回报错
      */
     @PostMapping("/receive-points")
-    @RepeatSubmit
     public R receivePoints(@RequestParam Long liveId) {
         Long userId = Long.parseLong(getUserId());
         
+        // 创建唯一锁,确保同一个 liveId 和 userId 只能有一个线程在执行
+        String lockKey = String.format("receivePoints:liveId:%d:userId:%d", liveId, userId);
+        RLock lock = redissonClient.getLock(lockKey);
+        
         try {
-            // 1. 查询当前用户和当前直播间的最近一次完课记录(不限制日期)
-            LiveCompletionPointsRecord record = completionPointsRecordMapper.selectLatestByUserAndLiveId(liveId, userId);
-            
-            if (record == null) {
-                return R.error("您还没有看课记录,无法领取积分");
+            // 尝试获取锁,等待时间0秒,锁持有时间15秒
+            boolean locked = lock.tryLock(0, 15, TimeUnit.SECONDS);
+            if (!locked) {
+                logger.warn("获取领取积分锁失败,liveId: {}, userId: {}", liveId, userId);
+                return R.error("系统繁忙,请稍后重试");
             }
 
-            // 2. 获取直播间信息和配置
-            Live live = liveService.selectLiveByLiveId(liveId);
-            if (live == null) {
-                return R.error("直播间不存在");
-            }
+            try {
+                // 1. 查询当前用户和当前直播间的最近一次完课记录(不限制日期)
+                LiveCompletionPointsRecord record = completionPointsRecordMapper.selectLatestByUserAndLiveId(liveId, userId);
+                
+                if (record == null) {
+                    return R.error("您还没有看课记录,无法领取积分");
+                }
 
-            // 3. 检查看课记录里面的时长是否达到完课标准
-            Long watchDuration = record.getWatchDuration();
-            if (watchDuration == null || watchDuration <= 0) {
-                return R.error("您的看课时长不足,无法领取积分");
-            }
+                // 2. 获取直播间信息和配置
+                Live live = liveService.selectLiveByLiveId(liveId);
+                if (live == null) {
+                    return R.error("直播间不存在");
+                }
 
-            // 4. 检查完课比例是否达到标准
-            BigDecimal completionRate = record.getCompletionRate();
-            if (completionRate == null) {
-                // 重新计算完课比例
-                Long videoDuration = live.getDuration();
-                if (videoDuration == null || videoDuration <= 0) {
-                    return R.error("直播间视频时长配置错误");
+                // 3. 检查看课记录里面的时长是否达到完课标准
+                Long watchDuration = record.getWatchDuration();
+                if (watchDuration == null || watchDuration <= 0) {
+                    return R.error("您的看课时长不足,无法领取积分");
                 }
-                completionRate = BigDecimal.valueOf(watchDuration)
-                        .multiply(BigDecimal.valueOf(100))
-                        .divide(BigDecimal.valueOf(videoDuration), 2, java.math.RoundingMode.HALF_UP);
-                if (completionRate.compareTo(BigDecimal.valueOf(100)) > 0) {
-                    completionRate = BigDecimal.valueOf(100);
+
+                // 4. 检查完课比例是否达到标准
+                BigDecimal completionRate = record.getCompletionRate();
+                if (completionRate == null) {
+                    // 重新计算完课比例
+                    Long videoDuration = live.getDuration();
+                    if (videoDuration == null || videoDuration <= 0) {
+                        return R.error("直播间视频时长配置错误");
+                    }
+                    completionRate = BigDecimal.valueOf(watchDuration)
+                            .multiply(BigDecimal.valueOf(100))
+                            .divide(BigDecimal.valueOf(videoDuration), 2, java.math.RoundingMode.HALF_UP);
+                    if (completionRate.compareTo(BigDecimal.valueOf(100)) > 0) {
+                        completionRate = BigDecimal.valueOf(100);
+                    }
+                    record.setCompletionRate(completionRate);
                 }
-                record.setCompletionRate(completionRate);
-            }
 
-            // 5. 从直播间配置获取完课标准
-            String configJson = live.getConfigJson();
-            Integer requiredCompletionRate = null;
-            if (configJson != null && !configJson.isEmpty()) {
-                try {
-                    com.alibaba.fastjson.JSONObject jsonConfig = com.alibaba.fastjson.JSON.parseObject(configJson);
-                    requiredCompletionRate = jsonConfig.getInteger("completionRate");
-                } catch (Exception e) {
-                    // 解析失败,忽略
+                // 5. 从直播间配置获取完课标准
+                String configJson = live.getConfigJson();
+                Integer requiredCompletionRate = null;
+                if (configJson != null && !configJson.isEmpty()) {
+                    try {
+                        com.alibaba.fastjson.JSONObject jsonConfig = com.alibaba.fastjson.JSON.parseObject(configJson);
+                        requiredCompletionRate = jsonConfig.getInteger("completionRate");
+                    } catch (Exception e) {
+                        // 解析失败,忽略
+                    }
                 }
-            }
 
-            // 6. 判断是否达到完课标准
-            if (requiredCompletionRate != null && completionRate.compareTo(BigDecimal.valueOf(requiredCompletionRate)) < 0) {
-                return R.error("您的完课比例未达到标准(" + requiredCompletionRate + "%),当前完课比例:" + completionRate + "%");
-            }
+                // 6. 判断是否达到完课标准
+                if (requiredCompletionRate != null && completionRate.compareTo(BigDecimal.valueOf(requiredCompletionRate)) < 0) {
+                    return R.error("您的完课比例未达到标准(" + requiredCompletionRate + "%),当前完课比例:" + completionRate + "%");
+                }
 
-            // 7. 检查是否已领取
-            if (record.getReceiveStatus() != null && record.getReceiveStatus() == 1) {
-                return R.error("该完课积分已领取");
-            }
+                // 7. 检查是否已领取
+                if (record.getReceiveStatus() != null && record.getReceiveStatus() == 1) {
+                    return R.error("该完课积分已领取");
+                }
 
-            // 8. 领取积分(更新看课记录的领取状态,给用户加积分)
-            LiveCompletionPointsRecord receivedRecord = completionPointsRecordService.receiveCompletionPoints(record.getId(), userId);
+                // 8. 领取积分(更新看课记录的领取状态,给用户加积分)
+                LiveCompletionPointsRecord receivedRecord = completionPointsRecordService.receiveCompletionPoints(record.getId(), userId);
 
-            ReceivePointsVO vo = new ReceivePointsVO();
-            vo.setRecord(receivedRecord);
-            vo.setPoints(receivedRecord.getPointsAwarded());
-            vo.setContinuousDays(receivedRecord.getContinuousDays());
-            
-            return R.ok().put("data", vo);
-        } catch (BaseException e) {
-            return R.error(e.getMessage());
+                ReceivePointsVO vo = new ReceivePointsVO();
+                vo.setRecord(receivedRecord);
+                vo.setPoints(receivedRecord.getPointsAwarded());
+                vo.setContinuousDays(receivedRecord.getContinuousDays());
+                
+                return R.ok().put("data", vo);
+            } catch (BaseException e) {
+                return R.error(e.getMessage());
+            } catch (Exception e) {
+                logger.error("领取积分失败,liveId: {}, userId: {}", liveId, userId, e);
+                return R.error("领取失败: " + e.getMessage());
+            } finally {
+                // 释放锁
+                if (lock.isHeldByCurrentThread()) {
+                    lock.unlock();
+                    logger.debug("领取积分锁已释放,liveId: {}, userId: {}", liveId, userId);
+                }
+            }
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            logger.error("获取领取积分锁被中断,liveId: {}, userId: {}", liveId, userId, e);
+            return R.error("系统繁忙,请稍后重试");
         } catch (Exception e) {
+            logger.error("领取积分异常,liveId: {}, userId: {}", liveId, userId, e);
             return R.error("领取失败: " + e.getMessage());
         }
     }