jiangping
2023-12-20 13ac9c42bb22b980567313a9dff51d4a8d639bbc
server/platform/src/main/java/com/doumee/task/ScheduleTool.java
@@ -10,12 +10,10 @@
import com.doumee.core.wx.WxPayProperties;
import com.doumee.dao.business.model.Goodsorder;
import com.doumee.dao.system.model.SystemDictData;
import com.doumee.service.business.GoodsorderService;
import com.doumee.service.business.MemberRidesService;
import com.doumee.service.business.SitesService;
import com.doumee.service.business.WxBillService;
import com.doumee.service.business.*;
import com.doumee.service.system.SystemDictDataService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.util.ThreadContext;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.beans.factory.annotation.Autowired;
@@ -41,6 +39,8 @@
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private RefundService refundService;
    @Autowired
    private SystemDictDataService systemDictDataService;
@@ -70,12 +70,11 @@
     * 測試
     * @throws Exception
     */
    @Scheduled(cron = "0 0 21 * * ? ")
    @Scheduled(cron = "0 30 13 * * ? ")
    public void getYesterdayBill() throws Exception {
        log.info("=====================开始每天自动结算=======================");
        goodsorderService.autoCloseOrder();
        log.info("=====================结束每天自动结算=======================");
    }
    /**
@@ -115,6 +114,11 @@
        ThreadContext.bind(manager);
        String appId = wxPayProperties.getAppId();
        String appSecret = wxPayProperties.getAppSecret();
        if(wxPayProperties.getExistsSub() ==1){
            //如果是服务商支付,取子商户信息
             appId = StringUtils.trimToNull(wxPayProperties.getSubAppId());
            appSecret =StringUtils.trimToNull(wxPayProperties.getSubAppSecret());
        }
        //生成微信token
        String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+appId+"&secret="+appSecret;
        String response = HttpsUtil.doGet(url,null);
@@ -126,6 +130,15 @@
            systemDictDataService.updateById(systemDictData);
        }
    }
    /**
     * 更新微信 ACCESS_TOKEN
     */
    @Scheduled(fixedDelay = 1000L * 60L )
    public void autoCancelRefunOrder(){
        log.info("=====================开始 自動取消未推送退款状态的退款单状态=======================");
        goodsorderService.autoCancelRefunOrder();;
        log.info("=====================结束 自動取消未推送退款状态的退款单状态=======================");
    }
}