diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml
new file mode 100644
index 0000000000..8aed7ac022
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml
@@ -0,0 +1,17 @@
+version: "3.7"
+services:
+ epmet-user-server:
+ container_name: epmet-openapi-scan-dev
+ image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.56
+ ports:
+ - "8107:8107"
+ network_mode: host # 不会创建新的网络
+ volumes:
+ - "/opt/epmet-cloud-logs/dev:/logs"
+ environment:
+ RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar"
+ deploy:
+ resources:
+ limits:
+ cpus: '0.1'
+ memory: 300M
\ No newline at end of file
diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml
new file mode 100644
index 0000000000..ef6895dc7b
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml
@@ -0,0 +1,17 @@
+version: "3.7"
+services:
+ epmet-user-server:
+ container_name: epmet-openapi-scan-test
+ image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-user-scan:0.3.53
+ ports:
+ - "8107:8107"
+ network_mode: host # 不会创建新的网络
+ volumes:
+ - "/opt/epmet-cloud-logs/test:/logs"
+ environment:
+ RUN_INSTRUCT: "java -Xms32m -Xmx200m -jar ./app.jar"
+ deploy:
+ resources:
+ limits:
+ cpus: '0.1'
+ memory: 300M
\ No newline at end of file
diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml
new file mode 100644
index 0000000000..47462e4a16
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/pom.xml
@@ -0,0 +1,136 @@
+
+
+
+ epmet-cloud
+ com.epmet
+ 2.0.0
+
+ 4.0.0
+
+ epmet-openapi-scan
+ jar
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework
+ spring-context-support
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+ com.epmet
+ epmet-commons-tools
+ 2.0.0
+
+
+
+ com.aliyun
+ aliyun-java-sdk-core
+ 3.5.0
+
+
+ com.aliyun
+ aliyun-java-sdk-green
+ 3.5.0
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.2
+
+
+
+
+ ${project.artifactId}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+
+ ${project.basedir}/src/main/java
+
+
+ true
+ ${basedir}/src/main/resources
+
+
+
+
+
+
+ dev
+
+ true
+
+
+ 8107
+ dev
+
+
+
+ 0
+ 192.168.1.130
+ 6379
+ 123456
+
+ true
+ 122.152.200.70:8848
+ fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b
+
+
+ false
+
+
+
+
+ test
+
+
+ 8107
+ test
+
+
+ 0
+ r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com
+ 6379
+ EpmEtrEdIs!q@w
+
+ true
+ 192.168.10.150:8848
+ 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae
+
+
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java
new file mode 100644
index 0000000000..b87a8dc231
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java
@@ -0,0 +1,28 @@
+/**
+ * Copyright (c) 2018 人人开源 All rights reserved.
+ *
+ * https://www.renren.io
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.epmet.openapi.scan;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * 管理后台
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.0.0
+ */
+
+@SpringBootApplication
+public class ScanApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ScanApplication.class, args);
+ }
+
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java
new file mode 100644
index 0000000000..ae6960a52d
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/aspect/RequestLogAspect.java
@@ -0,0 +1,40 @@
+package com.epmet.openapi.scan.aspect;
+
+import com.epmet.commons.tools.aspect.BaseRequestLogAspect;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * 日志/异常处理切面实现,调用父类方法完成日志记录和异常处理。
+ */
+@Aspect
+@Component
+@Order(0)
+public class RequestLogAspect extends BaseRequestLogAspect {
+
+ @Override
+ @Around(value = "execution(* com.epmet.openapi.scan.controller.*Controller*.*(..)) ")
+ public Object proceed(ProceedingJoinPoint point) throws Throwable {
+ return super.proceed(point, getRequest());
+ }
+
+ /**
+ * 获取Request对象
+ *
+ * @return
+ */
+ private HttpServletRequest getRequest() {
+ RequestAttributes ra = RequestContextHolder.getRequestAttributes();
+ ServletRequestAttributes sra = (ServletRequestAttributes) ra;
+ return sra.getRequest();
+ }
+
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java
new file mode 100644
index 0000000000..1fcbbba9f0
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/ImgSceneEnum.java
@@ -0,0 +1,46 @@
+package com.epmet.openapi.scan.common.enu;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author jianjun liu
+ * @date 2020-06-04 21:39
+ **/
+public enum ImgSceneEnum {
+ PORN("porn", "图片智能鉴黄"),
+ TERRORISM("terrorism", "图片暴恐涉政识别");
+
+ private String code;
+ private String desc;
+
+ ImgSceneEnum(String code, String desc) {
+ this.code = code;
+ this.desc = desc;
+ }
+
+ public static List getImgSceneList() {
+ List result = new ArrayList<>();
+ ImgSceneEnum[] values = ImgSceneEnum.values();
+ for (ImgSceneEnum v : values) {
+ result.add(v.getCode());
+ }
+ return result;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getDesc() {
+ return desc;
+ }
+
+ public void setDesc(String desc) {
+ this.desc = desc;
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java
new file mode 100644
index 0000000000..e1dbd5897b
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/RegionIdEnum.java
@@ -0,0 +1,49 @@
+package com.epmet.openapi.scan.common.enu;
+
+/**
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-04 21:39
+ **/
+public enum RegionIdEnum {
+ SHANG_HAI("cn-shanghai","green.cn-shanghai.aliyuncs.com"),
+ BEI_JING("cn-beijing","green.cn-beijing.aliyuncs.com"),
+ AP_SOUTHEAST_1("ap-southeast-1","green.ap-southeast-1.aliyuncs.com"),
+ US_WEST_1("us-west-1","green.us-west-1.aliyuncs.com");
+
+ private String regionId;
+ private String domain;
+ RegionIdEnum(String regionId, String domain){
+ this.regionId = regionId;
+ this.domain = domain;
+ }
+
+ public static String getDoMain(String regionId){
+ if (regionId == null) {
+ return SHANG_HAI.getDomain();
+ }
+ RegionIdEnum[] values = RegionIdEnum.values();
+ for (RegionIdEnum v : values) {
+ if (regionId.equals(v.getDomain())) {
+ return v.getDomain();
+ }
+ }
+ return SHANG_HAI.getDomain();
+ }
+
+ public String getRegionId() {
+ return regionId;
+ }
+
+ public void setRegionId(String regionId) {
+ this.regionId = regionId;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public void setDomain(String domain) {
+ this.domain = domain;
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/TestController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/TestController.java
new file mode 100644
index 0000000000..e903a8d0e7
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/TestController.java
@@ -0,0 +1,36 @@
+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 org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author jianjun liu
+ * @date 2020-06-04 20:39
+ **/
+@RestController
+@RequestMapping("test")
+public class TestController {
+ @Value("${aliyun.green.accessKeyId}")
+ private String accessKeyId;
+
+ @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));
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ScanParam.java
new file mode 100644
index 0000000000..d589aa33b7
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ScanParam.java
@@ -0,0 +1,37 @@
+package com.epmet.openapi.scan.support.param;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 审查参数
+ *
+ * @author jianjun liu
+ * @date 2020-06-04 21:57
+ **/
+@Data
+public class ScanParam {
+ /**
+ * 场景 必填
+ *
+ * @see com.epmet.openapi.scan.common.enu.ImgSceneEnum;
+ */
+ private List scenes;
+
+ /**
+ * 要检测的内容列表,必填
+ * remark:一组任务列表中的taskId不能相同
+ */
+ private List tasks;
+
+ /**
+ * 异步检测结果回调地址,执行异步审查内容时 必填
+ */
+ private String callback;
+
+ /**
+ * 随机字符串,该值用于回调通知请求中的签名,使用callback时 必填
+ */
+ private String seed;
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/Task.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/Task.java
new file mode 100644
index 0000000000..51f38b1b3b
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/Task.java
@@ -0,0 +1,25 @@
+package com.epmet.openapi.scan.support.param;
+
+import lombok.Data;
+
+/**
+ * 任务参数
+ *
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-04 22:13
+ **/
+@Data
+public class Task {
+
+ /**
+ * 要检测的数据id 非必填
+ *
+ * */
+ private String dataId;
+
+ /**
+ * 图片url 必填
+ */
+ private String url;
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000000..c2cf89a17e
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml
@@ -0,0 +1,77 @@
+server:
+ port: @server.port@
+ servlet:
+ context-path: /epmetscan
+
+spring:
+ main:
+ allow-bean-definition-overriding: true
+ application:
+ name: epmet-openapi-scan
+ #环境 dev|test|prod
+ profiles:
+ active: dev
+ messages:
+ encoding: UTF-8
+ basename: i18n/messages_common
+ jackson:
+ time-zone: GMT+8
+ date-format: yyyy-MM-dd HH:mm:ss
+ redis:
+ database: @spring.redis.index@
+ host: @spring.redis.host@
+ port: @spring.redis.port@
+ password: @spring.redis.password@
+ timeout: 30s
+ cloud:
+ nacos:
+ discovery:
+ server-addr: @nacos.server-addr@
+ #nacos的命名空间ID,默认是public
+ namespace: @nacos.discovery.namespace@
+ #不把自己注册到注册中心的地址
+ register-enabled: @nacos.register-enabled@
+ ip: @nacos.ip@
+ config:
+ enabled: @nacos.config-enabled@
+ server-addr: @nacos.server-addr@
+ namespace: @nacos.config.namespace@
+ group: @nacos.config.group@
+ file-extension: yaml
+management:
+ endpoints:
+ web:
+ exposure:
+ include: "*"
+ endpoint:
+ health:
+ show-details: ALWAYS
+
+feign:
+ hystrix:
+ enabled: true
+ client:
+ config:
+ default:
+ loggerLevel: BASIC
+ httpclient:
+ enabled: true
+
+
+hystrix:
+ command:
+ default:
+ execution:
+ isolation:
+ thread:
+ timeoutInMilliseconds: 60000 #缺省为1000
+
+ribbon:
+ ReadTimeout: 300000
+ ConnectTimeout: 300000
+
+aliyun:
+ green:
+ accessKeyId: 123
+ accessKeySecret: 456
+ regionId: cn-shanghai
\ No newline at end of file
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml b/epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml
new file mode 100644
index 0000000000..d244b6fa2a
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/resources/logback-spring.xml
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+
+
+
+ ${appname}
+
+
+
+
+
+
+
+
+ debug
+
+
+ ${CONSOLE_LOG_PATTERN}
+
+ UTF-8
+
+
+
+
+
+
+
+ ${log.path}/debug.log
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+
+
+ ${log.path}/debug-%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+
+ 15
+
+
+
+ debug
+ ACCEPT
+ DENY
+
+
+
+
+
+
+ ${log.path}/info.log
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+
+
+ ${log.path}/info-%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+
+ 15
+
+
+
+ info
+ ACCEPT
+ DENY
+
+
+
+
+
+
+ ${log.path}/warn.log
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+
+ ${log.path}/warn-%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+
+ 15
+
+
+
+ warn
+ ACCEPT
+ DENY
+
+
+
+
+
+
+ ${log.path}/error.log
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%contextName] [%thread] %-5level %logger{50} - %msg%n
+ UTF-8
+
+
+
+ ${log.path}/error-%d{yyyy-MM-dd}.%i.log
+
+ 100MB
+
+
+ 15
+
+
+
+ ERROR
+ ACCEPT
+ DENY
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java
new file mode 100644
index 0000000000..8c0774030d
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/test/java/BaseSample.java
@@ -0,0 +1,50 @@
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Created by liuhai.lh on 17/01/12.
+ */
+public class BaseSample {
+
+ protected static String accessKeyId = "123";
+ protected static String accessKeySecret = "456";
+
+ protected static String regionId = "cn-shanghai";
+
+ static {
+ Properties properties = new Properties();
+
+ try {
+ properties.load(BaseSample.class.getResourceAsStream("bootstrap.yml"));
+ accessKeyId = properties.getProperty("aliyun.green.accessKeyId");
+ accessKeySecret = properties.getProperty("aliyun.green.accessKeySecret");
+ regionId = properties.getProperty("aliyun.green.url");
+ } catch(IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ protected static String getDomain(){
+ if("cn-shanghai".equals(regionId)){
+ return "green.cn-shanghai.aliyuncs.com";
+ }
+
+ if ("cn-beijing".equals(regionId)) {
+ return "green.cn-beijing.aliyuncs.com";
+ }
+
+ if ("ap-southeast-1".equals(regionId)) {
+ return "green.ap-southeast-1.aliyuncs.com";
+ }
+
+ if ("us-west-1".equals(regionId)) {
+ return "green.us-west-1.aliyuncs.com";
+ }
+
+ return "green.cn-shanghai.aliyuncs.com";
+ }
+ protected static String getEndPointName(){
+ return regionId;
+ }
+
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java
new file mode 100644
index 0000000000..acba42e763
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/test/java/ImageAsyncScanRequestSample.java
@@ -0,0 +1,95 @@
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.exceptions.ServerException;
+import com.aliyuncs.green.model.v20180509.ImageAsyncScanRequest;
+import com.aliyuncs.http.FormatType;
+import com.aliyuncs.http.HttpResponse;
+import com.aliyuncs.profile.DefaultProfile;
+import com.aliyuncs.profile.IClientProfile;
+import com.epmet.openapi.scan.common.enu.RegionIdEnum;
+
+import java.util.*;
+
+/**
+ * Created by liuhai.lh on 2017/2/17.
+ * 图片异步检测接口
+ * @author liuhai.lh
+ * @date 2017/02/17
+ */
+public class ImageAsyncScanRequestSample extends BaseSample{
+
+ public static void main(String[] args) throws Exception {
+ //请替换成你自己的accessKeyId、accessKeySecret
+ IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
+ DefaultProfile.addEndpoint(getEndPointName(), regionId, "Green", RegionIdEnum.getDoMain(regionId));
+ IAcsClient client = new DefaultAcsClient(profile);
+
+ ImageAsyncScanRequest imageAsyncScanRequest = new ImageAsyncScanRequest();
+ imageAsyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式
+ imageAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法
+ imageAsyncScanRequest.setEncoding("utf-8");
+ imageAsyncScanRequest.setRegionId(regionId);
+
+
+ List