记得上下班打卡 | git大法好,push需谨慎

Commit b48c2bb2 authored by 胡佳晨's avatar 胡佳晨

订单 锁 添加

parent beaf5ec6
package com.liquidnet.service.kylin.utils;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.adam.constant.AdamRedisConst;
import com.liquidnet.service.adam.dto.vo.AdamAddressesVo;
import com.liquidnet.service.adam.dto.vo.AdamEntersVo;
import com.liquidnet.service.adam.dto.vo.AdamUserMemberVo;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketEntitiesVo;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -8,12 +14,15 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class OrderUtils {
@Autowired
private DataUtils dataUtils;
@Autowired
private RedisUtil redisUtil;
public String judgeOrderLimit(
int type,
......@@ -32,11 +41,11 @@ public class OrderUtils {
) {
Integer[] integers;
if (103 == type) {
integers=roadShowOrderLimit(userId,idCard,performanceId,ticketId,performanceBuyCount,ticketBuyCount,isTrueName);
integers = roadShowOrderLimit(userId, idCard, performanceId, ticketId, performanceBuyCount, ticketBuyCount, isTrueName);
} else {
integers=festivalOrderLimit(userId,idCard,performanceId,ticketId,performanceBuyCount,ticketBuyCount,isTrueName);
integers = festivalOrderLimit(userId, idCard, performanceId, ticketId, performanceBuyCount, ticketBuyCount, isTrueName);
}
return judgeMemberType(performanceLimitCount,performanceMemberLimitCount,ticketLimitCount,ticketMemberLimitCount,memberType,integers[0],integers[1]);
return judgeMemberType(performanceLimitCount, performanceMemberLimitCount, ticketLimitCount, ticketMemberLimitCount, memberType, integers[0], integers[1]);
}
public Integer[] roadShowOrderLimit(
......@@ -55,7 +64,7 @@ public class OrderUtils {
performanceBuyCount += dataUtils.getUserPBuyCount(userId, performanceId);
ticketBuyCount += dataUtils.getUserTBuyCount(userId, ticketId);
}
return new Integer[]{performanceBuyCount,ticketBuyCount};
return new Integer[]{performanceBuyCount, ticketBuyCount};
}
public Integer[] festivalOrderLimit(
......@@ -75,7 +84,7 @@ public class OrderUtils {
ticketBuyCount += dataUtils.getUserTBuyCount(userId, ticketId);
}
return new Integer[]{performanceBuyCount,ticketBuyCount};
return new Integer[]{performanceBuyCount, ticketBuyCount};
}
public String judgeMemberType(int performanceLimitCount, int performanceMemberLimitCount, int ticketLimitCount, int ticketMemberLimitCount, int memberType, int performanceBuyCount, int ticketBuyCount) {
......@@ -97,4 +106,21 @@ public class OrderUtils {
return "";
}
public boolean isMember(String uid) {
String rk = AdamRedisConst.INFO_USER_MEMBER.concat(uid);
AdamUserMemberVo vo = (AdamUserMemberVo) redisUtil.get(rk);
return null != vo && vo.isActive();
}
public AdamAddressesVo getAddress(String uid, String addressesId) {
String rk = AdamRedisConst.INFO_ADDRESSES.concat(uid);
List<AdamAddressesVo> vos = (List<AdamAddressesVo>) redisUtil.get(rk);
return vos.stream().filter(r -> r.getAddressesId().equals(addressesId)).findAny().orElse(null);
}
public AdamEntersVo getEnters(String uid, String entersId) {
String rk = AdamRedisConst.INFO_ENTERS.concat(uid);
List<AdamEntersVo> vos = (List<AdamEntersVo>) redisUtil.get(rk);
return vos.stream().filter(r -> r.getEntersId().equals(entersId)).findAny().orElse(null);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment