ÎļþÃû´Ó server/visits/dmvisit_web/src/main/java/com/doumee/api/ScheduleTool.java ÐÞ¸Ä |
| | |
| | | package com.doumee.api; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.HttpsUtil; |
| | | import com.doumee.core.wx.WXConstant; |
| | | import com.doumee.dao.system.model.SystemDictData; |
| | | import com.doumee.service.business.impl.hksync.HkSyncVisitServiceImpl; |
| | | import com.doumee.service.business.impl.hksync.fhk.HkSyncVisitFromHKServiceImpl; |
| | | import com.doumee.service.system.SystemDictDataService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.utils.URIBuilder; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.util.EntityUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.mgt.DefaultSecurityManager; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.URI; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡ |
| | | * @author jiangping |
| | | * @date 2021-10-10 14:40:35 |
| | | * https://www.bejson.com/othertools/cron/ cron 表达å¼çæå°å |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/11/30 15:33 |
| | | */ |
| | | //@Component |
| | | //@EnableScheduling |
| | | @Slf4j |
| | | public class ScheduleTool { |
| | | |
| | | @Api(tags = "微信token宿¶å¨æ¥å£") |
| | | @RestController |
| | | @RequestMapping("/timer/wxtoken") |
| | | public class WxTokenTimerController extends BaseController { |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | |
| | | */ |
| | | @Value("${debug_model}") |
| | | private Boolean timing; |
| | | |
| | | /** |
| | | * æ´æ°å¾®ä¿¡å
¬ä¼å· ACCESS_TOKEN |
| | | * @throws Exception |
| | | */ |
| | | @Scheduled(fixedDelay=1000 * 60 * 90) |
| | | public void updAccessToken(){ |
| | | @ApiOperation("å¼å¯å®æ¶æ´æ°å¾®ä¿¡å
¬ä¼å·accesstoken") |
| | | @GetMapping("/updateWxAccessToken") |
| | | public ApiResponse updateWxAccessToken() { |
| | | DefaultSecurityManager securityManager = new DefaultSecurityManager(); |
| | | SecurityUtils.setSecurityManager(securityManager); |
| | | |
| | |
| | | systemDictData.setCode(json.getString("access_token")); |
| | | systemDictData.setUpdateTime(new Date()); |
| | | systemDictDataService.updateById(systemDictData); |
| | | log.info(" æ´æ°å¾®ä¿¡å
¬ä¼å· ACCESS_TOKEN =========> " + systemDictData.getCode() ); |
| | | } |
| | | return ApiResponse.success("å¼å¯å®æ¶æ´æ°å¾®ä¿¡å
¬ä¼å·accesstokenæå"); |
| | | } |
| | | |
| | | |