Commit 264befaa by 吴迪

【新增】请求gds接口限制

parent f65970d9
...@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.exception.RRException; import io.office.common.exception.RRException;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.common.utils.Query; import io.office.common.utils.Query;
import io.office.common.utils.RedisUtils;
import io.office.modules.manage.dao.*; import io.office.modules.manage.dao.*;
import io.office.modules.manage.entity.*; import io.office.modules.manage.entity.*;
import io.office.modules.manage.service.TycpdmFirmChangeService; import io.office.modules.manage.service.TycpdmFirmChangeService;
...@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
...@@ -67,6 +69,11 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -67,6 +69,11 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
@Value("${uploadFileQYOne}") @Value("${uploadFileQYOne}")
String uploadFileQYOne; String uploadFileQYOne;
@Resource
RedisUtils redisUtils;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
...@@ -724,6 +731,12 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm ...@@ -724,6 +731,12 @@ public class TycpdmFirmServiceImpl extends ServiceImpl<TycpdmFirmDao, TycpdmFirm
if (!"200".equals(status)) { if (!"200".equals(status)) {
throw new RRException("获取token失败" + msg); throw new RRException("获取token失败" + msg);
} }
String value = redisUtils.get("gds:" + phone);
if(StringUtils.isNotBlank(value)) {
throw new RRException("请求频繁,请3s后重试!");
}
redisUtils.set("gds:"+phone,"Y",3);
log.info("http://wsdt.gs1cn.org/anccoh/login?method=redirect&token=" + msg); log.info("http://wsdt.gs1cn.org/anccoh/login?method=redirect&token=" + msg);
return "http://wsdt.gs1cn.org/anccoh/login?method=redirect&token=" + msg; return "http://wsdt.gs1cn.org/anccoh/login?method=redirect&token=" + msg;
} }
......
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