| | |
| | | package com.gkhy.web.controller.common; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.FastByteArrayOutputStream; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.google.code.kaptcha.Producer; |
| | | import com.gkhy.common.config.expertConfig; |
| | | import com.gkhy.common.config.ExpertConfig; |
| | | import com.gkhy.common.constant.CacheConstants; |
| | | import com.gkhy.common.constant.Constants; |
| | | import com.gkhy.common.core.domain.AjaxResult; |
| | |
| | | import com.gkhy.common.utils.sign.Base64; |
| | | import com.gkhy.common.utils.uuid.IdUtils; |
| | | import com.gkhy.system.service.ISysConfigService; |
| | | import com.google.code.kaptcha.Producer; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.FastByteArrayOutputStream; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 验证码操作处理 |
| | |
| | | * @author expert |
| | | */ |
| | | @RestController |
| | | @Api(tags = "验证码操作处理") |
| | | public class CaptchaController |
| | | { |
| | | @Resource(name = "captchaProducer") |
| | |
| | | * 生成验证码 |
| | | */ |
| | | @GetMapping("/captchaImage") |
| | | @ApiOperation(value = "生成验证码") |
| | | public AjaxResult getCode(HttpServletResponse response) throws IOException |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | |
| | | BufferedImage image = null; |
| | | |
| | | // 生成验证码 |
| | | String captchaType = expertConfig.getCaptchaType(); |
| | | String captchaType = ExpertConfig.getCaptchaType(); |
| | | if ("math".equals(captchaType)) |
| | | { |
| | | String capText = captchaProducerMath.createText(); |