admin
2020-09-24 ca1ad791b7b7b04e57db6bd4fb93f0c1066a9f99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.yeshi.fanli.job;
 
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.common.Config;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.util.StringUtil;
import org.springframework.stereotype.Component;
import org.yeshi.utils.AppMarketUtil;
 
import javax.annotation.Resource;
 
@Component
public class AdJob {
 
    @Resource
    private AppVersionService appVersionService;
 
    @Resource
    private ConfigService configService;
 
    @XxlJob("adjob-watchHWAppMarket")
    public ReturnT<String> watchHWAppMarket(String param) throws Exception {
        //查询目前的线上版本
        String version = AppMarketUtil.getHWLatestVersion("100513147");
        if (!StringUtil.isNullOrEmpty(version)) {
            AppVersionInfo appVersionInfo = appVersionService.getByPlatformAndVersion("android", version, SystemEnum.blks);
            if (appVersionInfo != null) {
                appVersionInfo.getId();
                Config config = configService.getConfig(ConfigKeyEnum.huaweiOnLineVersionCode.getKey(), SystemEnum.blks);
                if (appVersionInfo.getVersionCode() == Integer.parseInt(config.getValue())) {
                    //广告控制提升版本
                    config.setValue((Integer.parseInt(config.getValue()) + 1) + "");
                    configService.update(config);
                }
            }
        }
        return ReturnT.SUCCESS;
    }
}