|
|
@@ -2,7 +2,6 @@ package com.ylx.massage.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ylx.common.core.domain.model.WxLoginUser;
|
|
|
import com.ylx.common.exception.ServiceException;
|
|
|
@@ -10,23 +9,23 @@ import com.ylx.common.utils.StringUtils;
|
|
|
import com.ylx.lottery.domain.LotteryCountLog;
|
|
|
import com.ylx.lottery.domain.vo.LocalActivityTableVO;
|
|
|
import com.ylx.lottery.domain.vo.LotteryActivityVO;
|
|
|
-import com.ylx.lottery.domain.vo.LotteryStatVO;
|
|
|
import com.ylx.lottery.service.LotteryCountLogService;
|
|
|
import com.ylx.lottery.service.LotteryCountService;
|
|
|
import com.ylx.massage.domain.CommentUserAudit;
|
|
|
-import com.ylx.massage.domain.TComment;
|
|
|
+import com.ylx.massage.domain.TCommentUser;
|
|
|
import com.ylx.massage.domain.TOrder;
|
|
|
import com.ylx.massage.enums.OrderStatusEnum;
|
|
|
import com.ylx.massage.mapper.TCommentUserMapper;
|
|
|
-import com.ylx.massage.domain.TCommentUser;
|
|
|
import com.ylx.massage.service.TCommentUserAuditService;
|
|
|
import com.ylx.massage.service.TCommentUserService;
|
|
|
import com.ylx.massage.service.TOrderService;
|
|
|
+import com.ylx.usercenter.domain.dto.UnifiedUserCenterDTO;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.time.LocalDateTime;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -36,6 +35,7 @@ import java.util.List;
|
|
|
* @author makejava
|
|
|
* @since 2024-08-08 10:32:08
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service("tCommentUserService")
|
|
|
public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCommentUser> implements TCommentUserService {
|
|
|
|
|
|
@@ -100,6 +100,8 @@ public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCo
|
|
|
boolean bool = orderService.updateById(order);
|
|
|
if (bool) {
|
|
|
|
|
|
+ Integer isBind = wxLoginUser.getIsBind();
|
|
|
+ String localLiveUserId = wxLoginUser.getLocalLiveUserId();
|
|
|
// 评价有礼
|
|
|
List<LotteryActivityVO> lotteryActivityVOS = lotteryCountService.queryActivityRules();
|
|
|
if (CollUtil.isNotEmpty(lotteryActivityVOS)) {
|
|
|
@@ -159,6 +161,15 @@ public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCo
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // todo 事务问题 当前用户绑定一账通
|
|
|
+ if (ObjectUtil.isNotNull(isBind) && (ObjectUtil.equals(isBind, 1) && ObjectUtil.isNotNull(localLiveUserId))) {
|
|
|
+ // 同步抽奖次数(异步处理)
|
|
|
+ UnifiedUserCenterDTO dto = new UnifiedUserCenterDTO();
|
|
|
+ dto.setTargetUserId(localLiveUserId);
|
|
|
+ dto.setSourceUserId(wxLoginUser.getId());
|
|
|
+ syncLotteryCount(dto);
|
|
|
+ }
|
|
|
}
|
|
|
return bool;
|
|
|
}
|
|
|
@@ -168,5 +179,24 @@ public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCo
|
|
|
public List<TCommentUser> selectAll(TCommentUser tCommentUser) {
|
|
|
return tCommentUserMapper.selectAll(tCommentUser);
|
|
|
}
|
|
|
+
|
|
|
+ // 异步同步抽奖次数
|
|
|
+ @Async
|
|
|
+ public void syncLotteryCount(UnifiedUserCenterDTO dto) {
|
|
|
+ try {
|
|
|
+ boolean lotteryCountBool = this.lotteryCountService.batchAdd(dto);
|
|
|
+ if (lotteryCountBool) {
|
|
|
+ log.info("同步用户抽奖次数到本地生活服务成功, userId:{}", dto.getTargetUserId());
|
|
|
+ } else {
|
|
|
+ log.warn("同步用户抽奖次数到本地生活服务失败, userId:{}", dto.getTargetUserId());
|
|
|
+ // 同步失败,记录告警日志
|
|
|
+ log.error("【告警】同步用户抽奖次数到本地生活服务失败,需要人工处理, userId:{}", dto.getTargetUserId());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("同步用户抽奖次数到本地生活服务异常, userId:{}", dto.getTargetUserId(), e);
|
|
|
+ // 异常情况,记录告警日志
|
|
|
+ log.error("【告警】同步用户抽奖次数到本地生活服务异常,需要人工处理, userId:{}", dto.getTargetUserId(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|