Commit 19d9f89e by 吴迪

【修改】点击区间时间范围

parent 935101cc
......@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import io.office.common.utils.IPUtils;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.common.utils.RedisUtils;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.SearchgtinlogEntity;
import io.office.modules.manage.service.SearchgtinlogService;
......@@ -50,6 +51,8 @@ public class GLNOutController {
private SearchgtinlogService searchgtinlogService;
@Autowired
private SearchLimitUtil searchLimitUtil;
@Autowired
private RedisUtils redisUtils;
/**
* 境外条码查询--验证产品--通过GTIN查询
......@@ -60,7 +63,7 @@ public class GLNOutController {
*/
@Login
@RequestMapping("/api/verified")
public R verified(@RequestBody VbgOutVerifiedVo vo, HttpServletRequest request) {
public R verified(@RequestBody VbgOutVerifiedVo vo, HttpServletRequest request) throws InterruptedException {
if (StringUtils.isBlank(vo.getGtin())) {
return R.error("请输入GTIN");
}
......@@ -70,15 +73,25 @@ public class GLNOutController {
if (vo.getGtin().length() == 13) {
vo.setGtin("0" + vo.getGtin());
}
if (!sysCaptchaService.validate(vo.getUuid(), vo.getCaptcha())) {
return R.error("验证码不正确");
//使用redis缓存,做一次接口校验,
String verified = redisUtils.get("verified");
if (StringUtils.isNotBlank(verified)) {
return R.error("当前访问人数过多!请换个时间尝试");
} else{
redisUtils.set("verified", "1",1/2);
}
SearchgtinlogEntity searchgtinlogEntity = new SearchgtinlogEntity();
searchgtinlogEntity.setCreatedate(new Date());
searchgtinlogEntity.setIp(IPUtils.getIpAddr(request));
searchgtinlogEntity.setClassStr("境外条码查询验证产品");
searchgtinlogEntity.setKeyword(vo.getGtin());
searchgtinlogEntity.setSearchsource(0);
//校验是否开启
String searchLimitStr = searchLimitUtil.checkSearchLimit(request, searchgtinlogEntity.getClassStr());
if (StringUtils.isNotBlank(searchLimitStr)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment