|
|
@ -23,6 +23,11 @@ import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.content.CheckDataUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.content.ModuleName; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.content.dto.form.SaveCheckRecordsDTO; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.content.dto.result.CheckResultDTO; |
|
|
|
import com.elink.esua.epdc.commons.tools.security.content.dto.result.CheckResultMessageDTO; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.dto.comment.*; |
|
|
@ -35,12 +40,17 @@ import com.elink.esua.epdc.modules.async.NewsTask; |
|
|
|
import com.elink.esua.epdc.modules.comment.dao.TopicCommentDao; |
|
|
|
import com.elink.esua.epdc.modules.comment.entity.TopicCommentEntity; |
|
|
|
import com.elink.esua.epdc.modules.comment.service.TopicCommentService; |
|
|
|
import com.elink.esua.epdc.modules.feign.ContentSecurityFeignClient; |
|
|
|
import com.elink.esua.epdc.modules.topic.service.TopicService; |
|
|
|
import com.elink.esua.epdc.modules.topic.service.impl.TopicServiceImpl; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
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; |
|
|
@ -60,6 +70,11 @@ public class TopicCommentServiceImpl extends BaseServiceImpl<TopicCommentDao, To |
|
|
|
@Autowired |
|
|
|
private NewsTask newsTask; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ContentSecurityFeignClient contentSecurityFeign; |
|
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(TopicServiceImpl.class); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<TopicCommentDTO> page(Map<String, Object> params) { |
|
|
@ -115,6 +130,23 @@ public class TopicCommentServiceImpl extends BaseServiceImpl<TopicCommentDao, To |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result submit(TopicCommentFormDTO commentFormDTO) { |
|
|
|
//内容审核
|
|
|
|
List<String> textList = new ArrayList<>(); |
|
|
|
textList.add(commentFormDTO.getContent()); |
|
|
|
CheckResultDTO contentResult = CheckDataUtils.checkContent(textList); |
|
|
|
if (contentResult != null && 200 == contentResult.getDetails().get(0).getCode()) { |
|
|
|
if (!contentResult.getAllPass()) { |
|
|
|
//组装要保存的信息
|
|
|
|
SaveCheckRecordsDTO record = CheckDataUtils.getPackageRecords(commentFormDTO.getUserId(), |
|
|
|
commentFormDTO.getUserName(),CheckDataUtils.cate_two , CheckDataUtils.decision_one, |
|
|
|
ModuleName.GROUP_TOPIC_COMMENT.getCode(), textList,null, null,contentResult, |
|
|
|
null,null); |
|
|
|
contentSecurityFeign.insertViolationsRecord(record); |
|
|
|
return new Result().error(CheckDataUtils.violations_message); |
|
|
|
} |
|
|
|
} else { |
|
|
|
logger.error("解析审核结果异常:" + contentResult); |
|
|
|
} |
|
|
|
|
|
|
|
TopicCommentEntity commentEntity = new TopicCommentEntity(); |
|
|
|
commentEntity.setContent(commentFormDTO.getContent()); |
|
|
@ -177,6 +209,18 @@ public class TopicCommentServiceImpl extends BaseServiceImpl<TopicCommentDao, To |
|
|
|
// 发送消息
|
|
|
|
newsTask.insertUserInformation(informationFormDTO); |
|
|
|
|
|
|
|
//判断是否为待审核
|
|
|
|
if (contentResult != null && 200 == contentResult.getDetails().get(0).getCode()) { |
|
|
|
CheckResultMessageDTO twoTypes = CheckDataUtils.checkTwoTypes(contentResult, null); |
|
|
|
if (CheckDataUtils.review.equals(twoTypes.getSuggestion())) { |
|
|
|
//组装要保存的信息
|
|
|
|
SaveCheckRecordsDTO record = CheckDataUtils.getPackageRecords(commentFormDTO.getUserId(), |
|
|
|
commentFormDTO.getUserName(), CheckDataUtils.cate_two, null, ModuleName.GROUP_TOPIC_COMMENT.getCode(), textList, |
|
|
|
null,commentEntity.getId(), null,null,twoTypes); |
|
|
|
contentSecurityFeign.insertRecords(record); |
|
|
|
} |
|
|
|
}//如果是审核状态是pass,不作任何处理
|
|
|
|
|
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|