|
|
|
@@ -4,6 +4,7 @@ import java.lang.reflect.InvocationTargetException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
@@ -380,36 +381,39 @@ public class WxCouponController extends BaseController { |
|
|
|
|
|
|
|
Map<String,List<String>> labelCityMap = CouponCacheUtils.getCouponMerchantLableMapCache(redisTemplate, couponChannel.getCouponId()); |
|
|
|
if (null == labelCityMap) { |
|
|
|
Map<String,List<WxMerchantVo>> couponMerchantMap = getCouponMerchant(couponChannel, null); |
|
|
|
Map<String,List<WxMerchantVo>> couponMerchantMap = getCouponMerchant(couponChannel, null,false); |
|
|
|
if (null != couponMerchantMap) { |
|
|
|
List<WxMerchantVo> merchantVoList = couponMerchantMap.get(couponChannel.getCouponId()); |
|
|
|
if (null != merchantVoList ) { |
|
|
|
Map<String,String> cityLableMap = sysGaoDeService.getAllCityLabelMap(); |
|
|
|
//A-list,B-list |
|
|
|
labelCityMap = new HashMap<String,List<String>>(); |
|
|
|
for (int i = 0 ; i< merchantVoList.size(); i++) { |
|
|
|
WxMerchantVo mv = merchantVoList.get(i); |
|
|
|
if (StringUtils.isNotBlank(mv.getCity())){ |
|
|
|
String cityLable = cityLableMap.get(mv.getCity()); |
|
|
|
if (StringUtils.isNotBlank(cityLable)) { |
|
|
|
List<String> list = labelCityMap.get(cityLable); |
|
|
|
if (null == list) { |
|
|
|
list = new ArrayList<String>(); |
|
|
|
list.add(mv.getCity()); |
|
|
|
labelCityMap.put(cityLable, list); |
|
|
|
}else { |
|
|
|
if (!list.contains(mv.getCity())) { |
|
|
|
list.add(mv.getCity()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (labelCityMap.size() > 0 ) { |
|
|
|
CouponCacheUtils.setCouponMerchantLableMapCache(redisTemplate, couponChannel.getCouponId(), labelCityMap); |
|
|
|
} |
|
|
|
Map<String,String> cityLableMap = sysGaoDeService.getAllCityLabelMap(); |
|
|
|
for (Iterator<String> it = couponMerchantMap.keySet().iterator();it.hasNext();) { |
|
|
|
String mallKey = it.next(); |
|
|
|
List<WxMerchantVo> merchantVoList = couponMerchantMap.get(mallKey); |
|
|
|
if (null != merchantVoList ) { |
|
|
|
//A-list,B-list |
|
|
|
labelCityMap = new HashMap<String,List<String>>(); |
|
|
|
for (int i = 0 ; i< merchantVoList.size(); i++) { |
|
|
|
WxMerchantVo mv = merchantVoList.get(i); |
|
|
|
if (StringUtils.isNotBlank(mv.getCity())){ |
|
|
|
String cityLable = cityLableMap.get(mv.getCity()); |
|
|
|
if (StringUtils.isNotBlank(cityLable)) { |
|
|
|
List<String> list = labelCityMap.get(cityLable); |
|
|
|
if (null == list) { |
|
|
|
list = new ArrayList<String>(); |
|
|
|
list.add(mv.getCity()); |
|
|
|
labelCityMap.put(cityLable, list); |
|
|
|
}else { |
|
|
|
if (!list.contains(mv.getCity())) { |
|
|
|
list.add(mv.getCity()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (labelCityMap.size() > 0 ) { |
|
|
|
CouponCacheUtils.setCouponMerchantLableMapCache(redisTemplate, couponChannel.getCouponId(), labelCityMap); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(labelCityMap); |
|
|
|
@@ -452,19 +456,24 @@ public class WxCouponController extends BaseController { |
|
|
|
CouponCacheUtils.setCouponChannelCache(redisTemplate, couponChannelIdL, couponChannel); |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(getCouponMerchant(couponChannel, city)); |
|
|
|
return new ResultData(getCouponMerchant(couponChannel, city,true)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private Map<String,List<WxMerchantVo>> getCouponMerchant(WxCouponChannel couponChannel,String city) { |
|
|
|
Map<String,List<WxMerchantVo>> volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponChannel.getCouponId(),city); |
|
|
|
if (null == volist) { |
|
|
|
volist = couponService.getCouponMerchantList(getTenantInfo(), couponChannel.getCouponId(),city); |
|
|
|
if (null != volist && volist.size() > 0 ) { |
|
|
|
CouponCacheUtils.setCouponMerchantCache(redisTemplate, couponChannel.getCouponId(),city, volist); |
|
|
|
private Map<String,List<WxMerchantVo>> getCouponMerchant(WxCouponChannel couponChannel,String city,boolean queryCache) { |
|
|
|
if (queryCache) { |
|
|
|
Map<String,List<WxMerchantVo>> volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponChannel.getCouponId(),city); |
|
|
|
if (null == volist) { |
|
|
|
volist = couponService.getCouponMerchantList(getTenantInfo(), couponChannel.getCouponId(),city); |
|
|
|
if (null != volist && volist.size() > 0 ) { |
|
|
|
CouponCacheUtils.setCouponMerchantCache(redisTemplate, couponChannel.getCouponId(),city, volist); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return volist; |
|
|
|
return volist; |
|
|
|
}else { |
|
|
|
return couponService.getCouponMerchantList(getTenantInfo(), couponChannel.getCouponId(),city); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@TenantIgnore |
|
|
|
|