|
|
|
@@ -10,7 +10,6 @@ import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.IdWorker; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.domain.vo.WxCouponCVo; |
|
|
|
import com.iformall.domain.vo.WxCouponChannelVo; |
|
|
|
import com.iformall.enums.EnumCouponChannelStatus; |
|
|
|
import com.iformall.enums.EnumCouponChannelType; |
|
|
|
@@ -25,15 +24,11 @@ import com.iformall.service.*; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.data.redis.core.ValueOperations; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class WxGameServiceImpl implements WxGameService { |
|
|
|
@@ -63,10 +58,6 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
@Autowired |
|
|
|
private QrCodeService qrCodeService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Qualifier("couponDetailRedisTemplate") |
|
|
|
RedisTemplate<String, WxCouponCVo> cdRedisTemplate; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageInfo<WxGame> listAsPage(WxGame record, Integer pageIndex, Integer pageSize) { |
|
|
|
PageInfo<WxGame> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxGameMapper.findList(record)); |
|
|
|
@@ -185,7 +176,6 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
// get game's coupon |
|
|
|
List couponIdsList = new ArrayList(); |
|
|
|
JSONArray couponChannelIds = JSON.parseArray(record.getCouponIds()); |
|
|
|
ValueOperations<String, WxCouponCVo> operations = cdRedisTemplate.opsForValue(); |
|
|
|
for(int i=0; i<couponChannelIds.size();i++) { |
|
|
|
JSONObject couponChanObj = (JSONObject) couponChannelIds.get(i); |
|
|
|
Long couponId = couponChanObj.getLong("couponId"); |
|
|
|
@@ -194,14 +184,6 @@ public class WxGameServiceImpl implements WxGameService { |
|
|
|
if (couponChannelVo != null) { |
|
|
|
couponChannelVo.setGameWeight(couponChanObj.getInteger("weight")); |
|
|
|
couponIdsList.add(couponChannelVo); |
|
|
|
String key = "cc:" + couponChannelVo.getId(); |
|
|
|
if (!cdRedisTemplate.hasKey(key)) { |
|
|
|
WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelVo.getId()); |
|
|
|
if(Objects.nonNull(couponCVo)) { |
|
|
|
// 插入缓存 |
|
|
|
operations.set(key, couponCVo, 3600, TimeUnit.SECONDS); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|