|
|
|
@@ -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)); |
|
|
|
} |
|
|
|
|