From 0b72d1a849c444e1d44cb87438b301e2967ac59f Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Sat, 2 Nov 2019 10:44:02 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=9B=86=E5=9B=A2=E7=89=88][=E4=BF=AE?= =?UTF-8?q?=E6=94=B9]:=E9=9B=86=E5=9B=A2=E7=89=88=E9=A2=84=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxCouponServiceImpl.java | 9 +++++---- .../impl/WxCuserFloatingLayerServiceImpl.java | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 2f814d506..4a061c652 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -12,6 +12,7 @@ import com.iformall.common.ResultData; import com.iformall.domain.dto.WxCouponMerchantDto; import com.iformall.domain.po.*; import com.iformall.domain.po.base.BaseEntity; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxCouponCVo; import com.iformall.domain.vo.WxCouponChannelVo; import com.iformall.domain.vo.WxCouponStatisVo; @@ -438,18 +439,18 @@ import java.util.stream.Collectors; } //清空缓存 - clearCache(record.getTenantId()); + clearCache(record); return new ResultData(record.getId()); } /** * 清除c端首页券列表缓存 - * @param tenantId + * @param tenantEntity */ - public void clearCache(String tenantId){ + public void clearCache(TenantEntity tenantEntity){ for (int i = 1; i <=5 ; i++) { - String key = EnumCacheKey.C_INDEX_PAGE_LIST.getMessage() +tenantId+"_" + i + ":"; + String key = EnumCacheKey.C_INDEX_PAGE_LIST.getMessage() +tenantEntity.getTenantId()+"_" + i + ":"; cdRedisTemplate.delete(key); } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java index 2961c80c0..8e46e6795 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java @@ -2,10 +2,13 @@ package com.iformall.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iformall.common.IdWorker; +import com.iformall.domain.po.WxAppinfo; import com.iformall.domain.po.WxCUser; import com.iformall.domain.po.WxCuserFloatingLayer; import com.iformall.domain.po.WxFloatingLayer; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.enums.EnumFloatingLayerStatus; +import com.iformall.mapper.WxAppinfoMapper; import com.iformall.mapper.WxCUserMapper; import com.iformall.mapper.WxCuserFloatingLayerMapper; import com.iformall.mapper.WxFloatingLayerMapper; @@ -24,6 +27,9 @@ import java.util.Date; public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + @Autowired + WxAppinfoMapper appinfoMapper; + @Autowired WxCuserFloatingLayerMapper wxCuserFloatingLayerMapper; @@ -41,9 +47,9 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ user.setOpenId(openId); user.setAppId(appId); WxCUser byOpenId = wxCUserMapper.findByOpenId(user); - String tenantId = byOpenId.getTenantId(); if (byOpenId == null) { - return getWxFloatingLayer(tenantId); + WxAppinfo appinfo = appinfoMapper.findByAppId(appId); + return getWxFloatingLayer(appinfo.getTenantInfo()); } //2 用户存在 查看是否已有弹出记录 没有 保存记录后返回浮层信息 WxCuserFloatingLayer wxCuserFloatingLayerQuery = new WxCuserFloatingLayer(); @@ -51,7 +57,7 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ WxCuserFloatingLayer wxCuserFloatingLayer = wxCuserFloatingLayerMapper.selectOne(new QueryWrapper<>(wxCuserFloatingLayerQuery)); if (wxCuserFloatingLayer == null) { saveCuserFloatingLayer(byOpenId); - return getWxFloatingLayer(tenantId); + return getWxFloatingLayer(byOpenId); } return null; } @@ -62,14 +68,14 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ final IdWorker idWorker = IdWorker.get(); wxCuserFloatingLayer.setId(idWorker.nextId()); wxCuserFloatingLayer.setUserId(wxCUser.getId()); - wxCuserFloatingLayer.setTenantId(wxCUser.getTenantId()); + wxCuserFloatingLayer.updateTenantInfo(wxCUser); wxCuserFloatingLayer.setCreateTime(new Date()); wxCuserFloatingLayerMapper.insert(wxCuserFloatingLayer); } - public WxFloatingLayer getWxFloatingLayer(String tenantId) { + public WxFloatingLayer getWxFloatingLayer(TenantEntity tenantEntity) { WxFloatingLayer wxFloatingLayer = new WxFloatingLayer(); - wxFloatingLayer.setTenantId(tenantId); + wxFloatingLayer.updateTenantInfo(tenantEntity); wxFloatingLayer.setStatus(EnumFloatingLayerStatus.STATUS_THROW_IN.getCode()); return wxFloatingLayerMapper.selectOne(new QueryWrapper<>(wxFloatingLayer)); }