Kaynağa Gözat

fix 虚拟卡兑换保存座位id

zoujiajian 2 yıl önce
ebeveyn
işleme
d896baebaf

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GiftCardUserRecord.java

@@ -69,4 +69,9 @@ public class GiftCardUserRecord extends BaseEntity{
 	 * 背景图
 	 */
 	private String img;
+
+	/**
+	 * 座位id
+	 */
+	private Long relationId;
 }

+ 6 - 4
netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java

@@ -79,7 +79,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 
 	private final WxOpenPlatYHLXLoginConfig wxOpenPlatYHLXLoginConfig;
 
-	private final GiftCardUserRecordMapper GiftCardUserRecordMapper;
+	private final GiftCardUserRecordMapper giftCardUserRecordMapper;
 
 	private final ExchangeCodeService exchangeCodeService;
 
@@ -509,7 +509,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 	@Override
 	@Transactional(rollbackFor = Throwable.class)
 	public void receiveGiftCardByRc(Long userId, String code) {
-		GiftCardUserRecord giftCardUserRecord = GiftCardUserRecordMapper.selectOne(Wrappers.lambdaQuery(GiftCardUserRecord.class)
+		GiftCardUserRecord giftCardUserRecord = giftCardUserRecordMapper.selectOne(Wrappers.lambdaQuery(GiftCardUserRecord.class)
 				.eq(GiftCardUserRecord::getRc, code).last("limit 1"));
 		if (giftCardUserRecord == null) {
 			throw BusinessRuntimeException.getInstance("好友赠送礼品卡不存在");
@@ -527,7 +527,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 			throw BusinessRuntimeException.getInstance("您已领取该礼品卡");
 		}
 		giftCardUserRecord.setToUserId(userId);
-		int update = GiftCardUserRecordMapper.update(null, Wrappers.lambdaUpdate(GiftCardUserRecord.class)
+		int update = giftCardUserRecordMapper.update(null, Wrappers.lambdaUpdate(GiftCardUserRecord.class)
 				.set(giftCardUserRecord.getGcType() == 2, GiftCardUserRecord::getIsUsed, true)
 				.set(GiftCardUserRecord::getToUserId, userId)
 				.set(GiftCardUserRecord::getIsSend, true)
@@ -546,7 +546,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 					log.info("礼品卡id:{}虚拟车票skuId:{}不存在", giftCardUserRecord.getId(), gcSkuId);
 					throw BusinessRuntimeException.getInstance("该礼品卡对应的虚拟卡不存在,请联系客服");
 				}
-				exchangeCodeService.getRelationNoOrder(sku, userId);
+				GroupsRelation relationNoOrder = exchangeCodeService.getRelationNoOrder(sku, userId);
+				giftCardUserRecord.setRelationId(relationNoOrder.getId());
+				giftCardUserRecordMapper.updateById(giftCardUserRecord);
 				log.info("发送至用户userId:{}礼品卡虚拟车票结束", userId);
 			}
 		}