Commit fb2683f3 by 吴迪

【新增】添加查询限制

parent de31818e
...@@ -114,6 +114,13 @@ public class GLNController { ...@@ -114,6 +114,13 @@ public class GLNController {
@Login @Login
@PostMapping("/api/domesticCode") @PostMapping("/api/domesticCode")
public R domesticCode(@RequestBody DomesticCodeVo domesticCodeVo, HttpServletRequest request) { public R domesticCode(@RequestBody DomesticCodeVo domesticCodeVo, HttpServletRequest request) {
if(StringUtils.isBlank(domesticCodeVo.getCode())) {
return R.error("请输入查询条件!");
}
boolean captcha = sysCaptchaService.validate(domesticCodeVo.getUuid(), domesticCodeVo.getCaptcha()); boolean captcha = sysCaptchaService.validate(domesticCodeVo.getUuid(), domesticCodeVo.getCaptcha());
if(!captcha){ if(!captcha){
return R.error("验证码不正确"); return R.error("验证码不正确");
...@@ -132,7 +139,11 @@ public class GLNController { ...@@ -132,7 +139,11 @@ public class GLNController {
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);
}
if(domesticCodeVo.getType().equals("1")) { if(domesticCodeVo.getType().equals("1")) {
DomesticCodeResponse infoByCode = ESSearchUtils.getInfoByCode(searchgtinlogEntity.getKeyword()); DomesticCodeResponse infoByCode = ESSearchUtils.getInfoByCode(searchgtinlogEntity.getKeyword());
if(infoByCode!=null) { if(infoByCode!=null) {
...@@ -228,6 +239,10 @@ public class GLNController { ...@@ -228,6 +239,10 @@ public class GLNController {
@RequestMapping("/api/domesticCodeProductionNews") @RequestMapping("/api/domesticCodeProductionNews")
public R domesticCodeProductionNews(@RequestBody DomesticCodeVo domesticCodeVo, HttpServletRequest request) { public R domesticCodeProductionNews(@RequestBody DomesticCodeVo domesticCodeVo, HttpServletRequest request) {
if(StringUtils.isBlank(domesticCodeVo.getCode())) {
return R.error("请输入查询条件!");
}
if(StringUtils.isNotBlank(domesticCodeVo.getCode())) { if(StringUtils.isNotBlank(domesticCodeVo.getCode())) {
if(domesticCodeVo.getCode().length()<13) { if(domesticCodeVo.getCode().length()<13) {
return R.error("商品条码卡位数太少!请输入正确的13位或14位商品条码!"); return R.error("商品条码卡位数太少!请输入正确的13位或14位商品条码!");
...@@ -241,6 +256,11 @@ public class GLNController { ...@@ -241,6 +256,11 @@ public class GLNController {
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);
}
String urlMac = "/AAQI/v1/ProductData/gtin/${code}?targetMarket=156&dataVersion=1.1&clientGln=6901234503814"; String urlMac = "/AAQI/v1/ProductData/gtin/${code}?targetMarket=156&dataVersion=1.1&clientGln=6901234503814";
String macStr = MacUtils.getMac(urlMac.replaceAll("\\$\\{code\\}",domesticCodeVo.getCode())); String macStr = MacUtils.getMac(urlMac.replaceAll("\\$\\{code\\}",domesticCodeVo.getCode()));
......
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