|
|
|
@@ -2,6 +2,7 @@ package com.iformall.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.github.binarywang.wxpay.bean.bank.BankingResult; |
|
|
|
import com.iformall.domain.po.TtGoodsCategory; |
|
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
|
import com.iformall.domain.po.base.BaseEntity; |
|
|
|
@@ -16,12 +17,15 @@ import com.iformall.mapper.TtGoodsCategoryMapper; |
|
|
|
import com.iformall.service.TtGoodsCategoryService; |
|
|
|
import com.iformall.service.TtMerchantPoiService; |
|
|
|
import com.iformall.utils.DateUtils; |
|
|
|
import com.iformall.utils.RedisCacheUtils; |
|
|
|
import com.microsoft.schemas.vml.STExt; |
|
|
|
import me.chanjar.weixin.common.error.WxErrorException; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
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.scheduling.annotation.Async; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@@ -39,6 +43,10 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { |
|
|
|
@Autowired |
|
|
|
private TtMerchantPoiService ttMerchantPoiService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Qualifier("objectCommonRedisTemplate") |
|
|
|
RedisTemplate<String, Object> categoryRedisTemplate; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TtGoodsCategory> findTreeList() { |
|
|
|
TtGoodsCategory record = new TtGoodsCategory(); |
|
|
|
@@ -478,9 +486,17 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<GoodsCategory> categoryGet(Integer categoryId) { |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(null); |
|
|
|
String key = "goods_category:"+categoryId; |
|
|
|
List<GoodsCategory> cacheListObject = RedisCacheUtils.getCacheListObject(categoryRedisTemplate, key, GoodsCategory.class); |
|
|
|
if(cacheListObject != null && cacheListObject.size() > 0){ |
|
|
|
return cacheListObject; |
|
|
|
} |
|
|
|
try { |
|
|
|
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(null); |
|
|
|
List<GoodsCategory> goodsCategories = ttWebService.getGoodsService().categoryGet(categoryId, null); |
|
|
|
if(goodsCategories != null && goodsCategories.size() > 0){ |
|
|
|
RedisCacheUtils.cache(categoryRedisTemplate,key,goodsCategories,24*3600); |
|
|
|
} |
|
|
|
return goodsCategories; |
|
|
|
} catch (WxErrorException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
|