Commit 8be94c8c by 吴迪

【新增】查询限制

parent 5cfdc283
......@@ -3,15 +3,18 @@ package io.office.modules.manage.controller;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import io.office.common.utils.IPUtils;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.SearchgtinlogEntity;
import io.office.modules.manage.service.SearchgtinlogService;
import io.office.modules.manage.utils.SearchLimitUtil;
import io.office.modules.manage.vo.request.BikeFirmVo;
import io.office.modules.manage.vo.request.DomesticCodeDetailRequest;
import io.office.modules.sys.service.SysCaptchaService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -42,6 +45,8 @@ public class BikefirmController {
private SysCaptchaService sysCaptchaService;
@Autowired
private SearchgtinlogService searchgtinlogService;
@Autowired
private SearchLimitUtil searchLimitUtil;
/**
* 列表
......@@ -103,6 +108,11 @@ public class BikefirmController {
@Login
@PostMapping("/api/getBikeFirm")
public R getBikeFirm(@RequestBody BikeFirmVo bikeFirmVo, HttpServletRequest request) {
if(StringUtils.isBlank(bikeFirmVo.getCode()) &&StringUtils.isBlank(bikeFirmVo.getFirmName())) {
return R.error("请输入查询条件!");
}
boolean captcha = sysCaptchaService.validate(bikeFirmVo.getUuid(), bikeFirmVo.getCaptcha());
if (!captcha) {
return R.error("验证码不正确");
......@@ -127,8 +137,17 @@ public class BikefirmController {
searchgtinlogEntity.setSearchsource(0);
//新增查询日志
searchgtinlogService.save(searchgtinlogEntity);
//校验是否开启
String searchLimitStr = searchLimitUtil.checkSearchLimit(request,searchgtinlogEntity.getClassStr());
if(StringUtils.isNotBlank(searchLimitStr)) {
return R.error(searchLimitStr);
}
return R.ok().put("data", bikefirmService.getBikeFirm(bikeFirmVo));
List<BikeFirmVo> bikeFirm = bikefirmService.getBikeFirm(bikeFirmVo);
if(CollectionUtils.isEmpty(bikeFirm)) {
return R.error("没有符合条件的记录!");
}
return R.ok().put("data", bikeFirm);
}
......
......@@ -18,6 +18,7 @@ import io.office.modules.manage.vo.request.TopicNewsPartyRequestVo;
import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.service.SysCaptchaService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -120,6 +121,9 @@ public class GlossaryController extends AbstractController {
public R terminology(@RequestBody TerminologyVo terminologyVo, HttpServletRequest request) {
try {
if(StringUtils.isBlank(terminologyVo.getKeyword())) {
return R.error("请输入查询条件!");
}
boolean captcha = sysCaptchaService.validate(terminologyVo.getUuid(), terminologyVo.getCaptcha());
if(!captcha){
return R.error("验证码不正确");
......@@ -150,7 +154,11 @@ public class GlossaryController extends AbstractController {
searchgtinlogEntity.setSearchsource(0);
//新增查询日志
searchgtinlogService.save(searchgtinlogEntity);
return R.ok().put("data", glossaryService.list(queryWrapper));
List<GlossaryEntity> list = glossaryService.list(queryWrapper);
if(CollectionUtils.isEmpty(list)) {
return R.error("没有符合条件的记录!");
}
return R.ok().put("data",list);
} catch (Exception e) {
log.error("get4PartyTopNews error: {}", e);
return R.error(e.getMessage());
......
......@@ -11,6 +11,7 @@ import io.office.modules.manage.entity.SearchgtinlogEntity;
import io.office.modules.manage.entity.ShortCodeEntity;
import io.office.modules.manage.service.SearchgtinlogService;
import io.office.modules.manage.service.ShortCodeService;
import io.office.modules.manage.utils.SearchLimitUtil;
import io.office.modules.manage.vo.request.ShortCodeVo;
import io.office.modules.sys.service.SysCaptchaService;
import org.apache.commons.lang.StringUtils;
......@@ -44,6 +45,8 @@ public class ShortCodeController {
@Autowired
private SysCaptchaService sysCaptchaService;
@Autowired
private SearchLimitUtil searchLimitUtil;
/**
* 列表
......@@ -144,6 +147,11 @@ public class ShortCodeController {
searchgtinlogEntity.setSearchsource(0);
//新增查询日志
searchgtinlogService.save(searchgtinlogEntity);
//校验是否开启
String searchLimitStr = searchLimitUtil.checkSearchLimit(request,searchgtinlogEntity.getClassStr());
if(StringUtils.isNotBlank(searchLimitStr)) {
return R.error(searchLimitStr);
}
return R.ok().put("data",shortCodeService.getList(shortCodeVo));
}
......
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