|
|
@@ -26,8 +26,11 @@ import com.cyksj.mapper.mirrorshop.UserMirrorShopMapper;
|
|
|
import com.cyksj.mapper.renew.RenewUpgradePackageMapper;
|
|
|
import com.cyksj.mapper.sys.SysConfigMapper;
|
|
|
import com.cyksj.mapper.sys.SysEmailMapper;
|
|
|
+import com.cyksj.mapper.vip.VipGoodsSkuMapper;
|
|
|
+import com.cyksj.mapper.vip.VipUserMapper;
|
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.manage.views.AccountView;
|
|
|
+import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
import com.cyksj.model.request.SpecialGoodsTicketReq;
|
|
|
import com.cyksj.model.request.TicketLoginReq;
|
|
|
import com.cyksj.model.views.*;
|
|
|
@@ -171,6 +174,12 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
|
|
|
private final MirrorTicketPopupsRecordMapper mirrorTicketPopupsRecordMapper;
|
|
|
|
|
|
+ private final VipUserMapper vipUserMapper;
|
|
|
+
|
|
|
+ private final GroupRelationFrontService groupRelationFrontService;
|
|
|
+
|
|
|
+ private final VipGoodsSkuMapper vipGoodsSkuMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId, String account, String orderNo, Integer cmt) {
|
|
|
User u = userMapper.selectById(userId);
|
|
|
@@ -1362,6 +1371,37 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void getVipMirrorTicketIfEmpty(long userId, Long skuId) {
|
|
|
+ Integer selectCount = vipGoodsSkuMapper.selectCount(Wrappers.lambdaQuery(VipGoodsSku.class)
|
|
|
+ .eq(VipGoodsSku::getSkuId, skuId));
|
|
|
+ if (selectCount == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
+ VipUser vipUser = vipUserMapper.selectOne(Wrappers.lambdaQuery(VipUser.class)
|
|
|
+ .in(VipUser::getUserId, userIdList)
|
|
|
+ .gt(VipUser::getExpiryTime, DateTime.now())
|
|
|
+ .last("limit 1"));
|
|
|
+ //不是会员 或已到期
|
|
|
+ if (vipUser == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Number number = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder()
|
|
|
+ .field(GroupsRelationView::getUserId, userIdList).op(Operator.InList)
|
|
|
+ .field(GroupsRelationView::getSkuId, skuId)
|
|
|
+ .field(GroupsRelationView::getIsVip, Boolean.TRUE)
|
|
|
+ .build());
|
|
|
+ if (number.intValue() == 0) {
|
|
|
+ Long relationId = groupRelationFrontService.getTicket(vipUser.getUserId(), skuId, Boolean.TRUE);
|
|
|
+ //同步时间
|
|
|
+ groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
|
+ .set(GroupsRelation::getExpiryTime, vipUser.getExpiryTime())
|
|
|
+ .eq(GroupsRelation::getUserId, vipUser.getUserId())
|
|
|
+ .eq(GroupsRelation::getId, relationId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private DistributePosterGoodsDetailView setGoodsPoster(RenewalView ticket, User user, List<Long> userIds) {
|
|
|
DistributePosterGoodsDetailView distributePosterGoodsDetailView = beanSearcher.searchFirst(DistributePosterGoodsDetailView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
.field(DistributePosterGoodsFrontView::getGoodsId, ticket.getGoodsId()).build());
|