|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<PageData<News>> newsPage (@RequestBody PageWrap<News> pageWrap) { | 
|---|
|  |  |  | pageWrap.getModel().setIsPublish(Constants.ONE); | 
|---|
|  |  |  | pageWrap.getModel().setStatus(Constants.ZERO); | 
|---|
|  |  |  | return ApiResponse.success(newsService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return  ApiResponse.success(zbomCRMService.getCrmGoUrl(this.getLoginUserInfo().getIamUsername(),type)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat(lockTime = 2000) | 
|---|
|  |  |  | @ApiOperation(value = "生成小程序码", notes = "PAD端") | 
|---|
|  |  |  | @PostMapping("/getQrCode") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "sign", value = "签名(使用timestamp+appkey进行md5加密)", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "Long", name = "timestamp", value = "时间戳(当前时间毫秒,2小时内有效)", required = true), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public void getQrCode(@RequestParam(value = "sign")String sign, | 
|---|
|  |  |  | @RequestParam(value = "timestamp")Long timestamp, | 
|---|
|  |  |  | @RequestBody GenerateQRCodeRequest generateQRCodeRequest,HttpServletResponse response) { | 
|---|
|  |  |  | if(StringUtils.isBlank(sign) || timestamp == null){ | 
|---|
|  |  |  | throw  new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String interfaceKey = systemDictDataBiz.queryByCode(Constants.ZBOM,Constants.ZBOM_PAD_INTERFACE_KEY).getCode(); | 
|---|
|  |  |  | //判断时间戳是否超过两小时 | 
|---|
|  |  |  | if(System.currentTimeMillis()-timestamp > 2 * 60 * 3600 * 1000){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"token已失效!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String token = DigestUtils.md5Hex(timestamp+interfaceKey); | 
|---|
|  |  |  | if(!token.equals(sign)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"token已失效!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | response.setHeader("Cache-Control", "no-store, no-cache"); | 
|---|
|  |  |  | response.setContentType("image/jpeg"); | 
|---|
|  |  |  | InputStream inputStream = usersService.getQrCode(generateQRCodeRequest); | 
|---|
|  |  |  | ImageIO.write(ImageIO.read(inputStream),"png",response.getOutputStream()); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|