diff --git a/epmet-commons/epmet-commons-tools/pom.xml b/epmet-commons/epmet-commons-tools/pom.xml
index 53697b265e..216ec1c8b1 100644
--- a/epmet-commons/epmet-commons-tools/pom.xml
+++ b/epmet-commons/epmet-commons-tools/pom.xml
@@ -123,6 +123,12 @@
lombok
${lombok.version}
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.2
+
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
index ba34e7ff6a..f7f985ed63 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java
@@ -9,18 +9,15 @@
package com.epmet.commons.tools.redis;
import com.epmet.commons.tools.constant.NumConstant;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataAccessException;
+import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
-import org.springframework.data.redis.core.HashOperations;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.data.redis.core.ZSetOperations;
+import org.springframework.data.redis.core.*;
import org.springframework.data.redis.support.atomic.RedisAtomicLong;
import org.springframework.stereotype.Component;
import java.util.Collection;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -307,4 +304,16 @@ public class RedisUtils {
Set> typedTuples = redisTemplate.opsForZSet().reverseRangeWithScores(key, start, end);
return typedTuples;
}
+
+ /**
+ * @Description 标签使用数量缓存更新
+ * @param key
+ * @param value
+ * @param delta
+ * @author zxc
+ */
+ public Double zIncrementScore(String key, Object value, double delta) {
+ return redisTemplate.opsForZSet().incrementScore(key, value, delta);
+ }
+
}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/ImgScanParamDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/ImgScanParamDTO.java
new file mode 100644
index 0000000000..3029a869ed
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/ImgScanParamDTO.java
@@ -0,0 +1,24 @@
+package com.epmet.commons.tools.scan.param;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 审查参数
+ *
+ * @author jianjun liu
+ * @date 2020-06-04 21:57
+ **/
+@Data
+public class ImgScanParamDTO implements Serializable {
+
+ private static final long serialVersionUID = -5982388188212400644L;
+
+ /**
+ * 要检测的内容列表,必填
+ * remark:一组任务列表中的taskId不能相同
+ */
+ private List tasks;
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/ImgTaskDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/ImgTaskDTO.java
new file mode 100644
index 0000000000..a724f437ee
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/ImgTaskDTO.java
@@ -0,0 +1,28 @@
+package com.epmet.commons.tools.scan.param;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 任务参数
+ *
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-04 22:13
+ **/
+@Data
+public class ImgTaskDTO implements Serializable {
+
+ private static final long serialVersionUID = -747206284930578105L;
+ /**
+ * 要检测的数据id 非必填
+ *
+ * */
+ private String dataId;
+
+ /**
+ * 图片url 必填
+ */
+ private String url;
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/TextScanParamDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/TextScanParamDTO.java
new file mode 100644
index 0000000000..eb10414fa8
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/TextScanParamDTO.java
@@ -0,0 +1,24 @@
+package com.epmet.commons.tools.scan.param;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 文本审查参数
+ *
+ * @author jianjun liu
+ * @date 2020-06-05 11:17
+ **/
+@Data
+public class TextScanParamDTO implements Serializable {
+
+ private static final long serialVersionUID = -6244354240835340471L;
+
+ /**
+ * 要检测的内容列表,必填
+ * remark:一组任务列表中的taskId不能相同
+ */
+ private List tasks;
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/TextTaskDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/TextTaskDTO.java
new file mode 100644
index 0000000000..5e7791f628
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/param/TextTaskDTO.java
@@ -0,0 +1,28 @@
+package com.epmet.commons.tools.scan.param;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 任务参数
+ *
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-04 22:13
+ **/
+@Data
+public class TextTaskDTO implements Serializable {
+
+ private static final long serialVersionUID = 6957195274696018630L;
+ /**
+ * 要检测的数据id 非必填
+ *
+ * */
+ private String dataId;
+
+ /**
+ * 文本内容 必填 最多不能超过10000
+ */
+ private String content;
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/SyncScanResult.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/SyncScanResult.java
new file mode 100644
index 0000000000..edab5da461
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/scan/result/SyncScanResult.java
@@ -0,0 +1,42 @@
+package com.epmet.commons.tools.scan.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 检测结果
+ *
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 10:52
+ **/
+@Data
+public class SyncScanResult implements Serializable {
+ /**
+ * 执行成功的任务Id集合
+ */
+ private List successDataIds = new ArrayList<>();
+ /**
+ * 执行失败的任务Id集合
+ */
+ private List failDataIds = new ArrayList<>();
+
+ /**
+ * 本地是否全部通过
+ */
+ private boolean isAllPass;
+
+ public boolean isAllPass() {
+ if (failDataIds.isEmpty() && !successDataIds.isEmpty()) {
+ return true;
+ }
+ return isAllPass;
+ }
+
+ public void setAllPass(boolean allPass) {
+ isAllPass = allPass;
+ }
+}
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
new file mode 100644
index 0000000000..5422ce563f
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java
@@ -0,0 +1,172 @@
+package com.epmet.commons.tools.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.epmet.commons.tools.exception.EpmetErrorCode;
+import com.epmet.commons.tools.exception.RenException;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpStatus;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import org.springframework.util.CollectionUtils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * desc: http 工具类
+ * date: 2020/6/4 22:27
+ *
+ * @author: jianjun liu
+ */
+@Slf4j
+public class HttpClientManager {
+ private static int connectionTimeout = 3000;// 连接超时时间,毫秒
+ private static int soTimeout = 10000;// 读取数据超时时间,毫秒
+ /**
+ * HttpClient对象
+ */
+ private static CloseableHttpClient httpclient = HttpClients.custom().disableAutomaticRetries().build();
+
+ /*** 超时设置 ****/
+ private static RequestConfig requestConfig = RequestConfig.custom()
+ .setSocketTimeout(soTimeout)
+ .setConnectTimeout(connectionTimeout)
+ .build();//设置请求和传输超时时间
+
+ public static HttpClientManager getInstance() {
+ return SingleClass.instance;
+ }
+
+ private static class SingleClass {
+ private final static HttpClientManager instance = new HttpClientManager();
+ }
+
+ /**
+ * desc: 发送json post 请求
+ * param: url,jsonStrParam
+ * return: CallResult
+ * date: 2019/2/21 9:12
+ *
+ * @author: jianjun liu
+ */
+ public Result sendPost(String url, Map paramsMap) {
+
+ try {
+ HttpPost httppost = new HttpPost(url);
+ httppost.setConfig(requestConfig);
+ httppost.addHeader("Content-Type", "application/x-www-form-urlencoded charset=utf-8");
+
+ List list = new ArrayList();
+ for (String key : paramsMap.keySet()) {
+ list.add(new BasicNameValuePair(key, String.valueOf(paramsMap.get(key))));
+ }
+ UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(list, "utf-8");
+ httppost.setEntity(urlEncodedFormEntity);
+
+ return execute(httppost);
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("send exception", e);
+ return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
+ }
+
+ }
+
+ /**
+ * desc: 发送json post 请求
+ * param: url,jsonStrParam
+ * return: Result
+ * date: 2019/2/21 9:12
+ *
+ * @author: jianjun liu
+ */
+ public Result sendPostByJSON(String url, String jsonStrParam) {
+
+ try {
+ HttpPost httppost = new HttpPost(url);
+ httppost.setConfig(requestConfig);
+ httppost.addHeader("Content-Type", "application/json; charset=utf-8");
+ if (StringUtils.isNotEmpty(jsonStrParam)) {
+ StringEntity se = new StringEntity(jsonStrParam, "utf-8");
+ httppost.setEntity(se);
+ }
+ return execute(httppost);
+ } catch (Exception e) {
+ log.error("send exception", e);
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
+ }
+
+ }
+
+ /**
+ * desc: 发送get请求
+ * param:url, params
+ * return: CallResult
+ * date: 2019/2/21 9:16
+ *
+ * @author: jianjun liu
+ */
+ public Result sendGet(String url, Map params) {
+
+ try {
+ URIBuilder builder = new URIBuilder(url);
+ if (!CollectionUtils.isEmpty(params)) {
+ Set set = params.keySet();
+ for (String key : set) {
+ builder.setParameter(key, params.get(key) == null ? "" : String.valueOf(params.get(key)));
+ }
+ }
+ HttpGet httpGet = new HttpGet(builder.build());
+ httpGet.setConfig(requestConfig);
+ return execute(httpGet);
+ } catch (Exception e) {
+ log.error("sendGet exception", e);
+ return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
+ }
+ }
+
+ private Result execute(HttpRequestBase httpMethod) {
+ CloseableHttpResponse response = null;
+ try {
+ response = httpclient.execute(httpMethod);
+ log.debug("http send response:{}", JSON.toJSONString(response));
+ if (response != null && response.getStatusLine() != null) {
+ if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+ String result = EntityUtils.toString(response.getEntity());
+ return new Result().ok(result);
+ } else {
+ log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode());
+ }
+ }
+ } catch (Exception e) {
+ log.error("execute exception", e);
+ new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
+ } finally {
+ httpMethod.releaseConnection();
+ try {
+ if (response != null) {
+ response.close();
+ }
+ } catch (IOException e) {
+ }
+ }
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
+ }
+}
+
+
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java
new file mode 100644
index 0000000000..cfab55c859
--- /dev/null
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ScanContentUtils.java
@@ -0,0 +1,58 @@
+package com.epmet.commons.tools.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.epmet.commons.tools.exception.EpmetErrorCode;
+import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
+import com.epmet.commons.tools.scan.param.TextScanParamDTO;
+import com.epmet.commons.tools.scan.result.SyncScanResult;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * 扫描内容工具类
+ *
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-08 8:28
+ **/
+public class ScanContentUtils {
+ /**
+ * desc:图片同步扫描
+ *
+ * @return
+ */
+ public static SyncScanResult imgSyncScan(String url, ImgScanParamDTO param) {
+ if (StringUtils.isBlank(url) || param == null) {
+ throw new RenException("参数错误");
+ }
+ try {
+ Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param));
+ if (result.success()) {
+ return JSON.parseObject(result.getData(), SyncScanResult.class);
+ }
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), result.getMsg());
+ } catch (Exception e) {
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
+ }
+ }
+
+ /**
+ * desc:文字同步扫描
+ *
+ * @return
+ */
+ public static SyncScanResult textSyncScan(String url, TextScanParamDTO param) {
+ if (StringUtils.isBlank(url) || param == null) {
+ throw new RenException("参数错误");
+ }
+ try {
+ Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param));
+ if (result.success()) {
+ return JSON.parseObject(result.getData(), SyncScanResult.class);
+ }
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), result.getMsg());
+ } catch (Exception e) {
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
+ }
+ }
+}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagFormDTO.java
new file mode 100644
index 0000000000..d2000b366f
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagFormDTO.java
@@ -0,0 +1,53 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author zxc
+ * @CreateTime 2020/6/4 15:12
+ */
+@Data
+public class UpdateTagFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1686362744399106982L;
+
+ private String id;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * 标签名称
+ */
+ private String tagName;
+
+ /**
+ * 使用计数
+ */
+ private Integer useCount = 1;
+
+ /**
+ * 删除标识 0.未删除 1.已删除
+ */
+ private Integer delFlag = 0;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision = 0;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+}
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagUseCountsFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagUseCountsFormDTO.java
new file mode 100644
index 0000000000..be0e75573e
--- /dev/null
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateTagUseCountsFormDTO.java
@@ -0,0 +1,26 @@
+package com.epmet.dto.form;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author zxc
+ * @CreateTime 2020/6/4 15:12
+ */
+@Data
+public class UpdateTagUseCountsFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1686362744399106982L;
+
+ /**
+ * 标签id
+ */
+ private String tagId;
+
+ /**
+ * 标签名称
+ */
+ private String tagName;
+}
diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml
index c576937391..b83e3086a4 100644
--- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml
+++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
gov-org-server:
container_name: gov-org-server-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.61
+ image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.62
ports:
- "8092:8092"
network_mode: host # 使用现有网络
diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml
index 5cafc1f56c..1a7359c79d 100644
--- a/epmet-module/gov-org/gov-org-server/pom.xml
+++ b/epmet-module/gov-org/gov-org-server/pom.xml
@@ -2,7 +2,7 @@
4.0.0
- 0.3.61
+ 0.3.62
com.epmet
gov-org
diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddArticleTagsFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddArticleTagsFormDTO.java
new file mode 100644
index 0000000000..06c5b49ab8
--- /dev/null
+++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/AddArticleTagsFormDTO.java
@@ -0,0 +1,60 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author zxc
+ * @CreateTime 2020/6/5 17:36
+ */
+@Data
+public class AddArticleTagsFormDTO implements Serializable {
+
+ private static final long serialVersionUID = -6009661699565102279L;
+
+ /**
+ * 主键ID
+ */
+ private String id;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * 文章ID
+ */
+ private String articleId;
+
+ /**
+ * 标签ID
+ */
+ private String tagId;
+
+ /**
+ * 标签名称
+ */
+ private String tagName;
+
+ /**
+ * 删除标识 0.未删除 1.已删除
+ */
+ private Integer delFlag = 0;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision = 0;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+}
diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateGridTagsFormDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateGridTagsFormDTO.java
new file mode 100644
index 0000000000..aac40d8a43
--- /dev/null
+++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/UpdateGridTagsFormDTO.java
@@ -0,0 +1,66 @@
+package com.epmet.dto.form;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author zxc
+ * @CreateTime 2020/6/5 10:20
+ */
+@Data
+public class UpdateGridTagsFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 2876626163349728237L;
+
+ /**
+ * 主键ID
+ */
+ private String id;
+
+ /**
+ * 客户ID
+ */
+ private String customerId;
+
+ /**
+ * 网格ID
+ */
+ private String gridId;
+
+ /**
+ * 标签ID
+ */
+ private String tagId;
+
+ /**
+ * 标签名称
+ */
+ private String tagName;
+
+ /**
+ * 使用计数
+ */
+ private Integer useCount = 1;
+
+ /**
+ * 删除标识 0.未删除 1.已删除
+ */
+ private Integer delFlag = 0;
+
+ /**
+ * 乐观锁
+ */
+ private Integer revision = 0;
+
+ /**
+ * 创建人
+ */
+ private String createdBy;
+
+ /**
+ * 更新人
+ */
+ private String updatedBy;
+
+}
diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java
index 51ed6bc69b..5cc2770018 100644
--- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java
+++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleDetailResultDTO.java
@@ -1,6 +1,7 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@@ -48,10 +49,16 @@ public class GovArticleDetailResultDTO implements Serializable {
private String publishRangeDesc;
/**
- * 标签字符串
+ * 标签字符串-已废弃,不会返给前端
*/
+ @JsonIgnore
private String tags;
+ /**
+ * 文章关联标签集合
+ */
+ private String[] tagNameList;
+
/**
* 发布状态 已发布:published;已下线:offline
*/
diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java
index 4241ebac0c..c566028269 100644
--- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java
+++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/PublishedListResultDTO.java
@@ -1,9 +1,11 @@
package com.epmet.dto.result;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
+import java.util.List;
/**
* @author zhaoqifeng
@@ -34,7 +36,12 @@ public class PublishedListResultDTO implements Serializable {
/**
* 文章标签串
*/
+ @JsonIgnore
private String tags;
+ /**
+ * 文章标签列表
+ */
+ private List tagNameList;
/**
* 概要内容
*/
diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateCustomerTagCacheDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateCustomerTagCacheDTO.java
new file mode 100644
index 0000000000..03407c7493
--- /dev/null
+++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateCustomerTagCacheDTO.java
@@ -0,0 +1,26 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Author zxc
+ * @CreateTime 2020/6/5 9:54
+ */
+@Data
+public class UpdateCustomerTagCacheDTO implements Serializable {
+
+ private static final long serialVersionUID = -5544311005334312224L;
+
+ /**
+ * 客户id
+ */
+ private String customerId;
+
+ /**
+ * 标签信息集合
+ */
+ private List tagsInfo;
+}
diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateGridTagCacheDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateGridTagCacheDTO.java
new file mode 100644
index 0000000000..8e1a8beb95
--- /dev/null
+++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateGridTagCacheDTO.java
@@ -0,0 +1,27 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Author zxc
+ * @CreateTime 2020/6/5 10:49
+ */
+@Data
+public class UpdateGridTagCacheDTO implements Serializable {
+
+ private static final long serialVersionUID = 367220409651119904L;
+
+ /**
+ * 网格id
+ */
+ private String gridId;
+
+ /**
+ * 标签集合
+ * tagId、tagName
+ */
+ private List tagsInfo;
+}
diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateTagUseCountsResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateTagUseCountsResultDTO.java
new file mode 100644
index 0000000000..8bc0f69d21
--- /dev/null
+++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/UpdateTagUseCountsResultDTO.java
@@ -0,0 +1,25 @@
+package com.epmet.dto.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Author zxc
+ * @CreateTime 2020/6/4 17:20
+ */
+@Data
+public class UpdateTagUseCountsResultDTO implements Serializable {
+
+ private static final long serialVersionUID = -6331586672885417576L;
+
+ /**
+ * 标签id
+ */
+ private String tagId;
+
+ /**
+ * 标签名称
+ */
+ private String tagName;
+}
diff --git a/epmet-module/gov-voice/gov-voice-server/Dockerfile b/epmet-module/gov-voice/gov-voice-server/Dockerfile
index 88b6575415..915e6100bc 100644
--- a/epmet-module/gov-voice/gov-voice-server/Dockerfile
+++ b/epmet-module/gov-voice/gov-voice-server/Dockerfile
@@ -6,6 +6,6 @@ RUN echo 'Asia/Shanghai' > /etc/timezone
COPY ./target/*.jar ./app.jar
-EXPOSE 8102
+EXPOSE 8105
ENTRYPOINT ["sh", "-c", "$RUN_INSTRUCT"]
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml
index 642a9232a5..de565167db 100644
--- a/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml
+++ b/epmet-module/gov-voice/gov-voice-server/deploy/docker-compose-dev.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
gov-voice-server:
container_name: gov-voice-server-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/gov-voice-server:0.3.3
+ image: 192.168.1.130:10080/epmet-cloud-dev/gov-voice-server:0.3.7
ports:
- "8105:8105"
network_mode: host # 使用现有网络
diff --git a/epmet-module/gov-voice/gov-voice-server/pom.xml b/epmet-module/gov-voice/gov-voice-server/pom.xml
index 468cf80915..8266700a67 100644
--- a/epmet-module/gov-voice/gov-voice-server/pom.xml
+++ b/epmet-module/gov-voice/gov-voice-server/pom.xml
@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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.3
+ 0.3.7
gov-voice
com.epmet
@@ -34,6 +34,11 @@
epmet-commons-tools
2.0.0
+
+ com.epmet
+ epmet-message-client
+ 2.0.0
+
com.epmet
epmet-commons-mybatis
@@ -71,12 +76,6 @@
2.0.0
compile
-
- com.epmet
- epmet-user-client
- 2.0.0
- compile
-
@@ -143,7 +142,7 @@
true
-->
- 8104
+ 8105
test
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java
index d2e2edecfb..c788c48844 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/ArticleConstant.java
@@ -39,4 +39,9 @@ public interface ArticleConstant {
* 下线文章操作记录表文案
*/
String OFF_LINE_ARTICLE_MSG = "%s-%s下线文章【%s】";
+
+ /**
+ * 发布文章操作记录表文案
+ */
+ String PUBLISH_ARTICLE_MSG = "%s-%s发布文章【%s】";
}
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/TagConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/TagConstant.java
index 15c6267b3a..494ec2c154 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/TagConstant.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/TagConstant.java
@@ -40,6 +40,12 @@ public interface TagConstant {
*/
String COLON = ":";
+ String BEGIN_UPDATE = "开始更新标签缓存... ...";
+ String SUCCESS_UPDATE = "更新标签缓存成功... ...";
+ String FAILURE_UPDATE = "更新标签缓存失败... ...";
+
+ String SELECT_GRIDIDLIST_FAILURE = "查询gridId集合数量为0";
+
}
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
index f0af3cffb1..9e964ac066 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
@@ -21,27 +21,21 @@ import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.dto.TokenDto;
-import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
-import com.epmet.commons.tools.validator.AssertUtils;
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.commons.tools.validator.group.UpdateGroup;
-import com.epmet.dto.ArticleDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
-import com.epmet.excel.ArticleExcel;
import com.epmet.service.ArticleOperateRecordService;
import com.epmet.service.ArticleService;
import com.epmet.service.DraftService;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.*;
-import javax.servlet.http.HttpServletResponse;
import java.util.List;
-import java.util.Map;
/**
@@ -61,48 +55,6 @@ public class ArticleController {
@Autowired
private DraftService draftService;
- @GetMapping("page")
- public Result> page(@RequestParam Map params){
- PageData page = articleService.page(params);
- return new Result>().ok(page);
- }
-
- @GetMapping("{id}")
- public Result get(@PathVariable("id") String id){
- ArticleDTO data = articleService.get(id);
- return new Result().ok(data);
- }
-
- @PostMapping
- public Result save(@RequestBody ArticleDTO dto){
- //效验数据
- ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
- articleService.save(dto);
- return new Result();
- }
-
- @PutMapping
- public Result update(@RequestBody ArticleDTO dto){
- //效验数据
- ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
- articleService.update(dto);
- return new Result();
- }
-
- @DeleteMapping
- public Result delete(@RequestBody String[] ids){
- //效验数据
- AssertUtils.isArrayEmpty(ids, "id");
- articleService.delete(ids);
- return new Result();
- }
-
- @GetMapping("export")
- public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
- List list = articleService.list(params);
- ExcelUtils.exportExcelToTarget(response, null, list, ArticleExcel.class);
- }
-
/**
* @param tokenDTO
* @return
@@ -222,9 +174,6 @@ public class ArticleController {
public Result saveDraftAttr(@LoginUser TokenDto tokenDto,@RequestBody DraftAttrFromDTO fromDTO) throws Exception {
ValidatorUtils.validateEntity(fromDTO, DefaultGroup.class);
Boolean isSuccess = articleService.saveDraftAttr(tokenDto, fromDTO);
- if (isSuccess){
- //TODO 异步校验内容
- }
return new Result().ok(isSuccess);
}
@@ -250,9 +199,24 @@ public class ArticleController {
@RequirePermission(requirePermission = RequirePermissionEnum.WORK_PARTY_VOICE_PUBLISH)
public Result publishArticle(@LoginUser TokenDto tokenDto, String draftId) throws Exception {
Boolean isSuccess = articleService.publish(tokenDto, draftId);
+ if (isSuccess){
+ //TODO 异步校验内容
+ scanContent(tokenDto,draftId);
+ }
return new Result().ok(isSuccess);
}
+ @Async
+ public void scanContent(TokenDto tokenDto,String draftId){
+ SyncScanResult syncScanResult = articleService.scanContent(tokenDto,draftId);
+ if (syncScanResult.isAllPass()){
+ articleService.scanAllPassPublishArticle(tokenDto,draftId);
+ }else{
+ articleService.updateAuditStatusFailById(draftId,syncScanResult);
+ }
+
+ }
+
/**
* 已发布文章列表
@@ -363,4 +327,5 @@ public class ArticleController {
DraftDetailResultDTO draftDetailResultDTO = draftService.queryDraftDetail(formDTO);
return new Result().ok(draftDetailResultDTO);
}
+
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java
index 31c744610a..041f642be9 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleDao.java
@@ -68,21 +68,24 @@ public interface ArticleDao extends BaseDao {
* @author zhaoqifeng
* @date 2020/6/2 16:59
* @param customerId
+ * @param tagIdList
* @return java.util.List
*/
- @DataFilter(tableAliases = "a")
- List selectArticleListForAgency(@Param("customerId") String customerId);
+ //@DataFilter(tableAliases = "a")
+ List selectArticleListForAgency(@Param("customerId") String customerId, @Param("tagIdList") List tagIdList);
/**
* 已发布列表---网格工作人员
* @author zhaoqifeng
- * @date 2020/6/2 16:59
+ * @date 2020/6/5 16:35
* @param customerId
+ * @param tagIdList
* @param gridList
* @return java.util.List
*/
@DataFilter(tableAliases = {"a", "apr"}, gridIdArgName = "gridList")
- List selectArticleListForGrid(@Param("customerId") String customerId, Set gridList);
+ List selectArticleListForGrid(@Param("customerId") String customerId,
+ @Param("tagIdList") List tagIdList, Set gridList);
/**
* 已下线文章列表
@@ -134,4 +137,11 @@ public interface ArticleDao extends BaseDao {
* @date 2020.06.03 18:28
**/
ArticleDetailResultDTO selectArticleDetail(@Param("gridId")String gridId,@Param("articleId")String articleId);
+
+ /**
+ * @Description 根据draftId获取文章id
+ * @param draftId
+ * @author zxc
+ */
+ String getArticleIdByDraftId(@Param("draftId")String draftId);
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java
index 9b3ef332aa..3cae2f1f35 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticlePublishRangeDao.java
@@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ArticlePublishRangeDTO;
import com.epmet.entity.ArticlePublishRangeEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -40,4 +41,11 @@ public interface ArticlePublishRangeDao extends BaseDao selectByArticleId(ArticlePublishRangeEntity rangeEntity);
+
+ /**
+ * @Description 根据草稿id查询发布范围id集合
+ * @param draftId
+ * @author zxc
+ */
+ List selectGridIdByDraftId(@Param("draftId")String draftId);
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleTagsDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleTagsDao.java
index 44852adba8..4bba49e743 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleTagsDao.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/ArticleTagsDao.java
@@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.form.AddArticleTagsFormDTO;
import com.epmet.entity.ArticleTagsEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* 文章标签表
@@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ArticleTagsDao extends BaseDao {
+
+ /**
+ * @Description 插入文章标签
+ * @param addArticleTags
+ * @author zxc
+ */
+ void addArticleTags(@Param("addArticleTags")List addArticleTags);
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftContentDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftContentDao.java
index 3c7af386a0..1abca178e0 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftContentDao.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftContentDao.java
@@ -18,7 +18,6 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
-import com.epmet.dto.DraftContentDTO;
import com.epmet.entity.DraftContentEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -42,5 +41,14 @@ public interface DraftContentDao extends BaseDao {
* @author wangc
* @date 2020.06.05 10:28
**/
- List selectByDraftId(@Param("draftId")String draftId,@Param("auditStatus")String auditStatus);
+ List selectByDraftId(@Param("draftId")String draftId,@Param("auditStatus")String auditStatus);
+
+ /**
+ * desc:查询需要审核的内容
+ * @param draftId
+ * @return
+ */
+ List selectScanContentByDraftId(String draftId);
+
+ int updateAuditStatusById(@Param("id")String id, @Param("auditStatus")String auditStatus);
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftCoverDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftCoverDao.java
index bcf58361e1..d9bec5bd34 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftCoverDao.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/DraftCoverDao.java
@@ -23,8 +23,6 @@ import com.epmet.entity.DraftCoverEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
-import java.util.List;
-
/**
* 草稿封面表
*
@@ -42,5 +40,16 @@ public interface DraftCoverDao extends BaseDao {
* @author wangc
* @date 2020.06.05 10:28
**/
- DraftCoverDTO selectByDraftId(@Param("draftId")String draftId,@Param("auditStatus")String auditStatus);
+ DraftCoverEntity selectByDraftId(@Param("draftId")String draftId,@Param("auditStatus")String auditStatus);
+
+ /**
+ * @Description 通过草稿Id 获取未删除的草稿封面id及地址
+ * @param draftId
+ * @return DraftCoverDTO
+ * @author wangc
+ * @date 2020.06.05 10:28
+ **/
+ DraftCoverDTO selectCoverIdAndUrlByDraftId(@Param("draftId")String draftId);
+
+ int updateAuditStatusById(@Param("id")String id, @Param("auditStatus")String auditStatus);
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java
index af76d0fdad..2c40c98331 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java
@@ -18,8 +18,10 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.form.UpdateTagFormDTO;
import com.epmet.entity.TagCustomerEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
/**
* 客户标签表
@@ -29,5 +31,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface TagCustomerDao extends BaseDao {
-
+
+ /**
+ * @Description 校验此标签数据库是否存在 ? 不存在insert : 存在update useCount+1 ; 返回id
+ * @param formDTO
+ * @author zxc
+ */
+ void checkTagInfo(UpdateTagFormDTO formDTO);
+
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagGridDao.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagGridDao.java
index ac6dbaf6fe..8dc949f8cd 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagGridDao.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagGridDao.java
@@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.form.UpdateGridTagsFormDTO;
import com.epmet.entity.TagGridEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
/**
* 网格标签表
@@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface TagGridDao extends BaseDao {
+
+ /**
+ * @Description 更新网格下的标签,标签存在?使用次数+1:插入新数据
+ * @param gridTags
+ * @author zxc
+ */
+ void updateGridTag(@Param("gridTags") List gridTags,@Param("userId")String userId);
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java
index 48dcb2a23c..2c61830779 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/redis/TagRedis.java
@@ -18,6 +18,7 @@
package com.epmet.redis;
import com.epmet.commons.tools.constant.NumConstant;
+import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.constant.TagConstant;
import com.epmet.dto.form.CorrelationTagListFormDTO;
@@ -25,28 +26,34 @@ import com.epmet.dto.form.TagCascadeListFormDTO;
import com.epmet.dto.result.CorrelationTagListResultDTO;
import com.epmet.dto.result.TagInfoResultDTO;
import com.epmet.dto.result.TagRankResultDTO;
+import com.epmet.dto.result.UpdateTagUseCountsResultDTO;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.poi.ss.formula.functions.T;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataAccessException;
+import org.springframework.data.redis.connection.RedisConnection;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
+@Slf4j
@Component
public class TagRedis {
@Autowired
private RedisUtils redisUtils;
+ @Autowired
+ private RedisTemplate redisTemplate;
public void delete(Object[] ids) {
}
public void set(){
-
}
/**
@@ -81,6 +88,7 @@ public class TagRedis {
for (Object object : objects) {
resultList.add(objectToDTO(object,CorrelationTagListResultDTO.class));
}
+// resultList = JSONObject.parseArray(objects.toString(), CorrelationTagListResultDTO.class);
//级联标签排序
//1.取出 zset 中的有序标签,根据级联标签,筛选有序标签
List resultEquals = new ArrayList<>();
@@ -128,6 +136,7 @@ public class TagRedis {
for (Object object : objects) {
result.add(objectToDTO(object,TagInfoResultDTO.class));
}
+// List tagInfoResultDTOS = JSONObject.parseArray(objects.toString(), TagInfoResultDTO.class);
return result;
}
@@ -224,4 +233,41 @@ public class TagRedis {
return t;
}
+ /**
+ * @Description 更新标签使用次数
+ * @param key
+ * @param formDTO
+ * @author zxc
+ */
+ public Double updateTagUseCounts(String key, Object formDTO){
+ return redisUtils.zIncrementScore(key, formDTO, NumConstant.ONE);
+ }
+
+ /**
+ * @Description set 更新标签级联
+ * @param key
+ * @param value
+ * @author zxc
+ */
+ public void updateMoreTag(String key, Set value) {
+ try {
+ log.info(TagConstant.BEGIN_UPDATE);
+ redisTemplate.executePipelined(new RedisCallback>() {
+ @Override
+ public Set doInRedis(RedisConnection connection) throws DataAccessException {
+ for (UpdateTagUseCountsResultDTO tag : value) {
+ connection.sAdd(redisTemplate.getKeySerializer().serialize(key),redisTemplate.getValueSerializer().serialize(tag));
+ }
+ return null;
+ }
+ });
+ log.info(TagConstant.SUCCESS_UPDATE);
+ }catch (Exception e){
+ log.info(TagConstant.FAILURE_UPDATE);
+ throw new RenException(TagConstant.FAILURE_UPDATE);
+ }
+ }
+
+
+
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
index 4e8613f908..3fa1c7c49b 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
@@ -19,17 +19,13 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.dto.TokenDto;
-import com.epmet.dto.ArticleDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
-import com.epmet.dto.form.ArticlePageFormDTO;
-import com.epmet.dto.form.CommonArticleListFormDTO;
import com.epmet.entity.ArticleEntity;
-
import java.util.List;
-import java.util.Map;
/**
* 文章表
@@ -39,66 +35,6 @@ import java.util.Map;
*/
public interface ArticleService extends BaseService {
- /**
- * 默认分页
- *
- * @param params
- * @return PageData
- * @author generator
- * @date 2020-06-02
- */
- PageData page(Map params);
-
- /**
- * 默认查询
- *
- * @param params
- * @return java.util.List
- * @author generator
- * @date 2020-06-02
- */
- List list(Map params);
-
- /**
- * 单条查询
- *
- * @param id
- * @return ArticleDTO
- * @author generator
- * @date 2020-06-02
- */
- ArticleDTO get(String id);
-
- /**
- * 默认保存
- *
- * @param dto
- * @return void
- * @author generator
- * @date 2020-06-02
- */
- void save(ArticleDTO dto);
-
- /**
- * 默认更新
- *
- * @param dto
- * @return void
- * @author generator
- * @date 2020-06-02
- */
- void update(ArticleDTO dto);
-
- /**
- * 批量删除
- *
- * @param ids
- * @return void
- * @author generator
- * @date 2020-06-02
- */
- void delete(String[] ids);
-
/**
* @param tokenDTO
* @return
@@ -231,12 +167,20 @@ public interface ArticleService extends BaseService {
**/
ArticleDetailResultDTO getArticleDetail(ResiArticleDetailFormDTO articleDetailFormDTO);
- /**
- * @Description 草稿发布文章
- * @param draftId
- * @return String 返回新发布文章的Id
- * @author wangc
- * @date 2020.06.05 09:10
- **/
- String publishDraftToArticle(String draftId);
+ /**
+ * desc:执行审核返回执行结果
+ * @param tokenDto
+ * @param draftId
+ * @return
+ */
+ SyncScanResult scanContent(TokenDto tokenDto, String draftId);
+
+ void scanAllPassPublishArticle(TokenDto tokenDto, String draftId);
+
+ /**
+ * desc:修改审核状态为失败
+ * @param draftId
+ * @param syncScanResult
+ */
+ void updateAuditStatusFailById(String draftId, SyncScanResult syncScanResult);
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/TagCustomerService.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/TagCustomerService.java
index 5747f098e8..3ecb3c49c1 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/TagCustomerService.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/TagCustomerService.java
@@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.TagCustomerDTO;
+import com.epmet.dto.result.UpdateTagUseCountsResultDTO;
import com.epmet.entity.TagCustomerEntity;
import java.util.List;
@@ -92,4 +93,11 @@ public interface TagCustomerService extends BaseService {
* @date 2020-06-02
*/
void delete(String[] ids);
+
+ /**
+ * @Description 查询标签信息
+ * @param tagName
+ * @author zxc
+ */
+ UpdateTagUseCountsResultDTO checkTagInfo(String tagName,String customerId,String userId);
}
\ No newline at end of file
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 37c457dc52..196b8cc9f7 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
@@ -18,33 +18,38 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
+import com.epmet.commons.tools.scan.param.ImgScanParamDTO;
+import com.epmet.commons.tools.scan.param.ImgTaskDTO;
+import com.epmet.commons.tools.scan.param.TextScanParamDTO;
+import com.epmet.commons.tools.scan.param.TextTaskDTO;
+import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
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.ArticleConstant;
-import com.epmet.constant.DraftConstant;
-import com.epmet.constant.RoleKeyConstants;
+import com.epmet.constant.*;
import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
+import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.redis.ArticleRedis;
+import com.epmet.redis.TagRedis;
import com.epmet.service.*;
import com.epmet.utils.ModuleConstant;
import com.github.pagehelper.PageHelper;
@@ -52,7 +57,9 @@ import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.helper.StringUtil;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -98,6 +105,27 @@ public class ArticleServiceImpl extends BaseServiceImpl page(Map params) {
- IPage page = baseDao.selectPage(
- getPage(params, FieldConstant.CREATED_TIME, false),
- getWrapper(params)
- );
- return getPageData(page, ArticleDTO.class);
- }
-
- @Override
- public List list(Map params) {
- List entityList = baseDao.selectList(getWrapper(params));
-
- return ConvertUtils.sourceToTarget(entityList, ArticleDTO.class);
- }
-
- private QueryWrapper getWrapper(Map params) {
- String id = (String) params.get(FieldConstant.ID_HUMP);
-
- QueryWrapper wrapper = new QueryWrapper<>();
- wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
-
- return wrapper;
- }
-
- @Override
- public ArticleDTO get(String id) {
- ArticleEntity entity = baseDao.selectById(id);
- return ConvertUtils.sourceToTarget(entity, ArticleDTO.class);
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void save(ArticleDTO dto) {
- ArticleEntity entity = ConvertUtils.sourceToTarget(dto, ArticleEntity.class);
- insert(entity);
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void update(ArticleDTO dto) {
- ArticleEntity entity = ConvertUtils.sourceToTarget(dto, ArticleEntity.class);
- updateById(entity);
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void delete(String[] ids) {
- // 逻辑删除(@TableLogic 注解)
- baseDao.deleteBatchIds(Arrays.asList(ids));
- }
-
/**
* @param tokenDTO
* @return
@@ -268,7 +244,17 @@ public class ArticleServiceImpl extends BaseServiceImpl articleContentList = baseDao.queryGovArticleContent(articleId);
- articleDetail.setArticleContentList(articleContentList);
+ if(null!=articleContentList&&articleContentList.size()>0){
+ articleDetail.setArticleContentList(articleContentList);
+ }else{
+ articleDetail.setArticleContentList(new ArrayList<>());
+ }
+ if (StringUtils.isNoneBlank(articleDetail.getTags())) {
+ String[] tagNames = articleDetail.getTags().split("\\|");
+ articleDetail.setTagNameList(tagNames);
+ }else{
+ articleDetail.setTagNameList(new String[0]);
+ }
}
return articleDetail;
}
@@ -408,7 +394,7 @@ public class ArticleServiceImpl extends BaseServiceImpl resultStaff = epmetUserOpenFeignClient.getCustomerStaff(formDTO.getStaffId());
- if (!resultStaff.success() || null == resultStaff.getData()) {
- throw new RenException(ArticleConstant.SELECT_STAFF_EXCEPTION);
- }
- CustomerStaffDTO staffDTO = resultStaff.getData();
+ CustomerStaffDTO staffDTO = getCustomerStaff(formDTO.getStaffId());
//4.2:查询文章表数据
ArticleEntity articleEntity = baseDao.selectById(formDTO.getArticleId());
//4.3:新增操作表数据
@@ -561,6 +545,14 @@ public class ArticleServiceImpl extends BaseServiceImpl resultStaff = epmetUserOpenFeignClient.getCustomerStaff(userId);
+ if (!resultStaff.success() || null == resultStaff.getData()) {
+ throw new RenException(ArticleConstant.SELECT_STAFF_EXCEPTION);
+ }
+ return resultStaff.getData();
+ }
+
@Override
public PageData publishedArticleList(TokenDto tokenDto, PublishedListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize());
@@ -586,10 +578,16 @@ public class ArticleServiceImpl extends BaseServiceImpl {
+ String tags = result.getTags();
+ List tagList = new ArrayList<>();
+ tagList= Arrays.asList(tags.split("[|]"));
+ result.setTagNameList(tagList);
+ });
PageInfo pageInfo = new PageInfo<>(resultList);
return new PageData<>(resultList, pageInfo.getTotal());
}
@@ -828,20 +826,22 @@ public class ArticleServiceImpl extends BaseServiceImpl draftContents = draftContentDao.selectByDraftId(draftId,ModuleConstant.AUDIT_STATUS_PASS);
- DraftCoverDTO draftCover = draftCoverDao.selectByDraftId(draftId,ModuleConstant.AUDIT_STATUS_PASS);
+ String draftId = draft.getId();
+ List draftContents = draftContentDao.selectByDraftId(draftId,ModuleConstant.AUDIT_STATUS_PASS);
+ DraftCoverEntity draftCover = draftCoverDao.selectByDraftId(draftId,ModuleConstant.AUDIT_STATUS_PASS);
List draftPublishRange = draftPublishRangeDao.selectByDraftId(draftId);
//3.生成文章以及相关记录
@@ -857,6 +857,9 @@ public class ArticleServiceImpl extends BaseServiceImpl NumConstant.ZERO){
@@ -871,13 +874,283 @@ public class ArticleServiceImpl extends BaseServiceImpl contentDTOList = draftContentDao.selectScanContentByDraftId(draftId);
+ if(!CollectionUtils.isEmpty(contentDTOList)){
+ contentDTOList.forEach(content->{
+ String contentType = content.getContentType();
+ if (DraftConstant.TEXT.equals(contentType)){
+ //todo 内容叠加审核吧 id拼起来
+ TextTaskDTO textTaskDTO = new TextTaskDTO();
+ textTaskDTO.setDataId(content.getId());
+ textTaskDTO.setContent(content.getContent());
+ }else if (DraftConstant.IMG.equals(contentType)){
+ ImgTaskDTO taskDTO = new ImgTaskDTO();
+ taskDTO.setDataId(content.getId());
+ taskDTO.setUrl(content.getContent());
+ imgScanParamDTO.getTasks().add(taskDTO);
+ }
+ });
+ }
+
+ //todo 执行审核
+ SyncScanResult imgSyncScanResult = ScanContentUtils.imgSyncScan(scanApiHost.concat(imgSyncScanMethod),imgScanParamDTO);
+ SyncScanResult textSyncScanResult = ScanContentUtils.textSyncScan(scanApiHost.concat(textSyncScanMethod),textScanParamDTO);
+ SyncScanResult result = new SyncScanResult();
+ if (imgSyncScanResult.isAllPass()){
+ result.setAllPass(imgSyncScanResult.isAllPass());
+ result.getSuccessDataIds().addAll(imgSyncScanResult.getSuccessDataIds());
+ result.getFailDataIds().addAll(imgSyncScanResult.getFailDataIds());
+ }
+ if (textSyncScanResult.isAllPass()){
+ result.setAllPass(result.isAllPass()?textSyncScanResult.isAllPass():false);
+ result.getSuccessDataIds().addAll(textSyncScanResult.getSuccessDataIds());
+ result.getFailDataIds().addAll(textSyncScanResult.getFailDataIds());
+ }
+
+ return result;
+ }
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void scanAllPassPublishArticle(TokenDto tokenDto, String draftId){
+ DraftEntity draft = draftDao.selectById(draftId);
+ if (draft == null){
+ throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode(),EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg());
+ }
+ try {
+ //审核通过
+ ArticleEntity articleEntity = this.publishDraftToArticle(draft);
+ UpdateCustomerTagCacheDTO updateCustomerTagCacheDTO = this.updateCustomerTag(tokenDto, draftId);
+ List updateGridTagCacheDTOS = this.updateGridTag(tokenDto, draftId, updateCustomerTagCacheDTO);
+
+ //更新redis
+ try {
+ this.updateCacheCustomerTag(updateCustomerTagCacheDTO);
+ this.updateCacheGridTag(updateGridTagCacheDTOS);
+ } catch (Exception e) {
+ log.error("scanAllPassPublishArticle update redis exception", e);
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
+ }
+ } catch (Exception e) {
+ log.error("scanAllPassPublishArticle update db exception", e);
+ this.sendMsg(draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
+ }
+
+
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ @Override
+ public void updateAuditStatusFailById(String draftId,SyncScanResult syncScanResult) {
+ List failDataIds = syncScanResult.getFailDataIds();
+ failDataIds.forEach(id->{
+ if (id.indexOf(ModuleConstant.SCAN_COVER_PREFIX)>=0){
+ draftCoverDao.updateAuditStatusById(id,ModuleConstant.AUDIT_STATUS_FAIL);
+ }else{
+ draftContentDao.updateAuditStatusById(id,ModuleConstant.AUDIT_STATUS_FAIL);
+ }
+ });
+ }
+
+ public Result sendMsg(String title,String content) {
+ UserMessageFormDTO formDTO = new UserMessageFormDTO();
+ formDTO.setCustomerId(loginUserUtil.getLoginUserApp());
+ formDTO.setGridId("");
+ formDTO.setUserId(loginUserUtil.getLoginUserId());
+ formDTO.setApp(AppClientConstant.APP_GOV);
+ formDTO.setTitle(String.format(ModuleConstant.MSG_TITLE,title));
+ formDTO.setMessageContent(content);
+ formDTO.setReadFlag(ReadFlagConstant.UN_READ);
+
+ return epmetMessageOpenFeignClient.saveUserMessage(formDTO);
+ }
+
+ /**
+ * @Description 更新DB的标签使用次数 政府端
+ * @param draftId
+ * @author zxc
+ */
+ public UpdateCustomerTagCacheDTO updateCustomerTag(TokenDto tokenDto, String draftId){
+ //获取草稿基本信息
+ DraftDTO draft = draftService.get(draftId);
+ String tags = draft.getTags();
+ String customerId = draft.getCustomerId();
+ String userId = tokenDto.getUserId();
+ List tagsList = Arrays.asList(tags.split("\\|"));
+ List tagsInfo = new ArrayList<>();
+ //政府端的 标签使用次数 DB
+ for (String tag : tagsList) {
+ UpdateTagUseCountsResultDTO updateTagUseCount = tagCustomerService.checkTagInfo(tag, customerId, userId);
+ tagsInfo.add(updateTagUseCount);
+ }
+ UpdateCustomerTagCacheDTO result = new UpdateCustomerTagCacheDTO();
+ result.setCustomerId(customerId);
+ result.setTagsInfo(tagsInfo);
+ return result;
+ }
+
+ /**
+ * @Description 更新redis 标签使用数量 和 标签级联 政府端
+ * @param formDto
+ * @author zxc
+ */
+ public void updateCacheCustomerTag(UpdateCustomerTagCacheDTO formDto){
+ List tagsInfo = formDto.getTagsInfo();
+ String customerId = formDto.getCustomerId();
+ //更新缓存标签使用数量
+ for (UpdateTagUseCountsResultDTO resultDTO : tagsInfo) {
+ String customerKey = TagConstant.GOV_TAG_KEY+customerId;
+ tagRedis.updateTagUseCounts(customerKey,resultDTO);
+ }
+
+ //政府端更新redis的级联标签(set)
+ List tagsInfoCopy = new ArrayList<>();
+ for (int i = 0; i < tagsInfo.size(); i++) {
+ tagsInfoCopy.addAll(tagsInfo);
+ String key = TagConstant.GOV_RETAG_KEY+customerId+TagConstant.COLON+tagsInfo.get(i).getTagId();
+ tagsInfoCopy.remove(tagsInfo.get(i));
+ Set setTag = new HashSet<>(tagsInfoCopy);
+ tagRedis.updateMoreTag(key,setTag);
+ tagsInfoCopy.clear();
+ }
+ }
+
+ /**
+ * @Description 更新数据库 网格下的标签使用数量 居民端
+ * @param draftId
+ * @param formDto
+ * @author zxc
+ */
+ public List updateGridTag(TokenDto tokenDto,String draftId,UpdateCustomerTagCacheDTO formDto){
+ //获取草稿基本信息
+ DraftDTO draft = draftService.get(draftId);
+ String customerId = draft.getCustomerId();
+ List tagsInfo = formDto.getTagsInfo();
+ String userId = tokenDto.getUserId();
+ //根据草稿id查询发布范围id集合
+ List gridIds = articlePublishRangeDao.selectGridIdByDraftId(draftId);
+ if (gridIds.size() == NumConstant.ZERO){
+ throw new RenException(TagConstant.SELECT_GRIDIDLIST_FAILURE);
+ }
+ List gridTags = new ArrayList<>();
+ List gridTagCache = new ArrayList<>();
+ for (String gridId : gridIds) {
+ UpdateGridTagCacheDTO cache = new UpdateGridTagCacheDTO();
+ cache.setGridId(gridId);
+ cache.setTagsInfo(tagsInfo);
+ gridTagCache.add(cache);
+ for (UpdateTagUseCountsResultDTO resultDTO : tagsInfo) {
+ UpdateGridTagsFormDTO tag = new UpdateGridTagsFormDTO();
+ BeanUtils.copyProperties(resultDTO,tag);
+ tag.setCreatedBy(userId);
+ tag.setUpdatedBy(userId);
+ tag.setCustomerId(customerId);
+ tag.setGridId(gridId);
+ gridTags.add(tag);
+ }
+ }
+ tagGridDao.updateGridTag(gridTags,userId);
+ return gridTagCache;
+ }
+
+ /**
+ * @Description 更新redis 网格下的 标签使用数量 和 级联标签 居民端
+ * @param gridTagCache
+ * @author zxc
+ */
+ public void updateCacheGridTag(List gridTagCache){
+ //更新 网格下 标签使用数量
+ List gridTagCacheCopy = new ArrayList<>();
+ for (UpdateGridTagCacheDTO cacheDTO : gridTagCache) {
+ String gridId = cacheDTO.getGridId();
+ String key = TagConstant.GRID_TAG_KEY+gridId;
+ List tagsInfo = cacheDTO.getTagsInfo();
+ for (UpdateTagUseCountsResultDTO resultDTO : tagsInfo) {
+ tagRedis.updateTagUseCounts(key,resultDTO);
+ }
+ //级联
+ for (int i = 0; i < tagsInfo.size(); i++) {
+ gridTagCacheCopy.addAll(tagsInfo);
+ String moreKey = TagConstant.GRID_RETAG_KEY+gridId+TagConstant.COLON+tagsInfo.get(i).getTagId();
+ gridTagCacheCopy.remove(tagsInfo.get(i));
+ Set setTag = new HashSet<>(gridTagCacheCopy);
+ tagRedis.updateMoreTag(moreKey,setTag);
+ gridTagCacheCopy.clear();
+ }
+ }
+ }
+
+ /**
+ * @Description 给文章挂标签 article_tags
+ * @param formDto
+ * @author zxc
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public void addArticleTags(UpdateCustomerTagCacheDTO formDto,String draftId,TokenDto tokenDto){
+ List addArticleTags = new ArrayList<>();
+ List tagsInfo = formDto.getTagsInfo();
+ DraftDTO draft = draftService.get(draftId);
+ String customerId = draft.getCustomerId();
+ String userId = tokenDto.getUserId();
+ String articleId = articleDao.getArticleIdByDraftId(draftId);
+ for (UpdateTagUseCountsResultDTO resultDTO : tagsInfo) {
+ AddArticleTagsFormDTO addArticleTag = new AddArticleTagsFormDTO();
+ addArticleTag.setCreatedBy(userId);
+ addArticleTag.setUpdatedBy(userId);
+ addArticleTag.setCustomerId(customerId);
+ addArticleTag.setArticleId(articleId);
+ BeanUtils.copyProperties(resultDTO,addArticleTag);
+ addArticleTags.add(addArticleTag);
+ }
+ articleTagsDao.addArticleTags(addArticleTags);
+ }
}
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java
index 1cd8271353..4b3bd768d3 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/DraftServiceImpl.java
@@ -44,6 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -161,10 +162,16 @@ public class DraftServiceImpl extends BaseServiceImpl imp
DraftDetailResultDTO draftDetailResultDTO=baseDao.selectDraftDetail(formDTO.getDraftId());
if(null!=draftDetailResultDTO){
List articleContentList=baseDao.selectDraftContentList(formDTO.getDraftId());
- draftDetailResultDTO.setArticleContentList(articleContentList);
+ if (null != articleContentList && articleContentList.size() > 0) {
+ draftDetailResultDTO.setArticleContentList(articleContentList);
+ } else {
+ draftDetailResultDTO.setArticleContentList(new ArrayList<>());
+ }
if (StringUtils.isNoneBlank(draftDetailResultDTO.getTags())) {
String[] tagNames = draftDetailResultDTO.getTags().split("\\|");
draftDetailResultDTO.setTagNameList(tagNames);
+ }else{
+ draftDetailResultDTO.setTagNameList(new String[0]);
}
}
return draftDetailResultDTO;
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java
index 8094215a25..95794c7367 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java
@@ -25,6 +25,8 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.TagCustomerDao;
import com.epmet.dto.TagCustomerDTO;
+import com.epmet.dto.form.UpdateTagFormDTO;
+import com.epmet.dto.result.UpdateTagUseCountsResultDTO;
import com.epmet.entity.TagCustomerEntity;
import com.epmet.redis.TagCustomerRedis;
import com.epmet.service.TagCustomerService;
@@ -101,4 +103,20 @@ public class TagCustomerServiceImpl extends BaseServiceImpl resiTagList(ResiTagListFormDTO formDto) {
- //校验 在本网格是否发布过文章
+ //校验 客户在本网格是否发布过文章
Integer articleCounts = articleDao.checkPublishArticle(formDto);
if (articleCounts== NumConstant.ZERO){
return new ArrayList<>();
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java
index e3df228591..d9cc1d429c 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java
@@ -64,4 +64,24 @@ public interface ModuleConstant {
* */
String SPECIFIED_DRAFT_NOT_FOUNT_EXCEPTION_TEMPLATE = "未找到指定草稿,草稿Id:【%s】";
+ /**
+ * 内容审核 封面图片前缀,用于标识这个Id是封面图片
+ * */
+ String SCAN_COVER_PREFIX = "cover_";
+
+ /**
+ * 文章站内消息标题
+ * */
+ String MSG_TITLE = "您有一条文章【%s】的消息";
+
+ /**
+ * 文章未审核通过 消息内容模版
+ * */
+ String MSG_AUDIT_CONTENT = "您好,您发布的【%s】文章%s审核未通过,请重新编辑后发布,谢谢。";
+
+ /**
+ * 文章发布失败 内部错误导致
+ * */
+ String MSG_ARTICLE_PUBLISH_ERROR = "您好,你发布的【%s】文章由于网络错误未发布成功,请重新发布,谢谢。";
+
}
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/bootstrap.yml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/bootstrap.yml
index 44acc86548..914db91435 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/bootstrap.yml
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/bootstrap.yml
@@ -102,3 +102,11 @@ hystrix:
ribbon:
ReadTimeout: 300000
ConnectTimeout: 300000
+
+openapi:
+ scan:
+ server:
+ host: http://localhost:8107/epmetscan/api
+ mehod:
+ imgSyncScan: /imgSyncScan
+ textSyncScan: /textSyncScan
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml
index cb1817ed58..d3be4c7e2f 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleDao.xml
@@ -34,16 +34,17 @@
ORDER BY
ac.ORDER_NUM ASC
+
+
@@ -287,4 +314,19 @@
AND art.ID = #{articleId}
ORDER BY content2.ORDER_NUM ASC
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml
index 0052c7414a..e816e10d0d 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticlePublishRangeDao.xml
@@ -18,4 +18,18 @@
ORDER BY created_time ASC
+
+
+
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleTagsDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleTagsDao.xml
index d4dcad3ce6..974966df8c 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleTagsDao.xml
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/ArticleTagsDao.xml
@@ -3,5 +3,14 @@
+
+
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftContentDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftContentDao.xml
index 271ba5b972..6f13de52b5 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftContentDao.xml
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftContentDao.xml
@@ -4,7 +4,7 @@
-
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftCoverDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftCoverDao.xml
index 03f8a04596..740bde510d 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftCoverDao.xml
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftCoverDao.xml
@@ -4,7 +4,7 @@
-
+
SELECT
cover.CUSTOMER_ID,
cover.IMG_URL,
@@ -14,12 +14,18 @@
DRAFT_COVER cover
cover.DRAFT_ID = #{draftId}
- AND cover.DEL_FLAG = '0'
+ AND cover.DEL_FLAG = 0
AND cover.AUDIT_STATUS = #{auditStatus}
AND NOT EXISTS ( SELECT 1 FROM DRAFT_COVER WHERE cover.CREATED_TIME CREATED_TIME )
+
+ SELECT ID,IMG_URL FROM DRAFT_COVER WHERE DEL_FLAG = 0 AND DRAFT_ID = #{draftId,jdbcType=VARCHAR}
+
+
+ UPDATE DRAFT_COVER SET AUDIT_STATUS = #{auditStatus,jdbcType=VARCHAR} WHERE ID = #{id,jdbcType=VARCHAR}
+
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml
index 21234d2e14..6520094e27 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml
@@ -3,5 +3,25 @@
+
+
+ select id from tag_customer where tag_name = #{tagName}
+
+ INSERT INTO tag_customer ( ID, CUSTOMER_ID, TAG_NAME, USE_COUNT, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
+ VALUES
+ (REPLACE ( UUID(), '-', '' ),
+ #{customerId},
+ #{tagName},
+ #{useCount},
+ #{delFlag},
+ #{revision},
+ #{createdBy},
+ NOW(),
+ #{updatedBy},
+ NOW())
+ ON DUPLICATE KEY UPDATE USE_COUNT = ( USE_COUNT + 1 ),
+ UPDATED_TIME = NOW(),
+ UPDATED_BY = #{updatedBy};
+
\ No newline at end of file
diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagGridDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagGridDao.xml
index 7346056561..c3000b425c 100644
--- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagGridDao.xml
+++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagGridDao.xml
@@ -3,5 +3,19 @@
+
+
+ INSERT INTO tag_grid ( ID, CUSTOMER_ID, GRID_ID, TAG_ID, TAG_NAME, USE_COUNT, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
+ VALUES
+
+ ( REPLACE ( UUID(), '-', '' ),#{tag.customerId}, #{tag.gridId}, #{tag.tagId}, #{tag.tagName}, #{
+ tag.useCount}, #{tag.delFlag},
+ #{tag.revision}, #{tag.createdBy}, NOW(),#{tag.updatedBy}, NOW())
+
+ ON DUPLICATE KEY UPDATE
+ USE_COUNT = ( USE_COUNT + 1 ),
+ UPDATED_TIME = NOW(),
+ UPDATED_BY = #{userId}
+
\ No newline at end of file
diff --git a/epmet-module/resi-voice/resi-voice-server/Dockerfile b/epmet-module/resi-voice/resi-voice-server/Dockerfile
index 88b6575415..ae49b60d2b 100644
--- a/epmet-module/resi-voice/resi-voice-server/Dockerfile
+++ b/epmet-module/resi-voice/resi-voice-server/Dockerfile
@@ -6,6 +6,6 @@ RUN echo 'Asia/Shanghai' > /etc/timezone
COPY ./target/*.jar ./app.jar
-EXPOSE 8102
+EXPOSE 8106
ENTRYPOINT ["sh", "-c", "$RUN_INSTRUCT"]
\ No newline at end of file
diff --git a/epmet-module/resi-voice/resi-voice-server/deploy/docker-compose-dev.yml b/epmet-module/resi-voice/resi-voice-server/deploy/docker-compose-dev.yml
index b68e4db049..e6a2a7398c 100644
--- a/epmet-module/resi-voice/resi-voice-server/deploy/docker-compose-dev.yml
+++ b/epmet-module/resi-voice/resi-voice-server/deploy/docker-compose-dev.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
resi-voice-server:
container_name: resi-voice-server-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/resi-voice-server:0.3.3
+ image: 192.168.1.130:10080/epmet-cloud-dev/resi-voice-server:0.3.5
ports:
- "8106:8106"
network_mode: host # 使用现有网络
diff --git a/epmet-module/resi-voice/resi-voice-server/pom.xml b/epmet-module/resi-voice/resi-voice-server/pom.xml
index 0950813731..73834ed5e1 100644
--- a/epmet-module/resi-voice/resi-voice-server/pom.xml
+++ b/epmet-module/resi-voice/resi-voice-server/pom.xml
@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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.3
+ 0.3.5
resi-voice
com.epmet
@@ -113,7 +113,7 @@
true
-->
- 8104
+ 8106
test
diff --git a/epmet-openapi/epmet-openapi-scan/Dockerfile b/epmet-openapi/epmet-openapi-scan/Dockerfile
new file mode 100644
index 0000000000..e619f718b9
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/Dockerfile
@@ -0,0 +1,11 @@
+FROM java:8
+
+RUN export LANG="zh_CN.UTF-8"
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
+RUN echo 'Asia/Shanghai' > /etc/timezone
+
+COPY ./target/*.jar ./app.jar
+
+EXPOSE 8107
+
+ENTRYPOINT ["sh", "-c", "$RUN_INSTRUCT"]
\ No newline at end of file
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 e7da7128f7..2c9510bc45 100644
--- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml
+++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml
@@ -1,8 +1,8 @@
version: "3.7"
services:
- epmet-user-server:
+ epmet-openapi-scan:
container_name: epmet-openapi-scan-dev
- image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.1
+ image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.3
ports:
- "8107:8107"
network_mode: host # 不会创建新的网络
diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml
index eef7aaa605..0aa4c70549 100644
--- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml
+++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml
@@ -1,6 +1,6 @@
version: "3.7"
services:
- epmet-user-server:
+ epmet-openapi-scan:
container_name: epmet-openapi-scan-test
image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-user-scan:0.3.1
ports:
diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml
index 8155da8b40..75ec73ae03 100644
--- a/epmet-openapi/epmet-openapi-scan/pom.xml
+++ b/epmet-openapi/epmet-openapi-scan/pom.xml
@@ -8,7 +8,7 @@
2.0.0
4.0.0
- 0.3.1
+ 0.3.3
epmet-openapi-scan
jar
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java
new file mode 100644
index 0000000000..53eaad58d0
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java
@@ -0,0 +1,15 @@
+package com.epmet.openapi.scan.common.constant;
+
+/**
+ * 系统常量
+ *
+ * @author jianjun liu
+ * @date 2020-06-05 10:42
+ **/
+public class SysConstant {
+
+ public static final String UTF8 = "utf-8";
+
+ public static final Integer MAX_TEXT_TASKS = 100;
+ public static final Integer MAX_IMG_TASKS = 10;
+}
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
index 1fcbbba9f0..cfb8d77ac2 100644
--- 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
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
/**
+ * desc:图片检测场景
* @author jianjun liu
* @date 2020-06-04 21:39
**/
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java
new file mode 100644
index 0000000000..455b2975f4
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java
@@ -0,0 +1,48 @@
+package com.epmet.openapi.scan.common.enu;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * desc:文本检测建议
+ * @author jianjun liu
+ * @date 2020-06-04 21:39
+ **/
+public enum SuggestionEnum {
+ PASS("pass", "正常"),
+ REVIEW("review", "需要人工审核"),
+ BLOCK("block", "文本违规");
+
+ private String code;
+ private String desc;
+
+ SuggestionEnum(String code, String desc) {
+ this.code = code;
+ this.desc = desc;
+ }
+
+ public static List getImgSceneList() {
+ List result = new ArrayList<>();
+ SuggestionEnum[] values = SuggestionEnum.values();
+ for (SuggestionEnum 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/SysResponseEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java
new file mode 100644
index 0000000000..4cd76b8ca5
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java
@@ -0,0 +1,45 @@
+package com.epmet.openapi.scan.common.enu;
+
+/**
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-04 21:39
+ **/
+public enum SysResponseEnum {
+ /**
+ *
+ * 业务代码枚举类
+ *
+ * 编码样式:【CCCBBOOXX】
+ * 编码示例说明:
+ * CCC 中心编码&业务系统 (110-内容扫描服务中心服务)
+ * BB 业务类型(00-默认 )
+ * OO 操作类型(00-默认)
+ * XX 具体编码(00-成功,01-失败,02-参数错误,10-异常 99-系统错误)
+ *
+ */
+ /*通用枚举 */
+ EXCEPTION(10001,"系统异常"),
+ AUTH_FAIL(10002,"验签失败"),
+
+
+ /*审核内容 业务 01*/
+ SCAN_TASK_LIST_PARAM_ERROR(110010001,"任务列表不能为空"),
+ SCAN_PARAM_ERROR(110010002,"参数格式不正确"),
+ ;
+
+ private Integer code;
+ private String msg;
+ SysResponseEnum(Integer code, String msg){
+ this.code = code;
+ this.msg = msg;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getMsg() {
+ return msg;
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java
new file mode 100644
index 0000000000..263d6e25ed
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/TextSceneEnum.java
@@ -0,0 +1,46 @@
+package com.epmet.openapi.scan.common.enu;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * desc:文本检测场景
+ * @author jianjun liu
+ * @date 2020-06-04 21:39
+ **/
+public enum TextSceneEnum {
+ ANTISPAM("antispam", "文本垃圾内容检测");
+
+ private String code;
+ private String desc;
+
+ TextSceneEnum(String code, String desc) {
+ this.code = code;
+ this.desc = desc;
+ }
+
+ public static List getTextSceneList() {
+ List result = new ArrayList<>();
+ TextSceneEnum[] values = TextSceneEnum.values();
+ for (TextSceneEnum 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/exception/AuthException.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/AuthException.java
new file mode 100644
index 0000000000..7d0b652025
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/AuthException.java
@@ -0,0 +1,17 @@
+package com.epmet.openapi.scan.common.exception;
+
+import com.epmet.openapi.scan.common.enu.SysResponseEnum;
+
+/**
+ * @author jianjun liu
+ * @date 2020-06-05 10:31
+ **/
+public class AuthException extends RuntimeException {
+ private int code;
+ private String msg;
+
+ public AuthException() {
+ this.code = SysResponseEnum.AUTH_FAIL.getCode();
+ this.msg = SysResponseEnum.AUTH_FAIL.getMsg();
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExeCuteHttpException.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExeCuteHttpException.java
new file mode 100644
index 0000000000..99daf84bae
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/exception/ExeCuteHttpException.java
@@ -0,0 +1,23 @@
+package com.epmet.openapi.scan.common.exception;
+
+import com.epmet.commons.tools.utils.MessageUtils;
+import com.epmet.openapi.scan.common.enu.SysResponseEnum;
+
+/**
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 10:31
+ **/
+public class ExeCuteHttpException extends RuntimeException {
+ private int code;
+ private String msg;
+
+ public ExeCuteHttpException(String msg) {
+ this(SysResponseEnum.EXCEPTION.getCode(), msg);
+ }
+ public ExeCuteHttpException(int code, String... params) {
+ this.code = code;
+ this.msg = MessageUtils.getMessage(code, params);
+
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java
new file mode 100644
index 0000000000..978ca23004
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/HttpClientManager.java
@@ -0,0 +1,171 @@
+package com.epmet.openapi.scan.common.util;
+
+import com.alibaba.fastjson.JSON;
+import com.epmet.commons.tools.utils.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpStatus;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import org.springframework.util.CollectionUtils;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * desc: http 工具类
+ * date: 2020/6/4 22:27
+ *
+ * @author: jianjun liu
+ */
+@Slf4j
+public class HttpClientManager {
+ private static int connectionTimeout = 3000;// 连接超时时间,毫秒
+ private static int soTimeout = 10000;// 读取数据超时时间,毫秒
+ /**
+ * HttpClient对象
+ */
+ private static CloseableHttpClient httpclient = HttpClients.custom().disableAutomaticRetries().build();
+
+ /*** 超时设置 ****/
+ private static RequestConfig requestConfig = RequestConfig.custom()
+ .setSocketTimeout(soTimeout)
+ .setConnectTimeout(connectionTimeout)
+ .build();//设置请求和传输超时时间
+
+ public static HttpClientManager getInstance() {
+ return SingleClass.instance;
+ }
+
+ private static class SingleClass {
+ private final static HttpClientManager instance = new HttpClientManager();
+ }
+
+ /**
+ * desc: 发送json post 请求
+ * param: url,jsonStrParam
+ * return: CallResult
+ * date: 2019/2/21 9:12
+ *
+ * @author: jianjun liu
+ */
+ public Result sendPost(String url, Map paramsMap) {
+
+ try {
+ HttpPost httppost = new HttpPost(url);
+ httppost.setConfig(requestConfig);
+ httppost.addHeader("Content-Type", "application/x-www-form-urlencoded charset=utf-8");
+
+ List list = new ArrayList();
+ for (String key : paramsMap.keySet()) {
+ list.add(new BasicNameValuePair(key, String.valueOf(paramsMap.get(key))));
+ }
+ UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(list, "utf-8");
+ httppost.setEntity(urlEncodedFormEntity);
+
+ return execute(httppost);
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("send exception", e);
+ return new Result().error(8000, e.getMessage());
+ }
+
+ }
+
+ /**
+ * desc: 发送json post 请求
+ * param: url,jsonStrParam
+ * return: CallResult
+ * date: 2019/2/21 9:12
+ *
+ * @author: jianjun liu
+ */
+ public Result sendPostByJSON(String url, String jsonStrParam) {
+
+ try {
+ HttpPost httppost = new HttpPost(url);
+ httppost.setConfig(requestConfig);
+ httppost.addHeader("Content-Type", "application/json; charset=utf-8");
+ if (StringUtils.isNotEmpty(jsonStrParam)) {
+ StringEntity se = new StringEntity(jsonStrParam, "utf-8");
+ httppost.setEntity(se);
+ }
+ return execute(httppost);
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("send exception", e);
+ return new Result().error(8000, e.getMessage());
+ }
+
+ }
+
+ /**
+ * desc: 发送get请求
+ * param:url, params
+ * return: CallResult
+ * date: 2019/2/21 9:16
+ *
+ * @author: jianjun liu
+ */
+ public Result sendGet(String url, Map params) {
+
+ try {
+ URIBuilder builder = new URIBuilder(url);
+ if (!CollectionUtils.isEmpty(params)) {
+ Set set = params.keySet();
+ for (String key : set) {
+ builder.setParameter(key, params.get(key) == null ? "" : String.valueOf(params.get(key)));
+ }
+ }
+ HttpGet httpGet = new HttpGet(builder.build());
+ httpGet.setConfig(requestConfig);
+ return execute(httpGet);
+ } catch (Exception e) {
+ log.error("sendGet exception", e);
+ return new Result().error(8000, e.getMessage());
+ }
+ }
+
+ private Result execute(HttpRequestBase httpMethod) {
+ CloseableHttpResponse response = null;
+ try {
+ response = httpclient.execute(httpMethod);
+ log.debug("http send response:{}", JSON.toJSONString(response));
+ if (response != null && response.getStatusLine() != null) {
+ if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+ String result = EntityUtils.toString(response.getEntity());
+ return new Result().ok(result);
+ } else {
+ log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode());
+ }
+ }
+ } catch (Exception e) {
+ log.error("execute exception", e);
+ } finally {
+ httpMethod.releaseConnection();
+ try {
+ if (response != null) {
+ response.close();
+ }
+ } catch (IOException e) {
+ }
+ }
+ return new Result().error(8000, "系统异常");
+ }
+}
+
+
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java
new file mode 100644
index 0000000000..d9e815348c
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/IAcsClientUtil.java
@@ -0,0 +1,68 @@
+package com.epmet.openapi.scan.common.util;
+
+/**
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 10:03
+ **/
+
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.profile.DefaultProfile;
+import com.aliyuncs.profile.IClientProfile;
+import com.epmet.openapi.scan.common.enu.RegionIdEnum;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+
+@Slf4j
+@Component
+public class IAcsClientUtil {
+ private static String accessKeyId;
+ private static String secret;
+ private static String product = "Green";
+
+ private static String regionId;
+ private static String endpointName = "";
+
+ private static IClientProfile profile;
+
+
+ @PostConstruct
+ private void initProFile() {
+ profile = DefaultProfile.getProfile(regionId, accessKeyId, secret);
+ try {
+ DefaultProfile.addEndpoint(endpointName, regionId, product, RegionIdEnum.getDoMain(regionId));
+ } catch (ClientException e) {
+ log.error("initProFile exception", e.getMessage());
+ }
+ }
+
+
+ public static IAcsClient getIAcsClient() {
+ return new DefaultAcsClient(profile);
+ }
+
+ @Value("${aliyun.green.accessKeyId}")
+ public void setAccessKeyId(String accessKeyId) {
+ IAcsClientUtil.accessKeyId = accessKeyId;
+ }
+
+ @Value("${aliyun.green.accessKeySecret}")
+ public void setSecret(String secret) {
+ IAcsClientUtil.secret = secret;
+ }
+
+ @Value("${aliyun.green.regionId}")
+ public void setRegionId(String regionId) {
+ IAcsClientUtil.regionId = regionId;
+ }
+
+ @Value("${aliyun.green.regionId}")
+ public void setEndpointName(String endpointName) {
+ IAcsClientUtil.endpointName = endpointName;
+ }
+}
\ No newline at end of file
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java
new file mode 100644
index 0000000000..e98dbfd7a2
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/MapUtil.java
@@ -0,0 +1,55 @@
+package com.epmet.openapi.scan.common.util;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author jianjun liu
+ * @date 2020-06-05 16:44
+ **/
+public class MapUtil {
+ /**
+ * 将url参数转换成map
+ *
+ * @param param aa=11&bb=22&cc=33
+ * @return
+ */
+ public static Map getUrlParams(String param) {
+ Map map = new HashMap<>(0);
+ if (StringUtils.isBlank(param)) {
+ return map;
+ }
+ String[] params = param.split("&");
+ for (int i = 0; i < params.length; i++) {
+ String[] p = params[i].split("=");
+ if (p.length == 2) {
+ map.put(p[0], p[1]);
+ }
+ }
+ return map;
+ }
+
+ /**
+ * 将map转换成url
+ *
+ * @param map
+ * @return
+ */
+ public static String getUrlParamsByMap(Map map) {
+ if (map == null) {
+ return "";
+ }
+ StringBuffer sb = new StringBuffer();
+ for (Map.Entry entry : map.entrySet()) {
+ sb.append(entry.getKey() + "=" + entry.getValue());
+ sb.append("&");
+ }
+ String s = sb.toString();
+ if (s.endsWith("&")) {
+ s = StringUtils.substringBeforeLast(s, "&");
+ }
+ return s;
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/RSASignature.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/RSASignature.java
new file mode 100644
index 0000000000..c79906908d
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/RSASignature.java
@@ -0,0 +1,152 @@
+package com.epmet.openapi.scan.common.util;
+
+import org.apache.commons.codec.binary.Base64;
+import org.bouncycastle.util.encoders.UrlBase64;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.crypto.Cipher;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.security.KeyFactory;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.Signature;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+
+/**
+ * @author jianjun liu
+ * @date 2020-06-05 16:48
+ **/
+
+public class RSASignature {
+ private static final Logger LOGGER = LoggerFactory.getLogger(RSASignature.class);
+ public static final String KEY_ALGORITHM = "RSA";
+ public static final String SIGNATURE_ALGORITHM = "SHA1WithRSA";
+ public static final String ENCODING = "utf-8";
+ public static final String X509 = "X.509";
+
+ /**
+ * 获取私钥
+ *
+ * @param key
+ * @return
+ * @throws Exception
+ */
+ public static PrivateKey getPrivateKey(String key) throws Exception {
+ byte[] keyBytes = Base64.decodeBase64(key.getBytes(ENCODING));
+ PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
+ KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
+ PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
+ return privateKey;
+ }
+
+ /**
+ * 获取公钥
+ *
+ * @param key
+ * @return
+ * @throws Exception
+ */
+ public static PublicKey getPublicKey(String key) throws Exception {
+ byte[] keyBytes = Base64.decodeBase64(key.getBytes(ENCODING));
+ CertificateFactory certificateFactory = CertificateFactory.getInstance(X509);
+ InputStream in = new ByteArrayInputStream(keyBytes);
+ Certificate certificate = certificateFactory.generateCertificate(in);
+ PublicKey publicKey = certificate.getPublicKey();
+ return publicKey;
+ }
+
+ /**
+ * 使用公钥对明文进行加密,返回BASE64编码的字符串
+ *
+ * @param publicKey
+ * @param plainText
+ * @return
+ */
+ public static String encrypt(String publicKey, String plainText) {
+ try {
+ KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
+ byte[] encodedKey = Base64.decodeBase64(publicKey.getBytes(ENCODING));
+ PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey));
+ Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
+ cipher.init(Cipher.ENCRYPT_MODE, pubKey);
+ byte[] enBytes = cipher.doFinal(plainText.getBytes());
+ return new String(Base64.encodeBase64(enBytes));
+ } catch (Exception e) {
+ LOGGER.error("rsa encrypt exception: {}", e.getMessage(), e);
+ }
+ return null;
+ }
+
+ /**
+ * 使用私钥对明文密文进行解密
+ *
+ * @param privateKey
+ * @param enStr
+ * @return
+ */
+ public static String decrypt(String privateKey, String enStr) {
+ try {
+ PrivateKey priKey = getPrivateKey(privateKey);
+ Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
+ cipher.init(Cipher.DECRYPT_MODE, priKey);
+ byte[] deBytes = cipher.doFinal(Base64.decodeBase64(enStr));
+ return new String(deBytes);
+ } catch (Exception e) {
+ LOGGER.error("rsa decrypt exception: {}", e.getMessage(), e);
+ }
+ return null;
+ }
+
+ /**
+ * RSA私钥签名
+ *
+ * @param content 待签名数据
+ * @param privateKey 私钥
+ * @return 签名值
+ */
+ public static String signByPrivateKey(String content, String privateKey) {
+ try {
+ PrivateKey priKey = getPrivateKey(privateKey);
+ Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
+ signature.initSign(priKey);
+ signature.update(content.getBytes(ENCODING));
+ byte[] signed = signature.sign();
+ return new String(UrlBase64.encode(signed), ENCODING);
+ } catch (Exception e) {
+ LOGGER.error("sign error, content: {}", content, e);
+ }
+ return null;
+ }
+
+ /**
+ * 公钥验签
+ *
+ * @param content
+ * @param sign
+ * @param publicKey
+ * @return
+ */
+ public static boolean verifySignByPublicKey(String content, String sign, String publicKey) {
+ try {
+ KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
+ byte[] encodedKey = Base64.decodeBase64(publicKey.getBytes(ENCODING));
+ PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey));
+
+ Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
+ signature.initVerify(pubKey);
+ signature.update(content.getBytes(ENCODING));
+
+ return signature.verify(UrlBase64.decode(sign.getBytes(ENCODING)));
+
+ } catch (Exception e) {
+ LOGGER.error("verify sign error, content: {}, sign: {}", content, sign, e);
+ }
+ return false;
+ }
+
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/FastJsonConfiguration.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/FastJsonConfiguration.java
new file mode 100644
index 0000000000..8270a85299
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/config/FastJsonConfiguration.java
@@ -0,0 +1,52 @@
+package com.epmet.openapi.scan.config;
+
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
+
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 14:14
+ **/
+@Configuration
+public class FastJsonConfiguration {
+
+ @Bean
+ public HttpMessageConverters fastJsonHttpMessageConverters() {
+ FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
+ FastJsonConfig fastJsonConfig = new FastJsonConfig();
+
+ List fastMediaTypes = new ArrayList<>();
+
+ // 处理中文乱码问题
+ fastJsonConfig.setCharset(Charset.forName("UTF-8"));
+ fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
+ // 设置时间格式
+ fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+ fastJsonHttpMessageConverter.setSupportedMediaTypes(fastMediaTypes);
+
+ // 在转换器中添加配置信息
+ fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
+ HttpMessageConverter converter = fastJsonHttpMessageConverter;
+
+ StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
+ stringConverter.setDefaultCharset(Charset.forName("UTF-8"));
+ stringConverter.setSupportedMediaTypes(fastMediaTypes);
+
+ return new HttpMessageConverters(stringConverter, converter);
+ }
+
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java
new file mode 100644
index 0000000000..e98076abd9
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/controller/ScanController.java
@@ -0,0 +1,56 @@
+package com.epmet.openapi.scan.controller;
+
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.openapi.scan.service.impl.ScanService;
+import com.epmet.openapi.scan.support.param.ImgScanParam;
+import com.epmet.openapi.scan.support.param.TextScanParam;
+import com.epmet.openapi.scan.support.result.ImgAsyncScanResult;
+import com.epmet.openapi.scan.support.result.SyncScanResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 10:39
+ **/
+@RestController
+@RequestMapping("api")
+public class ScanController {
+
+ @Autowired
+ private ScanService scanService;
+
+
+ /**
+ * desc:图片同步检测接口
+ *
+ * @param param
+ * @return
+ */
+ @RequestMapping("imgSyncScan")
+ public Result ImgSyncScan(@RequestBody ImgScanParam param) {
+ Result scanResultResult = scanService.sendSyncImgScan(param);
+ return scanResultResult;
+ }
+
+ /**
+ * desc:文本同步检测接口
+ *
+ * @param param
+ * @return
+ */
+ @RequestMapping("textSyncScan")
+ public Result textSyncScan(@RequestBody TextScanParam param) {
+ Result scanResultResult = scanService.sendTextScan(param);
+ return scanResultResult;
+ }
+
+ @RequestMapping("imgAsyncScan")
+ public Result ImgAsyncScan(@RequestBody ImgScanParam param) {
+ Result scanResultResult = scanService.sendASyncImgScan(param);
+ return scanResultResult;
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiInterceptor.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiInterceptor.java
new file mode 100644
index 0000000000..91eb34a720
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/interceptor/ScanApiInterceptor.java
@@ -0,0 +1,113 @@
+package com.epmet.openapi.scan.interceptor;
+
+import com.epmet.openapi.scan.common.exception.AuthException;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 16:36
+ **/
+public class ScanApiInterceptor implements HandlerInterceptor {
+ private static final Logger log = LoggerFactory.getLogger(ScanApiInterceptor.class);
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
+ throws Exception {
+ Gson gson = new GsonBuilder().serializeNulls().enableComplexMapKeySerialization().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
+ Map parameterMap = request.getParameterMap();
+ String requestUrl = request.getServletPath();
+ log.info(" 请求地址为: " + requestUrl + " 请求参数为: " + gson.toJson(parameterMap));
+
+ try {
+ String timestamp = "";
+ String appkey = "";
+ String sign = "";
+ if (parameterMap.containsKey("timestamp")) {
+ timestamp = parameterMap.get("timestamp").toString();
+ //验证时间戳
+ Long timestampL = new Long(timestamp);
+ Calendar timestampCalendar = Calendar.getInstance();
+ timestampCalendar.setTimeInMillis(timestampL * 1000L);
+ //设置过期时间
+ timestampCalendar.add(Calendar.MINUTE, 10);
+ Date timestampDate = timestampCalendar.getTime();
+ Date nowDate = new Date();
+ if (timestampDate.compareTo(nowDate) < 0) {
+ throw new AuthException();
+ }
+ } else {
+ throw new AuthException();
+ }
+ if (parameterMap.containsKey("appkey")) {
+ appkey = parameterMap.get("appkey").toString();
+ } else {
+ throw new AuthException();
+ }
+ if (parameterMap.containsKey("sign")) {
+ sign = parameterMap.get("sign").toString();
+ } else {
+ throw new AuthException();
+ }
+
+ Map map2 = new HashMap();
+ map2.putAll(parameterMap);
+ map2.remove("sign");
+ /*String urls = MapUtil.getUrlParamsByMap(map2);
+ urls += "&appsecret=" + OakConfig.getApiAppSecret();
+ String newSign = MD5Util.md5(urls);
+ //log.info("拼接urls参数为:" + urls + " 服务器端签名sign为:" + newSign);
+ if (!sign.equals(newSign)) {
+ throw new AuthException();
+ return false;
+ }*/
+ return true;
+ } catch (Exception e) {
+ log.error(e.toString());
+ throw new AuthException();
+ }
+ }
+
+ @Override
+ public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
+ ModelAndView modelAndView) throws Exception {
+
+ }
+
+ @Override
+ public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
+ throws Exception {
+
+ }
+
+ private void responseJson(HttpServletResponse response, String json) throws Exception {
+ PrintWriter writer = null;
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("text/json; charset=utf-8");
+ try {
+ writer = response.getWriter();
+ writer.print(json);
+ } catch (IOException e) {
+ log.error(e.toString());
+ } finally {
+ if (writer != null) {
+ writer.close();
+ }
+ }
+ }
+
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java
new file mode 100644
index 0000000000..6f1959a2f8
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanService.java
@@ -0,0 +1,37 @@
+package com.epmet.openapi.scan.service.impl;
+
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.openapi.scan.support.param.ImgScanParam;
+import com.epmet.openapi.scan.support.param.TextScanParam;
+import com.epmet.openapi.scan.support.result.ImgAsyncScanResult;
+import com.epmet.openapi.scan.support.result.SyncScanResult;
+
+/**
+ * desc:内容扫描接口
+ *
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 13:12
+ **/
+public interface ScanService {
+ /**
+ * desc:扫描文本内容 同步
+ * @param textScanParam
+ * @return ImgAsyncScanResult
+ */
+ public Result sendTextScan(TextScanParam textScanParam);
+
+
+ /**
+ * desc:扫描图片内容 同步
+ * @param imgScanParam
+ * @return
+ */
+ public Result sendSyncImgScan(ImgScanParam imgScanParam);
+ /**
+ * desc:扫描图片内容 异步
+ * @param imgScanParam
+ * @return
+ */
+ public Result sendASyncImgScan(ImgScanParam imgScanParam);
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java
new file mode 100644
index 0000000000..9471f1935d
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java
@@ -0,0 +1,311 @@
+package com.epmet.openapi.scan.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.aliyuncs.AcsRequest;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.exceptions.ServerException;
+import com.aliyuncs.green.model.v20180509.ImageAsyncScanRequest;
+import com.aliyuncs.green.model.v20180509.ImageSyncScanRequest;
+import com.aliyuncs.green.model.v20180509.TextScanRequest;
+import com.aliyuncs.http.FormatType;
+import com.aliyuncs.http.HttpResponse;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.openapi.scan.common.constant.SysConstant;
+import com.epmet.openapi.scan.common.enu.ImgSceneEnum;
+import com.epmet.openapi.scan.common.enu.SuggestionEnum;
+import com.epmet.openapi.scan.common.enu.SysResponseEnum;
+import com.epmet.openapi.scan.common.enu.TextSceneEnum;
+import com.epmet.openapi.scan.common.exception.ExeCuteHttpException;
+import com.epmet.openapi.scan.common.util.IAcsClientUtil;
+import com.epmet.openapi.scan.support.param.ImgScanParam;
+import com.epmet.openapi.scan.support.param.ImgTask;
+import com.epmet.openapi.scan.support.param.TextScanParam;
+import com.epmet.openapi.scan.support.param.TextTask;
+import com.epmet.openapi.scan.support.result.BaseScanResult;
+import com.epmet.openapi.scan.support.result.ImgAsyncScanResult;
+import com.epmet.openapi.scan.support.result.ScanTaskResult;
+import com.epmet.openapi.scan.support.result.SyncScanResult;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+
+/**
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 13:16
+ **/
+@Slf4j
+@Service
+public class ScanServiceImpl implements ScanService {
+ @Value("${aliyun.green.regionId}")
+ private String regionId;
+ @Value("${aliyun.green.bizType}")
+ private String bizType;
+
+ @Override
+ public Result sendTextScan(TextScanParam textScanParam) {
+
+ //默认参数
+ // 鉴黄 暴恐涉政
+ textScanParam.setScenes(TextSceneEnum.getTextSceneList());
+ textScanParam.setBizType(bizType);
+
+ List textTasks = textScanParam.getTasks();
+ if (CollectionUtils.isEmpty(textTasks) || textTasks.size() > SysConstant.MAX_TEXT_TASKS) {
+ return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg());
+ }
+
+ TextScanRequest textScanRequest = new TextScanRequest();
+ textScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式
+ textScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法
+ textScanRequest.setEncoding(SysConstant.UTF8);
+ textScanRequest.setRegionId(regionId);
+
+ try {
+ textScanRequest.setHttpContent(JSON.toJSONString(textScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON);
+ } catch (UnsupportedEncodingException e) {
+ log.error("sendTextScan exception", e.getMessage());
+ }
+
+
+ /**
+ * 请务必设置超时时间
+ */
+ textScanRequest.setConnectTimeout(3000);
+ textScanRequest.setReadTimeout(6000);
+ try {
+ SyncScanResult textScanResult = executeSyncText(textScanRequest);
+ return new Result().ok(textScanResult);
+ } catch (Exception e) {
+ log.error("sendTextScan exception", e);
+ throw new ExeCuteHttpException(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg());
+ }
+ }
+
+ @Override
+ public Result sendSyncImgScan(ImgScanParam imgScanParam) {
+
+ ImageSyncScanRequest imageSyncScanRequest = new ImageSyncScanRequest();
+ imageSyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式
+ imageSyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法
+ imageSyncScanRequest.setEncoding(SysConstant.UTF8);
+ imageSyncScanRequest.setRegionId(regionId);
+
+ //默认参数
+ // 鉴黄 暴恐涉政
+ imgScanParam.setScenes(ImgSceneEnum.getImgSceneList());
+ imgScanParam.setBizType(bizType);
+
+ List imgTasks = imgScanParam.getTasks();
+ if (CollectionUtils.isEmpty(imgTasks) || imgTasks.size() > SysConstant.MAX_IMG_TASKS) {
+ return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg());
+ }
+
+ try {
+ imageSyncScanRequest.setHttpContent(JSON.toJSONString(imgScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON);
+ } catch (UnsupportedEncodingException e) {
+ log.error("sendSyncImgScan exception", e.getMessage());
+ return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg());
+ }
+
+ /**
+ * 请务必设置超时时间
+ */
+ imageSyncScanRequest.setConnectTimeout(3000);
+ imageSyncScanRequest.setReadTimeout(6000);
+
+ try {
+ SyncScanResult scanResult = executeSyncImg(imageSyncScanRequest);
+ return new Result().ok(scanResult);
+ } catch (Exception e) {
+ log.error("sendImgScan execute Exception", e);
+ return new Result().error(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg());
+ }
+ }
+
+ @Override
+ public Result sendASyncImgScan(ImgScanParam imgScanParam) {
+ ImageAsyncScanRequest imageAsyncScanRequest = new ImageAsyncScanRequest();
+ imageAsyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式
+ imageAsyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法
+ imageAsyncScanRequest.setEncoding(SysConstant.UTF8);
+ imageAsyncScanRequest.setRegionId(regionId);
+
+ //默认参数
+ // 鉴黄 暴恐涉政
+ imgScanParam.setScenes(ImgSceneEnum.getImgSceneList());
+ imgScanParam.setBizType(bizType);
+
+ List imgTasks = imgScanParam.getTasks();
+ if (CollectionUtils.isEmpty(imgTasks) || imgTasks.size() > SysConstant.MAX_IMG_TASKS) {
+ return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg());
+ }
+
+ try {
+ imageAsyncScanRequest.setHttpContent(JSON.toJSONString(imgScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON);
+ } catch (UnsupportedEncodingException e) {
+ log.error("sendASyncImgScan exception", e.getMessage());
+ return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg());
+ }
+
+ /**
+ * 请务必设置超时时间
+ */
+ imageAsyncScanRequest.setConnectTimeout(3000);
+ imageAsyncScanRequest.setReadTimeout(6000);
+
+ try {
+ ImgAsyncScanResult scanResult = executeAsyncImg(imageAsyncScanRequest);
+ return new Result().ok(scanResult);
+ } catch (Exception e) {
+ log.error("sendImgScan execute Exception", e);
+ return new Result().error(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg());
+ }
+ }
+
+ public SyncScanResult executeSyncText(AcsRequest> textScanRequest) {
+ SyncScanResult result = new SyncScanResult();
+ try {
+ HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(textScanRequest);
+
+ if (httpResponse.isSuccess()) {
+ JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), SysConstant.UTF8));
+ System.out.println(JSON.toJSONString(scrResponse, true));
+ if (200 == scrResponse.getInteger("code")) {
+ //任务 列表
+ List scanTaskResults = scrResponse.getJSONArray("data").toJavaList(ScanTaskResult.class);
+ for (ScanTaskResult taskResult : scanTaskResults) {
+ //又根据场景不同
+ if (200 == taskResult.getCode()) {
+ //如果是多个场景 则为对个 BaseScanResult
+ List sceneResults = taskResult.getResults();
+ //是文本检测 目前就一种场景
+ for (BaseScanResult sceneResult : sceneResults) {
+ String scene = sceneResult.getScene();
+ String suggestion = sceneResult.getSuggestion();
+ if (SuggestionEnum.BLOCK.getCode().equals(suggestion)) {
+ result.getFailDataIds().add(taskResult.getDataId());
+ } else {
+ result.getSuccessDataIds().add(taskResult.getDataId());
+ }
+ }
+ } else {
+ log.warn("executeSyncText task process fail:code:{},msg:{}", taskResult.getCode(), taskResult.getMsg());
+ throw new ExeCuteHttpException(" executeSyncTexttask process fail:code:" + taskResult.getCode() + ",msg:" + taskResult.getMsg());
+ }
+ }
+ return result;
+ } else {
+ throw new ExeCuteHttpException("executeSyncText detect not success. code:" + scrResponse.getInteger("code"));
+ }
+ } else {
+ log.warn("executeSyncText response not success. status:" + httpResponse.getStatus());
+ throw new ExeCuteHttpException("response not success. status:" + httpResponse.getStatus());
+ }
+
+ } catch (Exception e) {
+ log.warn("executeSyncImg exception", e);
+ throw new ExeCuteHttpException(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg());
+ }
+ }
+
+
+ /**
+ * desc:异步 检查图片 TODO 结果处理
+ *
+ * @param request
+ * @return
+ */
+ private ImgAsyncScanResult executeAsyncImg(AcsRequest> request) {
+ ImgAsyncScanResult result = new ImgAsyncScanResult();
+ try {
+ HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(request);
+ if (httpResponse.isSuccess()) {
+ JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8"));
+ System.out.println(JSON.toJSONString(scrResponse, true));
+ if (200 == scrResponse.getInteger("code")) {
+ JSONArray taskResults = scrResponse.getJSONArray("data");
+ for (Object taskResult : taskResults) {
+ if (200 == ((JSONObject) taskResult).getInteger("code")) {
+ String taskId = ((JSONObject) taskResult).getString("taskId");
+ // 将taskId 保存下来,间隔一段时间来轮询结果, 参照ImageAsyncScanResultsRequest
+ System.out.println("args = [" + taskId + "]");
+ result.getSuccessTaskIds().add(taskId);
+ } else {
+ //TODO 细化失败结果 属性 code等
+ String taskId = ((JSONObject) taskResult).getString("taskId");
+ result.getFailTaskIds().add(taskId);
+ log.warn("task process fail:{}", ((JSONObject) taskResult).getInteger("code"));
+ throw new ExeCuteHttpException("task process fail:" + ((JSONObject) taskResult).getInteger("code"));
+ }
+ }
+ return result;
+ } else {
+ System.out.println("detect not success. code:" + scrResponse.getInteger("code"));
+ throw new ExeCuteHttpException("detect not success. code:" + scrResponse.getInteger("code"));
+ }
+ } else {
+ System.out.println("response not success. status:" + httpResponse.getStatus());
+ throw new ExeCuteHttpException("response not success. status:" + httpResponse.getStatus());
+ }
+ } catch (ServerException e) {
+ e.printStackTrace();
+ } catch (ClientException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ private SyncScanResult executeSyncImg(AcsRequest> request) {
+ SyncScanResult result = new SyncScanResult();
+ try {
+ HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(request);
+ if (httpResponse.isSuccess()) {
+ JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), "UTF-8"));
+ System.out.println(JSON.toJSONString(scrResponse, true));
+ if (200 == scrResponse.getInteger("code")) {
+ JSONArray taskResults = scrResponse.getJSONArray("data");
+ List scanTaskResults = taskResults.toJavaList(ScanTaskResult.class);
+ for (ScanTaskResult taskResult : scanTaskResults) {
+ //如果是多个场景 则为对个 BaseScanResult
+ List sceneResults = taskResult.getResults();
+ //是文本检测 目前就一种场景
+ for (BaseScanResult sceneResult : sceneResults) {
+ String scene = sceneResult.getScene();
+ String suggestion = sceneResult.getSuggestion();
+ if (SuggestionEnum.BLOCK.getCode().equals(suggestion)) {
+ if (result.getFailDataIds().contains(taskResult.getDataId())) {
+ continue;
+ }
+ result.getFailDataIds().add(taskResult.getDataId());
+ } else {
+ if (result.getSuccessDataIds().contains(taskResult.getDataId())) {
+ continue;
+ }
+ result.getSuccessDataIds().add(taskResult.getDataId());
+ }
+ }
+ }
+ return result;
+ } else {
+ log.warn("executeSyncImg detect not success. code:", scrResponse.getInteger("code"));
+ throw new ExeCuteHttpException("detect not success. code:" + scrResponse.getInteger("code"));
+ }
+ } else {
+ log.warn("executeSyncImg response not success. status:" + httpResponse.getStatus());
+ throw new ExeCuteHttpException("response not success. status:" + httpResponse.getStatus());
+ }
+ } catch (Exception e) {
+ log.warn("executeSyncImg exception", e);
+ throw new ExeCuteHttpException(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg());
+ }
+ }
+}
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/ImgScanParam.java
similarity index 73%
rename from epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ScanParam.java
rename to epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgScanParam.java
index d589aa33b7..16e38eaa04 100644
--- 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/ImgScanParam.java
@@ -2,6 +2,7 @@ package com.epmet.openapi.scan.support.param;
import lombok.Data;
+import java.io.Serializable;
import java.util.List;
/**
@@ -11,7 +12,13 @@ import java.util.List;
* @date 2020-06-04 21:57
**/
@Data
-public class ScanParam {
+public class ImgScanParam implements Serializable {
+
+ private static final long serialVersionUID = 958801658335909745L;
+ /**
+ * 业务类型
+ */
+ private String bizType;
/**
* 场景 必填
*
@@ -23,7 +30,7 @@ public class ScanParam {
* 要检测的内容列表,必填
* remark:一组任务列表中的taskId不能相同
*/
- private List tasks;
+ private List tasks;
/**
* 异步检测结果回调地址,执行异步审查内容时 必填
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/ImgTask.java
similarity index 68%
rename from epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/Task.java
rename to epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/ImgTask.java
index 51f38b1b3b..e06204415f 100644
--- 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/ImgTask.java
@@ -2,6 +2,8 @@ package com.epmet.openapi.scan.support.param;
import lombok.Data;
+import java.io.Serializable;
+
/**
* 任务参数
*
@@ -10,8 +12,9 @@ import lombok.Data;
* @date 2020-06-04 22:13
**/
@Data
-public class Task {
+public class ImgTask implements Serializable {
+ private static final long serialVersionUID = -747206284930578105L;
/**
* 要检测的数据id 非必填
*
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java
new file mode 100644
index 0000000000..8a49fd5d2a
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextScanParam.java
@@ -0,0 +1,44 @@
+package com.epmet.openapi.scan.support.param;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 文本审查参数
+ *
+ * @author jianjun liu
+ * @date 2020-06-05 11:17
+ **/
+@Data
+public class TextScanParam implements Serializable {
+ private static final long serialVersionUID = -3568903097975113166L;
+
+ /**
+ * 业务类型
+ */
+ private String bizType;
+ /**
+ * 场景 必填
+ *
+ * @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/TextTask.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java
new file mode 100644
index 0000000000..aeb976506c
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/param/TextTask.java
@@ -0,0 +1,28 @@
+package com.epmet.openapi.scan.support.param;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 任务参数
+ *
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-04 22:13
+ **/
+@Data
+public class TextTask implements Serializable {
+
+ private static final long serialVersionUID = 6957195274696018630L;
+ /**
+ * 要检测的数据id 非必填
+ *
+ * */
+ private String dataId;
+
+ /**
+ * 文本内容 必填 最多不能超过10000
+ */
+ private String content;
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/BaseScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/BaseScanResult.java
new file mode 100644
index 0000000000..76226d75d3
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/BaseScanResult.java
@@ -0,0 +1,31 @@
+package com.epmet.openapi.scan.support.result;
+
+import lombok.Data;
+
+/**
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 14:24
+ **/
+@Data
+public class BaseScanResult {
+ /**
+ * 结果为该分类的概率
+ */
+ private Double rate;
+
+ /**
+ * 建议用户执行的操作
+ */
+ private String suggestion;
+
+ /**
+ * 场景
+ */
+ private String scene;
+
+ /**
+ * 标签
+ */
+ private String label;
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAcsReponse.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAcsReponse.java
new file mode 100644
index 0000000000..b3a2f65ef1
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAcsReponse.java
@@ -0,0 +1,18 @@
+package com.epmet.openapi.scan.support.result;
+
+import com.aliyuncs.AcsResponse;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.exceptions.ServerException;
+import com.aliyuncs.transform.UnmarshallerContext;
+
+/**
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 10:24
+ **/
+public class ImgAcsReponse extends AcsResponse {
+ @Override
+ public AcsResponse getInstance(UnmarshallerContext context) throws ClientException, ServerException {
+ return null;
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java
new file mode 100644
index 0000000000..d988cf7a88
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ImgAsyncScanResult.java
@@ -0,0 +1,24 @@
+package com.epmet.openapi.scan.support.result;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 检测结果
+ *
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 10:52
+ **/
+@Data
+public class ImgAsyncScanResult {
+ /**
+ * 执行成功的任务Id集合
+ */
+ private List successTaskIds;
+ /**
+ * 执行失败的任务Id集合
+ */
+ private List failTaskIds;
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java
new file mode 100644
index 0000000000..6ff3c512ea
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/ScanTaskResult.java
@@ -0,0 +1,26 @@
+package com.epmet.openapi.scan.support.result;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * desc:文本检测返回结果
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 14:24
+ **/
+@Data
+public class ScanTaskResult {
+
+ private Integer code;
+
+
+ private String msg;
+
+
+ private String dataId;
+
+
+ private List results;
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java
new file mode 100644
index 0000000000..59b2a04f94
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java
@@ -0,0 +1,41 @@
+package com.epmet.openapi.scan.support.result;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 检测结果
+ *
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 10:52
+ **/
+@Data
+public class SyncScanResult {
+ /**
+ * 执行成功的任务Id集合
+ */
+ private List successDataIds = new ArrayList<>();
+ /**
+ * 执行失败的任务Id集合
+ */
+ private List failDataIds = new ArrayList<>();
+
+ /**
+ * 本地是否全部通过
+ */
+ private boolean isAllPass;
+
+ public boolean isAllPass() {
+ if (failDataIds.isEmpty() && !successDataIds.isEmpty()) {
+ return true;
+ }
+ return isAllPass;
+ }
+
+ public void setAllPass(boolean allPass) {
+ isAllPass = allPass;
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/TextScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/TextScanResult.java
new file mode 100644
index 0000000000..c24f2bed6e
--- /dev/null
+++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/TextScanResult.java
@@ -0,0 +1,41 @@
+package com.epmet.openapi.scan.support.result;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 检测结果
+ *
+ * @author jianjun liu
+ * @email liujianjun@yunzongnet.com
+ * @date 2020-06-05 10:52
+ **/
+@Data
+public class TextScanResult {
+ /**
+ * 执行成功的任务Id集合
+ */
+ private List successDataIds = new ArrayList<>();
+ /**
+ * 执行失败的任务Id集合
+ */
+ private List failDataIds = new ArrayList<>();
+
+ /**
+ * 本地是否全部通过
+ */
+ private boolean isAllPass;
+
+ public boolean isAllPass() {
+ if (failDataIds.isEmpty() && !successDataIds.isEmpty()) {
+ return true;
+ }
+ return isAllPass;
+ }
+
+ public void setAllPass(boolean allPass) {
+ isAllPass = allPass;
+ }
+}
diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml
index c2cf89a17e..6c9dba5543 100644
--- a/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml
+++ b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml
@@ -72,6 +72,8 @@ ribbon:
aliyun:
green:
- accessKeyId: 123
- accessKeySecret: 456
- regionId: cn-shanghai
\ No newline at end of file
+ accessKeyId: LTAI4G6Fv6uTzQbpsayATHq4
+ accessKeySecret: QevMw1RYCwQUG3RSMPq1J6EAfmSblo
+ regionId: cn-shanghai
+ bizType: epmet_img_text
+