|
|
|
@@ -5,6 +5,9 @@ import java.util.*; |
|
|
|
|
|
|
|
import cn.binarywang.wx.miniapp.api.WxMaService; |
|
|
|
import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitTrend; |
|
|
|
import com.iformall.domain.po.WxMall; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.service.WxMallService; |
|
|
|
import com.iformall.service.wechat.FmOpenService; |
|
|
|
import com.iformall.utils.MaUtil; |
|
|
|
import me.chanjar.weixin.common.error.WxErrorException; |
|
|
|
@@ -38,6 +41,9 @@ public class WxAppVisitSchedule { |
|
|
|
@Autowired |
|
|
|
private FmOpenService openService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxMallService wxMallService; |
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 9/1 * * ? ") //早晨9点开始每小时取一次,获取前一日,微信时间为GMT |
|
|
|
public void daliyVisitRetrive() { |
|
|
|
@@ -47,9 +53,16 @@ public class WxAppVisitSchedule { |
|
|
|
appInfoQ.setType(EnumAppType.C.getCode()); |
|
|
|
List<WxAppinfo> apps = WxAppinfoService.getList(appInfoQ); |
|
|
|
for(WxAppinfo app:apps) { |
|
|
|
if(StringUtils.isBlank(app.getAppId())||StringUtils.isBlank(app.getSecret())) { |
|
|
|
if(StringUtils.isBlank(app.getAppId())||StringUtils.isBlank(app.getSecret())||StringUtils.isBlank(app.getTenantId())) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
TenantEntity TenantEntity = new TenantEntity(){{ |
|
|
|
setTenantId(app.getTenantId()); |
|
|
|
}}; |
|
|
|
WxMall byTenantInfo = wxMallService.getByTenantInfo(TenantEntity); |
|
|
|
if(byTenantInfo != null && StringUtils.isNotBlank(byTenantInfo.getParentTenantId())){ |
|
|
|
app.setParentTenantId(byTenantInfo.getParentTenantId()); |
|
|
|
} |
|
|
|
Calendar c = Calendar.getInstance(); |
|
|
|
c.add(Calendar.DAY_OF_YEAR, -1); |
|
|
|
Date lastDate = c.getTime(); |
|
|
|
@@ -72,9 +85,16 @@ public class WxAppVisitSchedule { |
|
|
|
appInfo.setType(EnumAppType.C.getCode()); |
|
|
|
List<WxAppinfo> apps = WxAppinfoService.getList(appInfo); |
|
|
|
for(WxAppinfo appinfo :apps) { |
|
|
|
if(StringUtils.isBlank(appinfo.getAppId())||StringUtils.isBlank(appinfo.getSecret())) { |
|
|
|
if(StringUtils.isBlank(appinfo.getAppId())||StringUtils.isBlank(appinfo.getSecret())||StringUtils.isBlank(appinfo.getTenantId())) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
TenantEntity TenantEntity = new TenantEntity(){{ |
|
|
|
setTenantId(appinfo.getTenantId()); |
|
|
|
}}; |
|
|
|
WxMall byTenantInfo = wxMallService.getByTenantInfo(TenantEntity); |
|
|
|
if(byTenantInfo != null && StringUtils.isNotBlank(byTenantInfo.getParentTenantId())){ |
|
|
|
appinfo.setParentTenantId(byTenantInfo.getParentTenantId()); |
|
|
|
} |
|
|
|
Calendar c = Calendar.getInstance(); |
|
|
|
String date; |
|
|
|
for(int i = 2;i <=7;i++) { //查找最近7天有没有漏掉的数据 |
|
|
|
|