Helius
2022-05-27 4351e71d782741143a98f86f6648acd16689165f
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
package com.matrix.system.shopXcx.quartz;
 
import com.matrix.core.tools.LogUtil;
import com.matrix.system.shopXcx.api.tools.WxShopOrderUtil;
import com.matrix.system.shopXcx.bean.ShopDeliveryInfo;
import com.matrix.system.shopXcx.bean.ShopOrder;
import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao;
import com.matrix.system.shopXcx.dao.ShopOrderDao;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * @author wlz
 * 15天自动确认收货定时任务
 */
@Configuration
public class ShopAutomaticReceiveQuartz {
 
    @Autowired
    private ShopDeliveryInfoDao shopDeliveryInfoDao;
 
    @Autowired
    private ShopOrderDao shopOrderDao;
 
    @Autowired
    private WxShopOrderUtil wxShopOrderUtil;
 
    @Scheduled(cron = "0/30 * * * * ?")
    public void executeExt() {
 
 
            LogUtil.info("#15天自动收货任务处理#");
 
            List<ShopDeliveryInfo> shopDeliveryInfos = shopDeliveryInfoDao.selectAutomaticReceive();
            int flag = 0;
            if (CollectionUtils.isNotEmpty(shopDeliveryInfos)) {
                for (ShopDeliveryInfo info : shopDeliveryInfos) {
                    Map<String, Object> modifyMap = new HashMap<>();
                    modifyMap.put("id", info.getOrderId());
                    modifyMap.put("orderStatus", ShopOrder.ORDER_STATUS_WAIT_REMARK);
                    int i = shopOrderDao.updateByMap(modifyMap);
                    if (i > 0) {
                        flag++;
                    }
                }
            }
            LogUtil.info("自动确认收货更新条数:" + flag);
 
    }
 
}