|  |  | 
 |  |  | package com.doumee.cloud.openapi; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.doumee.api.BaseController; | 
 |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
 |  |  | import com.doumee.config.annotation.LoginNoRequired; | 
 |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
 |  |  | import com.doumee.core.exception.BusinessException; | 
 |  |  | import com.doumee.core.model.ApiResponse; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.core.utils.DESUtil; | 
 |  |  | import com.doumee.core.wms.model.response.WmsBaseResponse; | 
 |  |  | import com.doumee.dao.openapi.request.*; | 
 |  |  | import com.doumee.dao.openapi.response.*; | 
 |  |  | import com.doumee.dao.system.model.SystemUser; | 
 |  |  | 
 |  |  | import com.doumee.service.system.SystemUserService; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.apache.commons.lang3.StringUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.data.redis.core.RedisTemplate; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import java.io.UnsupportedEncodingException; | 
 |  |  | import java.net.URLDecoder; | 
 |  |  | import java.net.URLEncoder; | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |  */ | 
 |  |  | @Api(tags = "提供安防平台对接接口(数据大屏基础数据等)") | 
 |  |  | @RestController | 
 |  |  | @Slf4j | 
 |  |  | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/hk/api") | 
 |  |  | public class HkOpenApiController extends BaseController { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private PlatformService platformService; | 
 |  |  |     @Autowired | 
 |  |  |     private InterfaceLogService interfaceLogService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private PlatformLogService platformLogService; | 
 |  |  | 
 |  |  |     @ApiOperation("token解析") | 
 |  |  |     @GetMapping("/water/decodeToken") | 
 |  |  |     public Map<String,Object> decodeToken(@RequestParam String token) { | 
 |  |  |         log.info("【安防平台单点登录token解析】================="+token); | 
 |  |  |         int success = Constants.ZERO; | 
 |  |  |         Map<String,Object>  result = new HashMap<>() ; | 
 |  |  |         try { | 
 |  |  |             token = URLDecoder.decode(token,"UTF-8"); | 
 |  |  |             HkBaseTokenRequest hkBaseTokenRequest = new HkBaseTokenRequest(); | 
 |  |  |             hkBaseTokenRequest.setToken(token); | 
 |  |  |             result = this.decodeTokenForHk(hkBaseTokenRequest); | 
 |  |  |         }catch (BusinessException e){ | 
 |  |  |             log.error("【安防平台】单点登录token解===失败:"+e.getMessage()); | 
 |  |  |             success = Constants.ONE; | 
 |  |  |         }catch (Exception e){ | 
 |  |  |  | 
 |  |  |             log.error("【安防平台】单点登录token解析===失败:"+e.getMessage()); | 
 |  |  |             e.printStackTrace(); | 
 |  |  |             success = Constants.ONE; | 
 |  |  |         }finally { | 
 |  |  |             interfaceLogService.saveInterfaceLog("/hk/api/water/decodeToken", "【安防平台】单点登录token解析",token, | 
 |  |  |                     success, JSONObject.toJSONString(result),Constants.ZERO); | 
 |  |  |         } | 
 |  |  |         HkBaseTokenRequest hkBaseTokenRequest = new HkBaseTokenRequest(); | 
 |  |  |         hkBaseTokenRequest.setToken(token); | 
 |  |  |         return this.decodeTokenForHk(hkBaseTokenRequest); | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public Map<String,Object> decodeTokenForHk(HkBaseTokenRequest hkBaseTokenRequest){ | 
 |  |  |     public Map<String,Object> decodeTokenForHk(HkBaseTokenRequest hkBaseTokenRequest)   { | 
 |  |  |         Map<String,Object> result = new HashMap<>(); | 
 |  |  |         result.put("code","0"); | 
 |  |  |         result.put("msg","success"); | 
 |  |  | 
 |  |  |             result.put("msg","token无效!"); | 
 |  |  |             return result; | 
 |  |  |         } | 
 |  |  |         String userName = DESUtil.verifyHkToken(hkBaseTokenRequest.getToken()); | 
 |  |  |         String userName = DESUtil.verifyHkToken( redisToken);; | 
 |  |  |         if(StringUtils.isBlank(userName)){ | 
 |  |  |             result.put("code","-1"); | 
 |  |  |             result.put("msg","token参数为空"); |