Commit 8be94c8c by 吴迪

【新增】查询限制

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