From f2d6bd7d826a188c37a7c5ce5a6e72eb1bea9c7d Mon Sep 17 00:00:00 2001 From: = Date: Fri, 12 Jun 2020 09:46:59 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/ArticleServiceImpl.java | 14 ++++++++++---- .../main/java/com/epmet/utils/ModuleConstant.java | 10 ++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index c89af5abfb..fd2b02e4e5 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -38,11 +38,12 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.constant.*; import com.epmet.dao.*; -import com.epmet.dto.*; +import com.epmet.dto.ArticleVisitRecordDTO; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.DraftCoverDTO; +import com.epmet.dto.DraftDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.*; @@ -66,7 +67,6 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; -import javax.swing.text.StringContent; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; @@ -173,6 +173,12 @@ public class ArticleServiceImpl extends BaseServiceImpl Date: Fri, 12 Jun 2020 10:58:36 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E5=90=8E=E9=97=A8=20=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openapi/scan/config/WebAppConfig.java | 2 +- .../scan/controller/BackDoorController.java | 36 +++++++++---------- .../src/main/resources/readme | 2 ++ 3 files changed, 19 insertions(+), 21 deletions(-) create mode 100644 epmet-openapi/epmet-openapi-scan/src/main/resources/readme diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java index 8b331effc6..6ec719587e 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/WebAppConfig.java @@ -25,7 +25,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(scanApiAuthInterceptor)//添加拦截器 .addPathPatterns("/**") //拦截所有请求 - .excludePathPatterns("/UserCon/**");//对应的不拦截的请求 + .excludePathPatterns("/opback/addWhite*");//对应的不拦截的请求 } } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java index db1807ca3c..433ff1b06d 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/BackDoorController.java @@ -1,36 +1,32 @@ package com.epmet.openapi.scan.controller; import com.alibaba.fastjson.JSON; -import com.epmet.commons.tools.utils.Result; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.GetMapping; +import com.epmet.openapi.scan.common.redis.RedisKeys; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.SetOperations; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.util.HashMap; -import java.util.Map; +import java.util.Set; /** * @author jianjun liu * @date 2020-06-04 20:39 **/ @RestController -@RequestMapping("test") +@RequestMapping("opback") public class BackDoorController { - @Value("${aliyun.green.accessKeyId}") - private String accessKeyId; + @Autowired + private RedisTemplate redisTemplate; - @Value("${aliyun.green.accessKeySecret}") - private String accessKeySecret; - - @Value("${aliyun.green.regionId}") - private String regionId; - @GetMapping("api") - public Result page() { - Map map = new HashMap<>(); - map.put(accessKeyId,accessKeyId); - map.put(accessKeySecret,accessKeySecret); - map.put(regionId, regionId); - return new Result().ok(JSON.toJSONString(map)); + @RequestMapping("addWhite") + public String addWhite(@RequestParam String ip) { + SetOperations setOperations = redisTemplate.opsForSet(); + String whiteList = RedisKeys.getWhiteList(); + Long add = setOperations.add(whiteList, ip); + Set members = setOperations.members(whiteList); + return "ip:" + ip + "添加" + (add > 0 ? "成功" : "失败") + ",当前所有列表:" + JSON.toJSONString(members); } } diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/readme b/epmet-openapi/epmet-openapi-scan/src/main/resources/readme new file mode 100644 index 0000000000..5b2e138e3e --- /dev/null +++ b/epmet-openapi/epmet-openapi-scan/src/main/resources/readme @@ -0,0 +1,2 @@ +#添加白名单 +sadd epmet:openapi:scan:whitelist "客户端ip地址" \ No newline at end of file From c0b9d3ed61d16c5c036e68c431907432f41300ac Mon Sep 17 00:00:00 2001 From: = Date: Fri, 12 Jun 2020 11:06:41 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/pom.xml | 4 ++-- .../epmet-openapi-scan/deploy/docker-compose-dev.yml | 2 +- epmet-openapi/epmet-openapi-scan/pom.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 61c4e5aa1d..f0db9ddace 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -170,8 +170,8 @@ lb://resi-home-server - lb://gov-voice-server - + + http://localhost:8105 lb://resi-voice-server diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index cdbe3a01c5..40baa4aac6 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.6 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.7 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index 73913ea20b..5aaf513999 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.6 + 0.3.7 epmet-openapi-scan jar