Browse Source

fix bug

release_toaliyun_real
lin 2 years ago
parent
commit
e4e727cd5b
2 changed files with 53 additions and 38 deletions
  1. +46
    -37
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java
  2. +7
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java

+ 46
- 37
mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java View File

@@ -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


+ 7
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java View File

@@ -1551,8 +1551,10 @@ public class WxMerchantServiceImpl implements WxMerchantService {
if (null != poiMerchantIds && poiMerchantIds.size() > 0 ){
//取交集
merchantIds = (List<Long>) CollectionUtils.intersection(poiMerchantIds, productMerchantIds);
}else {
merchantIds = productMerchantIds;
}
if (null == merchantIds) {
if (null == merchantIds || merchantIds.size() <= 0 ) {
return retMap;
}
@@ -1673,6 +1675,10 @@ public class WxMerchantServiceImpl implements WxMerchantService {
poiQ.setCity(city);
poiQ.updateTenantInfo(tenantEntity);
poiMerchantIds = ttMerchantPoiMapper.findIdList(poiQ);
if (null == poiMerchantIds || poiMerchantIds.size() <= 0 ) {
poiMerchantIds = new ArrayList<Long>();
poiMerchantIds.add(-1L);
}
}
Map<Long,List<WxMerchantVo>> couponMerchantVoList = findCouponMerchantVoList(couponIds,tenantEntity,poiMerchantIds,hasShop);


Loading…
Cancel
Save