Просмотр исходного кода

触达用户数

release_toaliyun_real
xhxu 5 лет назад
Родитель
Сommit
7751f075ad
2 измененных файлов: 26 добавлений и 3 удалений
  1. +4
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java
  2. +22
    -2
      mallinkSchedule/src/main/java/com/iformall/schedule/WxAppVisitSchedule.java

+ 4
- 1
mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java Просмотреть файл

@@ -553,7 +553,10 @@ public class WxProjectConfigController extends BaseController {
if(StringUtils.isBlank(wxMall.getParentTenantId())){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
WxMall parentWxMall = wxMallService.getById(Long.parseLong(wxMall.getParentTenantId()));
TenantEntity TenantEntity = new TenantEntity(){{
setTenantId(wxMall.getParentTenantId());
}};
WxMall parentWxMall = wxMallService.getByTenantInfo(TenantEntity);
if(parentWxMall == null || parentWxMall.getSaleType() != 100
|| !parentWxMall.equals(EnumGroupSupport.SUPPORT.getCode())
|| StringUtils.isNotBlank(parentWxMall.getParentTenantId())){


+ 22
- 2
mallinkSchedule/src/main/java/com/iformall/schedule/WxAppVisitSchedule.java Просмотреть файл

@@ -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天有没有漏掉的数据


Загрузка…
Отмена
Сохранить