|
|
@@ -3333,35 +3333,37 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
if (orderDon.getGoodsId() == Constant.CLAUDE_CODE_GOODS_ID) {
|
|
|
try {
|
|
|
ClaudeCodeDeductOrderRelate claudeCodeDeductOrderRelate = claudeCodeDeductOrderRelateMapper.selectOne(Wrappers.lambdaQuery(ClaudeCodeDeductOrderRelate.class).eq(ClaudeCodeDeductOrderRelate::getOrderId, orderDon.getId()));
|
|
|
- Long relationId = claudeCodeDeductOrderRelate.getRelationId();
|
|
|
- //清除旧的cc车票
|
|
|
- GroupsRelation oldRelation = groupsRelationMapper.selectById(relationId);
|
|
|
- Long relationUserId = oldRelation.getUserId();
|
|
|
- groupRelationClearService.clearTicket(oldRelation, UserTicketClearedRecord.Source.cc_deduct);
|
|
|
- //生成新规格车票
|
|
|
- Long skuId = orderDon.getSkuId();
|
|
|
- Long newRelationId = groupRelationFrontService.getTicket(relationUserId, skuId, Boolean.FALSE);
|
|
|
- GroupsRelation newRelation = groupsRelationMapper.selectById(newRelationId);
|
|
|
- ClaudeCodeUser claudeCodeUser = claudeCodeUserMapper.selectOne(Wrappers.lambdaQuery(ClaudeCodeUser.class).eq(ClaudeCodeUser::getRelationId, relationId).last("limit 1"));
|
|
|
- //同步用户cc的 车票id
|
|
|
- if (claudeCodeUser != null) {
|
|
|
- claudeCodeUser.setRelationId(newRelationId);
|
|
|
- claudeCodeUser.setRenewSkuId(null);
|
|
|
- claudeCodeUser.setRenewOrderId(null);
|
|
|
- claudeCodeUser.setRenewExpiryTime(null);
|
|
|
- claudeCodeUserMapper.updateById(claudeCodeUser);
|
|
|
- //同步套餐
|
|
|
- claudeCodeService.updateClaudeCodeUserPackageInfo(claudeCodeUser, newRelation.getExpiryTime(), sku);
|
|
|
- }
|
|
|
- claudeCodeDeductOrderRelate.setNewRelationId(newRelationId);
|
|
|
- claudeCodeDeductOrderRelateMapper.updateById(claudeCodeDeductOrderRelate);
|
|
|
- if (claudeCodeDeductOrderRelate.getExtendsDays() != null && claudeCodeDeductOrderRelate.getExtendsDays() > 0) {
|
|
|
- newRelation.setExpiryTime(DateUtil.offsetDay(newRelation.getExpiryTime(), claudeCodeDeductOrderRelate.getExtendsDays()));
|
|
|
- groupsRelationMapper.updateById(newRelation);
|
|
|
+ if (claudeCodeDeductOrderRelate != null) {
|
|
|
+ Long relationId = claudeCodeDeductOrderRelate.getRelationId();
|
|
|
+ //清除旧的cc车票
|
|
|
+ GroupsRelation oldRelation = groupsRelationMapper.selectById(relationId);
|
|
|
+ Long relationUserId = oldRelation.getUserId();
|
|
|
+ groupRelationClearService.clearTicket(oldRelation, UserTicketClearedRecord.Source.cc_deduct);
|
|
|
+ //生成新规格车票
|
|
|
+ Long skuId = orderDon.getSkuId();
|
|
|
+ Long newRelationId = groupRelationFrontService.getTicket(relationUserId, skuId, Boolean.FALSE);
|
|
|
+ GroupsRelation newRelation = groupsRelationMapper.selectById(newRelationId);
|
|
|
+ ClaudeCodeUser claudeCodeUser = claudeCodeUserMapper.selectOne(Wrappers.lambdaQuery(ClaudeCodeUser.class).eq(ClaudeCodeUser::getRelationId, relationId).last("limit 1"));
|
|
|
+ //同步用户cc的 车票id
|
|
|
+ if (claudeCodeUser != null) {
|
|
|
+ claudeCodeUser.setRelationId(newRelationId);
|
|
|
+ claudeCodeUser.setRenewSkuId(null);
|
|
|
+ claudeCodeUser.setRenewOrderId(null);
|
|
|
+ claudeCodeUser.setRenewExpiryTime(null);
|
|
|
+ claudeCodeUserMapper.updateById(claudeCodeUser);
|
|
|
+ //同步套餐
|
|
|
+ claudeCodeService.updateClaudeCodeUserPackageInfo(claudeCodeUser, newRelation.getExpiryTime(), sku);
|
|
|
+ }
|
|
|
+ claudeCodeDeductOrderRelate.setNewRelationId(newRelationId);
|
|
|
+ claudeCodeDeductOrderRelateMapper.updateById(claudeCodeDeductOrderRelate);
|
|
|
+ if (claudeCodeDeductOrderRelate.getExtendsDays() != null && claudeCodeDeductOrderRelate.getExtendsDays() > 0) {
|
|
|
+ newRelation.setExpiryTime(DateUtil.offsetDay(newRelation.getExpiryTime(), claudeCodeDeductOrderRelate.getExtendsDays()));
|
|
|
+ groupsRelationMapper.updateById(newRelation);
|
|
|
+ }
|
|
|
+ //将订单车票id同步成新规格车票id
|
|
|
+ orderDon.setRelationId(newRelationId);
|
|
|
+ orderDonMapper.updateById(orderDon);
|
|
|
}
|
|
|
- //将订单车票id同步成新规格车票id
|
|
|
- orderDon.setRelationId(newRelationId);
|
|
|
- orderDonMapper.updateById(orderDon);
|
|
|
} catch (Exception e) {
|
|
|
log.error("订单回调,cc抵扣升级报错:{}", StringUtil.getErrorText(e));
|
|
|
}
|