| @@ -62,6 +62,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_question_oneself_topic", | |||
| "wx_question_oneself_user", | |||
| "sys_config", | |||
| "sys_gaode_city", | |||
| "wx_theme_mall", | |||
| "wx_miniapp_theme", | |||
| "wx_customize_module", | |||
| @@ -123,6 +124,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_question_oneself_topic", | |||
| "wx_question_oneself_user", | |||
| "sys_config", | |||
| "sys_gaode_city", | |||
| "wx_theme_mall", | |||
| "wx_miniapp_theme", | |||
| "wx_customize_module", | |||
| @@ -51,6 +51,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_msg_validationcode_model", | |||
| "wx_component_verify_ticket", | |||
| "sys_config", | |||
| "sys_gaode_city", | |||
| "wx_theme_mall", | |||
| "wx_miniapp_theme", | |||
| "wx_customize_module", | |||
| @@ -99,6 +100,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "mem_coupon_from_dsp", | |||
| "wx_component_verify_ticket", | |||
| "sys_config", | |||
| "sys_gaode_city", | |||
| "wx_theme_mall", | |||
| "wx_miniapp_theme", | |||
| "wx_customize_module", | |||
| @@ -0,0 +1,27 @@ | |||
| package com.iformall.controller; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.service.SysGaoDeService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| @RestController | |||
| @RequestMapping("api/sysGaode") | |||
| public class SysGaodeController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private SysGaoDeService sysGaoDeService; | |||
| @GetMapping("getAllCityLable") | |||
| public ResultData getAllCityLable() { | |||
| return new ResultData(sysGaoDeService.getAllCityLabelMap()); | |||
| } | |||
| } | |||
| @@ -41,6 +41,7 @@ import com.iformall.domain.vo.WxMerchantVo; | |||
| import com.iformall.enums.EnumCouponChannelActivityStatus; | |||
| import com.iformall.enums.EnumCouponChannelType; | |||
| import com.iformall.service.SysConfigService; | |||
| import com.iformall.service.SysGaoDeService; | |||
| import com.iformall.service.WxCouponChannelService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.WxMerchantService; | |||
| @@ -76,6 +77,9 @@ public class WxCouponController extends BaseController { | |||
| @Autowired | |||
| private SysConfigService sysConfigService; | |||
| @Autowired | |||
| private SysGaoDeService sysGaoDeService; | |||
| @ApiOperation("查询优惠券详情(系统发放卡没有couponChannel)") | |||
| @GetMapping("/couponInfo") | |||
| @ApiImplicitParams({ | |||
| @@ -340,12 +344,86 @@ public class WxCouponController extends BaseController { | |||
| return new ResultData(sb.toString()); | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("根据id(couponChannel)查询城市") | |||
| @GetMapping("/couponMerchantCity") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) | |||
| public ResultData couponMerchantCity(String couponChannelId) { | |||
| if ((StringUtils.isBlank(couponChannelId) || couponChannelId.equalsIgnoreCase(Constant.UNDEFINED)) | |||
| ) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); | |||
| } | |||
| Long couponChannelIdL = 0L; | |||
| try { | |||
| if (StringUtils.isNotBlank(couponChannelId) && !couponChannelId.equalsIgnoreCase(Constant.UNDEFINED)) { | |||
| couponChannelIdL = Long.valueOf(couponChannelId); | |||
| } | |||
| } catch (NumberFormatException e) { | |||
| logger.error("id转换失败" + couponChannelId); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + couponChannelId); | |||
| } | |||
| if(couponChannelIdL <= 0){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); | |||
| } | |||
| WxCouponChannel couponChannel = CouponCacheUtils.getCouponChannelCache(redisTemplate, couponChannelIdL); | |||
| if (null == couponChannel) { | |||
| couponChannel = wxCouponChannelService.getById(couponChannelIdL,this.getTenantInfo().getTenantId()); | |||
| if (null == couponChannel) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId无效" + couponChannelId); | |||
| } | |||
| CouponCacheUtils.setCouponChannelCache(redisTemplate, couponChannelIdL, couponChannel); | |||
| } | |||
| Map<String,List<String>> labelCityMap = CouponCacheUtils.getCouponMerchantLableMapCache(redisTemplate, couponChannel.getCouponId()); | |||
| if (null == labelCityMap) { | |||
| Map<String,List<WxMerchantVo>> couponMerchantMap = getCouponMerchant(couponChannel, null); | |||
| 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); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return new ResultData(labelCityMap); | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("根据id(couponChannel)查询商品商户接口") | |||
| @GetMapping("/couponMerchant") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) | |||
| public ResultData couponMerchant(String couponChannelId) { | |||
| @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "city", value = "city", dataType = "String", paramType = "query", required = false)}) | |||
| public ResultData couponMerchant(String couponChannelId,String city) { | |||
| if ((StringUtils.isBlank(couponChannelId) || couponChannelId.equalsIgnoreCase(Constant.UNDEFINED)) | |||
| ) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); | |||
| @@ -374,23 +452,28 @@ public class WxCouponController extends BaseController { | |||
| CouponCacheUtils.setCouponChannelCache(redisTemplate, couponChannelIdL, couponChannel); | |||
| } | |||
| Map<String,List<WxMerchantVo>> volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponChannel.getCouponId()); | |||
| return new ResultData(getCouponMerchant(couponChannel, city)); | |||
| } | |||
| 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()); | |||
| volist = couponService.getCouponMerchantList(getTenantInfo(), couponChannel.getCouponId(),city); | |||
| if (null != volist && volist.size() > 0 ) { | |||
| CouponCacheUtils.setCouponMerchantCache(redisTemplate, couponChannel.getCouponId(), volist); | |||
| CouponCacheUtils.setCouponMerchantCache(redisTemplate, couponChannel.getCouponId(),city, volist); | |||
| } | |||
| } | |||
| return new ResultData(volist); | |||
| return volist; | |||
| } | |||
| @TenantIgnore | |||
| @ApiOperation("根据couponId查询商品商户接口") | |||
| @GetMapping("/couponMerchantByCouponId") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "couponId", value = "couponId", dataType = "String", paramType = "query", required = true)}) | |||
| public ResultData couponMerchantByCouponId(String couponId) { | |||
| @ApiImplicitParam(name = "couponId", value = "couponId", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "city", value = "city", dataType = "String", paramType = "query", required = false)}) | |||
| public ResultData couponMerchantByCouponId(String couponId,String city) { | |||
| if ((StringUtils.isBlank(couponId) || couponId.equalsIgnoreCase(Constant.UNDEFINED)) | |||
| ) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponId为空"); | |||
| @@ -410,11 +493,11 @@ public class WxCouponController extends BaseController { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponId为空"); | |||
| } | |||
| Map<String,List<WxMerchantVo>> volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponIdL); | |||
| Map<String,List<WxMerchantVo>> volist = CouponCacheUtils.getCouponMerchantCache(redisTemplate, couponIdL,city); | |||
| if (null == volist) { | |||
| volist = couponService.getCouponMerchantList(getTenantInfo(), couponIdL); | |||
| volist = couponService.getCouponMerchantList(getTenantInfo(), couponIdL,city); | |||
| if (null != volist && volist.size() > 0 ) { | |||
| CouponCacheUtils.setCouponMerchantCache(redisTemplate, couponIdL, volist); | |||
| CouponCacheUtils.setCouponMerchantCache(redisTemplate, couponIdL,city, volist); | |||
| } | |||
| } | |||
| return new ResultData(volist); | |||
| @@ -56,6 +56,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_question_oneself_topic", | |||
| "wx_question_oneself_user", | |||
| "sys_config", | |||
| "sys_gaode_city", | |||
| "wx_theme_mall", | |||
| "wx_miniapp_theme", | |||
| "wx_customize_module", | |||
| @@ -112,6 +113,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_question_oneself_topic", | |||
| "wx_question_oneself_user", | |||
| "sys_config", | |||
| "sys_gaode_city", | |||
| "wx_theme_mall", | |||
| "wx_miniapp_theme", | |||
| "wx_customize_module", | |||
| @@ -56,6 +56,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_question_oneself_topic", | |||
| "wx_question_oneself_user", | |||
| "sys_config", | |||
| "sys_gaode_city", | |||
| "wx_theme_mall", | |||
| "wx_miniapp_theme", | |||
| "wx_customize_module", | |||
| @@ -112,6 +113,7 @@ public class TenantInfoImpl implements TenantInfo { | |||
| "wx_question_oneself_topic", | |||
| "wx_question_oneself_user", | |||
| "sys_config", | |||
| "sys_gaode_city", | |||
| "wx_theme_mall", | |||
| "wx_miniapp_theme", | |||
| "wx_customize_module", | |||
| @@ -0,0 +1,31 @@ | |||
| package com.iformall.domain.po; | |||
| import java.util.Date; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| @TableName(value = "sys_gaode_city") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class SysGaodeCity extends BaseEntity { | |||
| private static final long serialVersionUID = 1L; | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="名称",name="name") | |||
| private String name; | |||
| @io.swagger.annotations.ApiModelProperty(value="标签",name="label") | |||
| private String label; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="",name="updateDate") | |||
| private Date updateDate; | |||
| @io.swagger.annotations.ApiModelProperty(value="是否隐藏",name="isHide") | |||
| private Integer isHide; | |||
| @io.swagger.annotations.ApiModelProperty(value="0-有效 1-无效",name="status") | |||
| private Integer status; | |||
| } | |||
| @@ -0,0 +1,12 @@ | |||
| package com.iformall.mapper; | |||
| import java.util.*; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.SysGaodeCity; | |||
| public interface SysGaodeCityMapper extends CommonMapper<SysGaodeCity, Long> { | |||
| List<SysGaodeCity> findList(SysGaodeCity sysGaodeCity); | |||
| } | |||
| @@ -0,0 +1,15 @@ | |||
| package com.iformall.service; | |||
| import java.util.Map; | |||
| public interface SysGaoDeService { | |||
| /** | |||
| * 根据实体查询列表 | |||
| * | |||
| * @param record | |||
| * @return | |||
| */ | |||
| Map<String,String> getAllCityLabelMap(); | |||
| } | |||
| @@ -277,7 +277,7 @@ public interface WxCouponService { | |||
| Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity); | |||
| Map<String,List<WxMerchantVo>> getCouponMerchantList(TenantEntity tenantInfo, Long couponId); | |||
| Map<String,List<WxMerchantVo>> getCouponMerchantList(TenantEntity tenantInfo, Long couponId,String city); | |||
| /** | |||
| * 作废卷 | |||
| @@ -175,7 +175,7 @@ public interface WxMerchantService { | |||
| PageInfo<WxMerchant> listVoAsPage(WxMerchant wxMerchant, Integer pageNum, Integer pageSize,boolean hasRentContractInfo); | |||
| List<WxMerchantVo> findMerchantVoList(Long couponId,TenantEntity tenantEntity,boolean hasShop); | |||
| List<WxMerchantVo> findMerchantVoList(Long couponId,String city,TenantEntity tenantEntity,boolean hasShop); | |||
| Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity tenantEntity,boolean hasShop); | |||
| Map<Long,String> getLiveCouponMerchantMap(List<Long> couponIds,TenantEntity tenantEntity); | |||
| @@ -0,0 +1,45 @@ | |||
| package com.iformall.service.impl; | |||
| import java.util.*; | |||
| import com.iformall.domain.po.SysGaodeCity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumDelStatus; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.mapper.SysGaodeCityMapper; | |||
| import com.iformall.service.SysGaoDeService; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class SysGaoDeServiceImpl implements SysGaoDeService { | |||
| @Autowired | |||
| SysGaodeCityMapper sysGaodeCityMapper; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> baseRedisTemplate; | |||
| @Override | |||
| public Map<String,String> getAllCityLabelMap() { | |||
| String key = "sysGaodeCityMap"; | |||
| Map<String,String> cacheMap = RedisCacheUtils.getCacheMap(baseRedisTemplate, key); | |||
| if (null == cacheMap) { | |||
| SysGaodeCity sgc = new SysGaodeCity(); | |||
| sgc.setIsHide(EnumYesOrNo.NO.getCode()); | |||
| sgc.setStatus(EnumDelStatus.NOT_DEL.getCode()); | |||
| List<SysGaodeCity> sgcList = sysGaodeCityMapper.findList(sgc); | |||
| if (null != sgcList && sgcList.size() > 0 ) { | |||
| cacheMap = new HashMap<String,String>(); | |||
| for (int i = 0 ; i < sgcList.size(); i++) { | |||
| SysGaodeCity _sgc = sgcList.get(i); | |||
| cacheMap.put(_sgc.getName(), _sgc.getLabel()); | |||
| } | |||
| RedisCacheUtils.cache(baseRedisTemplate, key, cacheMap, 3600*24*3); | |||
| } | |||
| } | |||
| return cacheMap; | |||
| } | |||
| } | |||
| @@ -399,7 +399,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| if (null != couponMallList && couponMallList.size()> 0 ) { | |||
| for (WxCouponMall cm:couponMallList) { | |||
| WxMall mall = wxMallMapper.getByTenantId(cm.getMallTenantId()); | |||
| List<WxMerchantVo> couponMerchantList = getCouponMerchantList(couponId, mall); | |||
| List<WxMerchantVo> couponMerchantList = getCouponMerchantList(couponId,null, mall); | |||
| if(couponMerchantList != null && couponMerchantList.size() > 0){ | |||
| merchantVoList.addAll(couponMerchantList); | |||
| } | |||
| @@ -408,10 +408,10 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| return merchantVoList; | |||
| //子广场查券 只查询自己广场的门店 | |||
| }else{ | |||
| return getCouponMerchantList(couponId,mallTenant); | |||
| return getCouponMerchantList(couponId,null,mallTenant); | |||
| } | |||
| }else{ | |||
| return getCouponMerchantList(couponId,couponTenant); | |||
| return getCouponMerchantList(couponId,null,couponTenant); | |||
| } | |||
| } | |||
| @@ -1757,7 +1757,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| @Override | |||
| public Map<String,List<WxMerchantVo>> getCouponMerchantList(TenantEntity tenantInfo, Long couponId) { | |||
| public Map<String,List<WxMerchantVo>> getCouponMerchantList(TenantEntity tenantInfo, Long couponId,String city) { | |||
| WxCoupon wxCoupon = wxCouponMapper.selectById(couponId,tenantInfo.getTenantId()); | |||
| if (EnumCouponType.isParentCoupon(wxCoupon.getType())){ | |||
| WxCouponMall couponMall = new WxCouponMall(); | |||
| @@ -1770,7 +1770,11 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| for (int i = 0 ; i < couponMallList.size();i++) { | |||
| WxCouponMall cm = couponMallList.get(i); | |||
| WxMall mall = wxMallMapper.getByTenantId(cm.getMallTenantId()); | |||
| mallMerchantMap.put(mall.getTenantId()+"|"+mall.getName(), getCouponMerchantList(couponId,mall)); | |||
| if (StringUtils.isBlank(city)) { | |||
| mallMerchantMap.put(mall.getTenantId()+"|"+mall.getName(), getCouponMerchantList(couponId,null,mall)); | |||
| }else { | |||
| mallMerchantMap.put(mall.getTenantId()+"|"+mall.getName() + "|" +city, getCouponMerchantList(couponId,city,mall)); | |||
| } | |||
| } | |||
| return mallMerchantMap; | |||
| } | |||
| @@ -1778,17 +1782,18 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| }else { | |||
| Map<String,List<WxMerchantVo>> mallMerchantMap = new HashMap<String,List<WxMerchantVo>>(); | |||
| WxMall mall = wxMallMapper.getByTenantId(tenantInfo.getTenantId()); | |||
| mallMerchantMap.put(mall.getTenantId()+"|"+mall.getName(), getCouponMerchantList(couponId,mall)); | |||
| if (StringUtils.isBlank(city)) { | |||
| mallMerchantMap.put(mall.getTenantId()+"|"+mall.getName(), getCouponMerchantList(couponId,null,mall)); | |||
| }else { | |||
| mallMerchantMap.put(mall.getTenantId()+"|"+mall.getName()+ "|" + city, getCouponMerchantList(couponId,city,mall)); | |||
| } | |||
| return mallMerchantMap; | |||
| } | |||
| } | |||
| private List<WxMerchantVo> getCouponMerchantList(Long couponId,TenantEntity mallTenantEntity) { | |||
| List<Long> couponIdList = new ArrayList<Long>(); | |||
| couponIdList.add(couponId); | |||
| Map<Long, List<WxMerchantVo>> couponMerchantVoMap = wxMerchantService.findCouponMerchantVoList(couponIdList, mallTenantEntity,true); | |||
| private List<WxMerchantVo> getCouponMerchantList(Long couponId,String city,TenantEntity mallTenantEntity) { | |||
| List<WxMerchantVo> merchantList = wxMerchantService.findMerchantVoList(couponId,city, mallTenantEntity,true); | |||
| List<WxMerchantVo> merchantList = couponMerchantVoMap.get(couponId); | |||
| if (merchantList != null) { | |||
| merchantList = merchantList.stream().sorted(Comparator.comparing(m -> m.getTtPoi(), Comparator.nullsLast(String::compareTo))).collect(toList()); | |||
| @@ -509,7 +509,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| couponIds.stream().filter(cid -> !isCouponMerchantValid(cid,wxCouponMerchant)).forEach(cid -> { | |||
| wxCouponService.disable(wxMerchant,cid, null); | |||
| CouponCacheUtils.removeCouponMerchantCache(redisTemplate, cid); | |||
| CouponCacheUtils.removeCouponMerchantCache(redisTemplate, cid,null); | |||
| }); | |||
| } | |||
| } | |||
| @@ -1519,14 +1519,20 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| @Override | |||
| public Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity mallTenantEntity,boolean hasShop) { | |||
| return findCouponMerchantVoList(couponIds, mallTenantEntity, null, hasShop); | |||
| } | |||
| private Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity mallTenantEntity,TtMerchantPoi poiQ,boolean hasShop) { | |||
| Map<Long,List<WxMerchantVo>> retMap = new HashMap<Long,List<WxMerchantVo>>(); | |||
| if (null == couponIds || couponIds.size() <= 0) { | |||
| return retMap; | |||
| } | |||
| List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(mallTenantEntity.getTenantId(), couponIds); | |||
| if(null != merchantIds && merchantIds.size() > 0 ) { | |||
| TtMerchantPoi poiQ = new TtMerchantPoi(); | |||
| poiQ.updateTenantInfo(mallTenantEntity); | |||
| if (null == poiQ) { | |||
| poiQ = new TtMerchantPoi(); | |||
| } | |||
| poiQ.updateTenantInfo(mallTenantEntity); | |||
| poiQ.setIds(merchantIds); | |||
| List<TtMerchantPoi> poiList = ttMerchantPoiMapper.findList(poiQ); | |||
| Map<Long,TtMerchantPoi> poiMap = new HashMap<Long,TtMerchantPoi>(); | |||
| @@ -1633,10 +1639,12 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| } | |||
| @Override | |||
| public List<WxMerchantVo> findMerchantVoList(Long couponId,TenantEntity tenantEntity,boolean hasShop) { | |||
| public List<WxMerchantVo> findMerchantVoList(Long couponId,String city,TenantEntity tenantEntity,boolean hasShop) { | |||
| List<Long> couponIds = new ArrayList<Long>(); | |||
| couponIds.add(couponId); | |||
| Map<Long,List<WxMerchantVo>> couponMerchantVoList = findCouponMerchantVoList(couponIds,tenantEntity,hasShop); | |||
| TtMerchantPoi poiQ = new TtMerchantPoi(); | |||
| poiQ.setCity(city); | |||
| Map<Long,List<WxMerchantVo>> couponMerchantVoList = findCouponMerchantVoList(couponIds,tenantEntity,poiQ,hasShop); | |||
| if (null != couponMerchantVoList) { | |||
| return couponMerchantVoList.get(couponId); | |||
| } | |||
| @@ -61,21 +61,57 @@ public class CouponCacheUtils { | |||
| return RedisCacheUtils.getCacheObject(template, key,WxCoupon.class); | |||
| } | |||
| public static void removeCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId) { | |||
| public static void removeCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId,String city) { | |||
| String key = "couponMerchantNew:"+couponId; | |||
| if (StringUtils.isNotBlank(city)) { | |||
| key = key + ":"+city; | |||
| } | |||
| RedisCacheUtils.removeCache(template, key); | |||
| if (StringUtils.isBlank(city)) { | |||
| //删除下面所有的cityKey | |||
| RedisCacheUtils.removeCachePrefix(template, key+":"); | |||
| //删除labelMap | |||
| removeCouponMerchantLableMapCache(template,couponId); | |||
| } | |||
| } | |||
| public static void setCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId,Map<String,List<WxMerchantVo>> merchantList) { | |||
| public static void setCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId,String city,Map<String,List<WxMerchantVo>> merchantList) { | |||
| String key = "couponMerchantNew:"+couponId; | |||
| if (StringUtils.isNotBlank(city)) { | |||
| key = key + ":"+city; | |||
| } | |||
| RedisCacheUtils.cache(template, key, merchantList, 24*3600); | |||
| if (StringUtils.isBlank(city)) { | |||
| //删除下面所有的cityKey | |||
| RedisCacheUtils.removeCachePrefix(template, key+":"); | |||
| //删除labelMap | |||
| removeCouponMerchantLableMapCache(template,couponId); | |||
| } | |||
| } | |||
| public static Map<String,List<WxMerchantVo>> getCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId) { | |||
| public static Map<String,List<WxMerchantVo>> getCouponMerchantCache(RedisTemplate<String, Object> template,Long couponId,String city) { | |||
| String key = "couponMerchantNew:"+couponId; | |||
| if (StringUtils.isNotBlank(city)) { | |||
| key = key + ":"+city; | |||
| } | |||
| return (Map<String, List<WxMerchantVo>>) RedisCacheUtils.getCacheMap(template, key); | |||
| } | |||
| public static void removeCouponMerchantLableMapCache(RedisTemplate<String, Object> template,Long couponId) { | |||
| String key = "couponMerchantNewLableMap:"+couponId; | |||
| RedisCacheUtils.removeCache(template, key); | |||
| } | |||
| public static void setCouponMerchantLableMapCache(RedisTemplate<String, Object> template,Long couponId,Map<String,List<String>> labeCityList) { | |||
| String key = "couponMerchantNewLableMap:"+couponId; | |||
| RedisCacheUtils.cache(template, key, labeCityList, 24*3600); | |||
| } | |||
| public static Map<String,List<String>> getCouponMerchantLableMapCache(RedisTemplate<String, Object> template,Long couponId) { | |||
| String key = "couponMerchantNewLableMap:"+couponId; | |||
| return (Map<String, List<String>>) RedisCacheUtils.getCacheMap(template, key); | |||
| } | |||
| public static void removeDouyinLivePageCache(RedisTemplate<String, Object> template,String tenantId,Integer targetAd,Integer bussiness) { | |||
| String key = EnumCacheKey.DOUYIN_LIVE_PAGE_LIST.getMessage()+ tenantId+"_"; | |||
| if (null != targetAd) { | |||
| @@ -0,0 +1,46 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.SysGaodeCityMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.SysGaodeCity"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="label" jdbcType="VARCHAR" property="label" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="is_hide" jdbcType="INTEGER" property="isHide" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`name`,`label`,`create_date`,`update_date`,`is_hide`,`status` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` = #{name} | |||
| </if> | |||
| <if test=" null != isHide "> | |||
| and `is_hide` = #{isHide} | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.SysGaodeCity" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from sys_gaode_city | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||
| @@ -83,6 +83,10 @@ | |||
| <if test=" null != poiName and ''!= poiName "> | |||
| and `poi_name` like concat('%', #{poiName},'%') | |||
| </if> | |||
| <if test=" null != city and ''!= city "> | |||
| and `city` = #{city} | |||
| </if> | |||
| <if test=" null != merchantName and ''!= merchantName "> | |||
| and `merchant_name` like concat('%', #{merchantName},'%') | |||