|
@@ -23,14 +23,19 @@ import com.cyksj.mapper.manage.exchange.ExchangeCodeMapper;
|
|
|
import com.cyksj.mapper.market.draw.LuckyDrawRecordMapper;
|
|
import com.cyksj.mapper.market.draw.LuckyDrawRecordMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.excel.ExcelExchangeCodeData;
|
|
import com.cyksj.model.excel.ExcelExchangeCodeData;
|
|
|
|
|
+import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
import com.cyksj.model.request.ExchangeCodeReq;
|
|
import com.cyksj.model.request.ExchangeCodeReq;
|
|
|
import com.cyksj.model.request.ExchangeCodeTicket;
|
|
import com.cyksj.model.request.ExchangeCodeTicket;
|
|
|
import com.cyksj.redis.RedisService;
|
|
import com.cyksj.redis.RedisService;
|
|
|
|
|
+import com.cyksj.service.claude.ClaudeCodeService;
|
|
|
import com.cyksj.service.exchange.ExchangeCodeService;
|
|
import com.cyksj.service.exchange.ExchangeCodeService;
|
|
|
import com.cyksj.service.relation.GroupRelationFrontService;
|
|
import com.cyksj.service.relation.GroupRelationFrontService;
|
|
|
import com.cyksj.service.relation.GroupsRelationExpiryRecordService;
|
|
import com.cyksj.service.relation.GroupsRelationExpiryRecordService;
|
|
|
import com.cyksj.service.shop.YhShopFrontService;
|
|
import com.cyksj.service.shop.YhShopFrontService;
|
|
|
|
|
+import com.cyksj.service.user.UserBindRelationService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
|
|
+import com.ejlchina.searcher.param.Operator;
|
|
|
|
|
+import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -92,6 +97,12 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
|
|
|
|
|
|
|
|
private final UserDistributeExchangeCodeUseRecordMapper userDistributeExchangeCodeUseRecordMapper;
|
|
private final UserDistributeExchangeCodeUseRecordMapper userDistributeExchangeCodeUseRecordMapper;
|
|
|
|
|
|
|
|
|
|
+ private final UserBindRelationService userBindRelationService;
|
|
|
|
|
+
|
|
|
|
|
+ private final ClaudeCodeUserMapper claudeCodeUserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final ClaudeCodeService claudeCodeService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
|
public List<ExcelExchangeCodeData> createExchangeCode(ExchangeCodeReq exchangeCodeReq) throws Exception {
|
|
public List<ExcelExchangeCodeData> createExchangeCode(ExchangeCodeReq exchangeCodeReq) throws Exception {
|
|
@@ -379,6 +390,11 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
|
|
|
orderDon.setPayTitle(payTitle.toString());
|
|
orderDon.setPayTitle(payTitle.toString());
|
|
|
orderDonMapper.insert(orderDon);
|
|
orderDonMapper.insert(orderDon);
|
|
|
log.info("用户{}兑换规格:{}车位成功", user.getId(), orderDon.getSkuId());
|
|
log.info("用户{}兑换规格:{}车位成功", user.getId(), orderDon.getSkuId());
|
|
|
|
|
+
|
|
|
|
|
+ if (relation.getIsClaudeCodeUpgrade() != null && relation.getIsClaudeCodeUpgrade()) {
|
|
|
|
|
+ //claude code 是否升级
|
|
|
|
|
+ claudeCodeService.handleClaudeCodeUserPackageSku(relation, sku, orderDon.getId());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
if (orderDonTye == OrderDon.Type.EX_CODE) {
|
|
if (orderDonTye == OrderDon.Type.EX_CODE) {
|
|
|
//同步车票是否重购 记录
|
|
//同步车票是否重购 记录
|
|
@@ -406,6 +422,25 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public GroupsRelation getRelationNoOrder(GoodsDonSku sku, Long userId, Long yhsId) {
|
|
public GroupsRelation getRelationNoOrder(GoodsDonSku sku, Long userId, Long yhsId) {
|
|
|
|
|
+ //claude code商品兑换 只能兑换一次 后续兑换增加车票时长
|
|
|
|
|
+ if (sku.getGoodsId() == Constant.CLAUDE_CODE_GOODS_ID) {
|
|
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
|
|
+ GroupsRelationView groupsRelationView = beanSearcher.searchFirst(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getUserId, userIdList).op(Operator.InList).field(GroupsRelationView::getGoodsId, Constant.CLAUDE_CODE_GOODS_ID).field(GroupsRelationView::getExpiryTime, DateTime.now()).op(Operator.GreaterThan).build());
|
|
|
|
|
+ if (groupsRelationView != null) {
|
|
|
|
|
+// Date expiryTime = groupsRelationView.getExpiryTime();
|
|
|
|
|
+// if (sku.getDays() != null) {
|
|
|
|
|
+// expiryTime = DateUtil.offsetDay(expiryTime, sku.getDays());
|
|
|
|
|
+// } else {
|
|
|
|
|
+// expiryTime = DateUtil.offsetMonth(expiryTime, sku.getMonths());
|
|
|
|
|
+// }
|
|
|
|
|
+// GroupsRelation relation = groupsRelationMapper.selectById(groupsRelationView.getId());
|
|
|
|
|
+// relation.setExpiryTime(expiryTime);
|
|
|
|
|
+// groupsRelationMapper.updateById(relation);
|
|
|
|
|
+// relation.setIsClaudeCodeUpgrade(true);
|
|
|
|
|
+// return relation;
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("您当前已有车票,暂时无法兑换");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
Integer retryNum = 1;
|
|
Integer retryNum = 1;
|
|
|
List<Long> errorsRelationIds = new ArrayList<>();
|
|
List<Long> errorsRelationIds = new ArrayList<>();
|
|
|
GroupsRelation relation = getFinalRelation(sku, userId, retryNum, yhsId, errorsRelationIds);
|
|
GroupsRelation relation = getFinalRelation(sku, userId, retryNum, yhsId, errorsRelationIds);
|