KKSU
2025-03-18 664184af3e070dee665ee736caffa0297804975f
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package cc.mrbird.febs.mall.quartz;
 
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
 
@Slf4j
@Component
@ConditionalOnProperty(prefix = "system", name = "job", havingValue = "true")
public class WxxcxJob {
 
//    private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class);
//
//    @Autowired
//    private RedisUtils redisUtils;
//    @Autowired
//    private MallMemberCouponMapper mallMemberCouponMapper;
//    @Autowired
//    private MallInvoiceService mallInvoiceService;
//    @Resource
//    RestTemplate restTemplate;
////    @Autowired
////    private SpringContextHolder springContextHolder;
//    /**
//     * 获取access_token
//     * 有效期两小时
//     */
////    @Scheduled(cron = "0 0 0/1 * * ? ")
////    public void getAccessToken() throws IOException {
////        log.info("执行access_token刷新");
////        String appId = xcxProperties.getXcxAppid();
////        String appSecret = xcxProperties.getXcxSecret();
////        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
////        String jsonStr = restTemplate.getForObject(url, String.class);
////
////        /**
////         * 返回结果
////         * {"access_token":"ACCESS_TOKEN","expires_in":7200}
////         */
////        if (!jsonStr.contains("access_token")) {
////            System.out.println("获取微信access_token失败");
////        }
////
////        String accessTokenKey = WechatConfigure.WX_ACCESS_TOKEN_REDIS_KEY;
////        JSONObject jsonObject = JSONObject.parseObject(jsonStr);
////        String accessToken = jsonObject.getString(accessTokenKey);
////        if (StrUtil.isEmpty(accessToken)) {
////            log.error("获取access token失败: {}" , jsonObject.getString("errmsg"));
////            throw new ApiException("获取access token失败");
////        } else {
////            log.info("wx access_token : {}",accessToken);
////            redisUtils.set(accessTokenKey,accessToken);
////        }
////
////    }
//
//    @Scheduled(cron = "0 0 0/1 * * ? ")
//    public void expireCoupon() {
//        List<MallMemberCoupon> mallMemberCoupons = mallMemberCouponMapper.selectListByExpireTime(DateUtil.date());
//        if(CollUtil.isEmpty(mallMemberCoupons)){
//            return;
//        }
//        for(MallMemberCoupon mallMemberCoupon : mallMemberCoupons){
//            mallMemberCoupon.setState(3);
//            mallMemberCouponMapper.updateById(mallMemberCoupon);
//        }
//
//    }
//
////    /**
////     * 更新发票记录表数据
////     * 定时,每天凌晨一点
////     * 已完成的订单,更新到发票记录中
////     */
////    @Scheduled(cron = "0 0 1 * * ?")
////    public void mallInvoiceJob() {
////        mallInvoiceService.mallInvoiceJob();
////    }
 
}