|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.HKConstants; | 
|---|
|  |  |  | import com.doumee.core.haikang.model.param.BaseResponse; | 
|---|
|  |  |  | import com.doumee.core.haikang.service.HKService; | 
|---|
|  |  |  | import com.doumee.service.business.third.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 io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | 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.Scheduled; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("开启定时更新微信公众号accesstoken") | 
|---|
|  |  |  | @GetMapping("/updateWxAccessToken") | 
|---|
|  |  |  | public ApiResponse updateWxAccessToken() { | 
|---|
|  |  |  | DefaultSecurityManager securityManager = new DefaultSecurityManager(); | 
|---|
|  |  |  | DefaultSecurityManager securityManager = new DefaultSecurityManager(); | 
|---|
|  |  |  | SecurityUtils.setSecurityManager(securityManager); | 
|---|
|  |  |  | String token =null; | 
|---|
|  |  |  | BaseResponse<String> result = HKService.wxAccessToken(systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_WXTOKEN_CONFIGID).getCode(),systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_WXTOKEN_TAGID).getCode()); | 
|---|
|  |  |  | if(StringUtils.equals(result.getCode(), HKConstants.RESPONSE_SUCCEE) ){ | 
|---|
|  |  |  | token= result.getData(); | 
|---|
|  |  |  | SystemDictData systemDictData =  systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN); | 
|---|
|  |  |  | if(!Objects.isNull(systemDictData)){ | 
|---|
|  |  |  | systemDictData.setCode(token); | 
|---|
|  |  |  | systemDictData.setUpdateTime(new Date()); | 
|---|
|  |  |  | systemDictDataService.updateById(systemDictData); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | return ApiResponse.success("开启定时更新微信公众号accesstoken失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ApiResponse.success("开启定时更新微信公众号accesstoken成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("开启定时更新微信公众号accesstoken") | 
|---|
|  |  |  | @GetMapping("/updateWxAccessTokenOrigin") | 
|---|
|  |  |  | public ApiResponse updateWxAccessTokenOrigin() { | 
|---|
|  |  |  | DefaultSecurityManager securityManager = new DefaultSecurityManager(); | 
|---|
|  |  |  | SecurityUtils.setSecurityManager(securityManager); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String appId = systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_APPID).getCode(); | 
|---|