Browse Source

各种审核

dev_shibei_match
zxc 5 years ago
parent
commit
a530514fa0
  1. 26
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java
  2. 25
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java
  3. 6
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java
  4. 2
      epmet-module/resi-group/resi-group-server/pom.xml
  5. 29
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java
  6. 76
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  7. 8
      epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml

26
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSatisfactionDetailServiceImpl.java

@ -24,8 +24,13 @@ 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.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.IssueConstant;
import com.epmet.dao.IssueSatisfactionDetailDao;
import com.epmet.dto.EvaluateInfoDTO;
@ -41,12 +46,14 @@ import com.epmet.service.IssueSatisfactionDetailService;
import org.apache.commons.lang3.StringUtils;
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.Arrays;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* 议题满意度调查记录表
@ -59,6 +66,10 @@ public class IssueSatisfactionDetailServiceImpl extends BaseServiceImpl<IssueSat
@Autowired
private IssueSatisfactionDetailRedis issueSatisfactionDetailRedis;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Override
public PageData<IssueSatisfactionDetailDTO> page(Map<String, Object> params) {
@ -142,6 +153,21 @@ public class IssueSatisfactionDetailServiceImpl extends BaseServiceImpl<IssueSat
@Override
@Transactional(rollbackFor = Exception.class)
public void evaluate(EvaluateFormDTO formDTO) {
String comment = formDTO.getComment();
//议题评论内容审核
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(comment);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
IssueSatisfactionDetailEntity entity = new IssueSatisfactionDetailEntity();
BeanUtils.copyProperties(formDTO,entity);
InitEvaluationFormDTO initEvaluation = new InitEvaluationFormDTO();

25
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSatisfactionDetailServiceImpl.java

@ -24,10 +24,13 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
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.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import com.epmet.constant.ProjectConstant;
import com.epmet.dao.ProjectSatisfactionDetailDao;
import com.epmet.dto.ProjectSatisfactionDetailDTO;
@ -40,6 +43,7 @@ import com.epmet.service.ProjectSatisfactionDetailService;
import org.apache.commons.lang3.StringUtils;
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;
@ -59,6 +63,10 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
private ProjectSatisfactionDetailRedis projectSatisfactionDetailRedis;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Override
public PageData<ProjectSatisfactionDetailDTO> page(Map<String, Object> params) {
@ -178,6 +186,21 @@ public class ProjectSatisfactionDetailServiceImpl extends BaseServiceImpl<Projec
@Override
@Transactional(rollbackFor = Exception.class)
public void projectEvaluate(ProjectEvaluateFormDTO formDTO) {
String comment = formDTO.getComment();
//项目满意度评价内容审核
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(comment);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
ProjectSatisfactionDetailEntity entity = new ProjectSatisfactionDetailEntity();
BeanUtils.copyProperties(formDTO,entity);
//校验是否评价

6
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/constant/TopicConstant.java

@ -72,4 +72,10 @@ public interface TopicConstant {
* 构造queryWrapper 用户Id
* */
String CUSTOMER_USER_ID = "CUSTOMER_USER_ID";
String REVIEW_TOPIC = "评论话题失败,评论内容为:%s";
String CREATE_TOPIC = "创建话题失败,话题内容为:%s";
String SHIFT_ISSUE = "转议题失败,标题为:%s , 建议为:%s";
}

2
epmet-module/resi-group/resi-group-server/pom.xml

@ -150,6 +150,7 @@
<nacos.ip/>
<spring.flyway.enabled>false</spring.flyway.enabled>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/epmetscan/api</openapi.scan.server.url>
</properties>
</profile>
<profile>
@ -181,6 +182,7 @@
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/epmetscan/api</openapi.scan.server.url>
</properties>
</profile>
</profiles>

29
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java

@ -21,14 +21,19 @@ 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.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.redis.RedisKeys;
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.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.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.comment.entity.ResiTopicCommentEntity;
@ -52,10 +57,12 @@ import com.epmet.resi.group.dto.topic.ResiTopicCommentDTO;
import com.epmet.resi.group.dto.topic.ResiTopicDTO;
import com.epmet.resi.group.dto.topic.form.ResiPublishCommentFormDTO;
import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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;
@ -69,6 +76,7 @@ import java.util.stream.Collectors;
* @since v1.0.0 2020-03-31
*/
@Service
@Slf4j
public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommentDao, ResiTopicCommentEntity> implements ResiTopicCommentService {
@Autowired
@ -86,6 +94,11 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
@Autowired
ResiGroupMemberDao resiGroupMemberDao;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
private final Log logger = LogFactory.getLog(getClass());
@Override
@ -151,6 +164,22 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl<ResiTopicCommen
@Override
@Transactional(rollbackFor = Exception.class)
public Result commentTopic(TokenDto tokenDto, ResiPublishCommentFormDTO resiCommentFormDTO) {
String commentContent = resiCommentFormDTO.getCommentContent();
//评论话题内容审核
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(commentContent);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
log.error(String.format(TopicConstant.REVIEW_TOPIC,commentContent));
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
//1.判断当前用户是否被禁言
ResiTopicDTO topic = resiTopicService.get(resiCommentFormDTO.getTopicId());
if(null == topic){

76
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -24,12 +24,19 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
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.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.dto.CustomerGridDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CommonDataFilterResultDTO;
@ -72,14 +79,15 @@ import com.epmet.resi.group.dto.topic.form.*;
import com.epmet.resi.group.dto.topic.form.CheckTopicPublisherFormDTO;
import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO;
import com.epmet.resi.group.dto.topic.result.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -91,6 +99,7 @@ import java.util.stream.Collectors;
* @since v1.0.0 2020-03-31
*/
@Service
@Slf4j
public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopicEntity> implements ResiTopicService {
@Autowired
@ -132,6 +141,13 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
@Autowired
private GovIssueFeignClient govIssueFeignClient;
@Value("${openapi.scan.server.url}")
private String scanApiUrl;
@Value("${openapi.scan.method.textSyncScan}")
private String textSyncScanMethod;
@Value("${openapi.scan.method.imgSyncScan}")
private String imgSyncScanMethod;
private final Log logger = LogFactory.getLog(getClass());
@ -199,6 +215,41 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
**/
@Override
public Result createTopic(TokenDto tokenDto, ResiTopicPublishFormDTO resiTopicPublishFormDTO) {
String topicContent = resiTopicPublishFormDTO.getTopicContent();
List<String> attachmentList = resiTopicPublishFormDTO.getAttachmentList();
//创建话题内容审核
TextScanParamDTO textScanParamDTO = new TextScanParamDTO();
TextTaskDTO taskDTO = new TextTaskDTO();
taskDTO.setContent(topicContent);
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScanParamDTO.getTasks().add(taskDTO);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO);
if (!textSyncScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
log.error(String.format(TopicConstant.CREATE_TOPIC,topicContent));
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
//创建话题图片审核
if (attachmentList.size() != NumConstant.ZERO){
ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO();
attachmentList.forEach(url -> {
ImgTaskDTO task = new ImgTaskDTO();
task.setDataId(UUID.randomUUID().toString().replace("-", ""));
task.setUrl(url);
imgScanParamDTO.getTasks().add(task);
});
Result<SyncScanResult> imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO);
if (!imgScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!imgScanResult.getData().isAllPass()) {
throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode());
}
}
}
if (null == tokenDto) {
logger.error(ModuleConstant.USER_NOT_NULL);
throw new RenException(ModuleConstant.USER_NOT_NULL);
@ -1045,6 +1096,29 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
@Override
@Transactional(rollbackFor = Exception.class)
public void shiftIssue(ResiTopicTurnIssueFromDTO topicTurnIssueFromDTO) {
//话题转议题审核:标题、建议
String issueTitle = topicTurnIssueFromDTO.getIssueTitle();
String suggestion = topicTurnIssueFromDTO.getSuggestion();
TextScanParamDTO textScan = new TextScanParamDTO();
//标题
TextTaskDTO taskTitle = new TextTaskDTO();
taskTitle.setContent(issueTitle);
taskTitle.setDataId(UUID.randomUUID().toString().replace("-", ""));
textScan.getTasks().add(taskTitle);
//建议
TextTaskDTO taskSuggestion = new TextTaskDTO();
taskSuggestion.setDataId(UUID.randomUUID().toString().replace("-", ""));
taskSuggestion.setContent(suggestion);
textScan.getTasks().add(taskSuggestion);
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScan);
if (!textSyncScanResult.success()){
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
} else {
if (!textSyncScanResult.getData().isAllPass()) {
log.error(String.format(TopicConstant.SHIFT_ISSUE,issueTitle,suggestion));
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode());
}
}
//1.统一时间(群组服务 -> 议题服务)
Date now = new Date();
//2.调用gov-org获取数据权限

8
epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml

@ -118,3 +118,11 @@ ribbon:
pagehelper:
helper-dialect: mysql
reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
openapi:
scan:
server:
url: @openapi.scan.server.url@
method:
imgSyncScan: /imgSyncScan
textSyncScan: /textSyncScan
Loading…
Cancel
Save