|
|
@@ -16,9 +16,11 @@ import com.cyksj.service.relation.GroupRelationFrontService;
|
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
|
import com.cyksj.service.vip.CmsVipUserService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 项目名: yhlxj2
|
|
|
@@ -28,6 +30,7 @@ import java.util.List;
|
|
|
*/
|
|
|
@Service
|
|
|
@RequiredArgsConstructor
|
|
|
+@Slf4j
|
|
|
public class CmsVipUserServiceImpl implements CmsVipUserService {
|
|
|
private final VipUserMapper vipUserMapper;
|
|
|
|
|
|
@@ -69,16 +72,16 @@ public class CmsVipUserServiceImpl implements CmsVipUserService {
|
|
|
vipUserMapper.updateById(vipUser);
|
|
|
}
|
|
|
//发送车票
|
|
|
- List<VipGoodsSku> skus = vipGoodsSkuMapper.selectList(null);
|
|
|
+ List<VipGoodsSku> skus = vipGoodsSkuMapper.selectUpSkus();
|
|
|
for (VipGoodsSku sku : skus) {
|
|
|
//未有抵扣 直接发送会员车票
|
|
|
groupRelationFrontService.getTicket(userId, sku.getSkuId(), Boolean.TRUE);
|
|
|
}
|
|
|
//同步时间
|
|
|
- groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
|
- .set(GroupsRelation::getExpiryTime, vipUser.getExpiryTime())
|
|
|
- .in(GroupsRelation::getUserId, userIdList)
|
|
|
- .eq(GroupsRelation::getIsVip, Boolean.TRUE));
|
|
|
+ List<Long> vipSkuIds = skus.stream().map(VipGoodsSku::getSkuId).collect(Collectors.toList());
|
|
|
+ Integer update = groupsRelationMapper.updateUserVipSkusExpiryTime(userIdList, vipSkuIds, vipUser.getExpiryTime());
|
|
|
+ log.info("后台开通uid;{}镜像会员,更新会员{}张车票时长成功", vipUser.getUserId(), update);
|
|
|
+
|
|
|
//操作记录
|
|
|
VipUserOperateLog vipUserOperateLog = new VipUserOperateLog();
|
|
|
vipUserOperateLog.setUserId(userId);
|
|
|
@@ -102,11 +105,10 @@ public class CmsVipUserServiceImpl implements CmsVipUserService {
|
|
|
vipUser.setExpiryTime(DateUtil.offsetDay(vipUser.getExpiryTime(), days));
|
|
|
vipUserMapper.updateById(vipUser);
|
|
|
|
|
|
- //同步时间
|
|
|
- groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
|
- .set(GroupsRelation::getExpiryTime, vipUser.getExpiryTime())
|
|
|
- .in(GroupsRelation::getUserId, userIdList)
|
|
|
- .eq(GroupsRelation::getIsVip, Boolean.TRUE));
|
|
|
+ //更新会员车票
|
|
|
+ List<Long> vipSkuIds = vipGoodsSkuMapper.selectUpSkus().stream().map(VipGoodsSku::getSkuId).collect(Collectors.toList());
|
|
|
+ Integer update = groupsRelationMapper.updateUserVipSkusExpiryTime(userIdList, vipSkuIds, vipUser.getExpiryTime());
|
|
|
+ log.info("后台uid;{}镜像会员延长或扣除,更新会员{}张车票时长成功", vipUser.getUserId(), update);
|
|
|
|
|
|
//操作记录
|
|
|
VipUserOperateLog vipUserOperateLog = new VipUserOperateLog();
|