diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml
index d2a0cab2cb..8a197e1fc4 100644
--- a/epmet-user/epmet-user-server/pom.xml
+++ b/epmet-user/epmet-user-server/pom.xml
@@ -155,6 +155,7 @@
false
+ https://epmet-dev.elinkservice.cn/api/epmetscan/api
@@ -187,6 +188,7 @@
false
+ https://epmet-dev.elinkservice.cn/api/epmetscan/api
@@ -219,6 +221,7 @@
true
+ https://epmet-dev.elinkservice.cn/api/epmetscan/api
@@ -248,6 +251,7 @@
true
+ https://epmet-open.elinkservice.cn/api/epmetscan/api
diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java
index 135cf802c1..58686403c4 100644
--- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java
+++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java
@@ -17,15 +17,24 @@
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.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+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.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
+import com.epmet.commons.tools.utils.Result;
+import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.constant.UserAdviceConstant;
import com.epmet.dao.UserAdviceDao;
import com.epmet.dto.UserAdviceDTO;
@@ -40,15 +49,15 @@ import com.epmet.service.UserAdviceImgService;
import com.epmet.service.UserAdviceService;
import io.jsonwebtoken.lang.Collections;
import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
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 java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* user_advice
@@ -59,12 +68,20 @@ import java.util.Map;
@Service
public class UserAdviceServiceImpl extends BaseServiceImpl implements UserAdviceService {
+ private Logger logger = LogManager.getLogger(UserAdviceServiceImpl.class);
@Autowired
private UserAdviceRedis userAdviceRedis;
@Autowired
private UserAdviceImgService userAdviceImgService;
+ @Value("${openapi.scan.server.url}")
+ private String scanApiUrl;
+ @Value("${openapi.scan.method.textSyncScan}")
+ private String textSyncScanMethod;
+ @Value("${openapi.scan.method.imgSyncScan}")
+ private String imgSyncScanMethod;
+
@Override
public PageData page(Map params) {
IPage page = baseDao.selectPage(
@@ -132,6 +149,10 @@ public class UserAdviceServiceImpl extends BaseServiceImpl textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
+ logger.info("用户建议文字审核入参:"+JSON.toJSONString(textScanParamDTO));
+ logger.info("用户建议文字审核返参:"+JSON.toJSONString(textSyncScanResult));
+ if (!textSyncScanResult.success()) {
+ logger.warn("用户建议文字审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult));
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
+ } else {
+ if (!textSyncScanResult.getData().isAllPass()) {
+ logger.warn("用户建议文字审核失败,文字:",text);
+ throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode());
+ }
+ }
+ logger.info("用户建议文字审核成功");
+ }
+
+ private void auditPic(List imgList) {
+ if (null != imgList && imgList.size() > 0) {
+ //审核活动详情中的图片
+ ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
+ imgList.forEach(url -> {
+ ImgTaskDTO task = new ImgTaskDTO();
+ task.setDataId(UUID.randomUUID().toString().replace("-", ""));
+ task.setUrl(url);
+ imgScanParamDTO.getTasks().add(task);
+ });
+ Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
+ logger.info("图片审核入参:" + JSON.toJSONString(imgScanParamDTO));
+ logger.info("图片审核返参:" + JSON.toJSONString(imgScanResult));
+ if (!imgScanResult.success()) {
+ logger.warn("图片审核接口失败,返参:", JSON.toJSONString(imgScanResult));
+ throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
+ } else {
+ if (!imgScanResult.getData().isAllPass()) {
+ throw new RenException(EpmetErrorCode.ACT_CONTENT_IMG_SCAN_FAILED.getCode());
+ }
+ }
+ logger.info("图片审核成功");
+ }
+ }
}
diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml
index 4f732d5ac9..b58644dbcc 100644
--- a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml
+++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml
@@ -131,4 +131,12 @@ ribbon:
#pageHelper分页插件
pagehelper:
helper-dialect: mysql
- reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
\ No newline at end of file
+ reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
+
+openapi:
+ scan:
+ server:
+ url: @openapi.scan.server.url@
+ method:
+ imgSyncScan: /imgSyncScan
+ textSyncScan: /textSyncScan