| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @Service |
| | |
| | | public ResultUtil feedback(String content, Integer uid, Integer language) throws Exception { |
| | | if(ToolUtil.isNotEmpty(content)){ |
| | | if(content.length() > 200){ |
| | | return ResultUtil.error(language == 1 ? "反馈内容过长" : language == 2 ? "The feedback is too long" : "Le contenu des commentaires est trop long"); |
| | | return ResultUtil.error(language == 1 ? "反馈内容过长" : language == 2 ? "Feedback-content is overlong." : "Le contenu de l’avis est trop long."); |
| | | } |
| | | content = content.toLowerCase(); |
| | | List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); |
| | | for(SensitiveWords s : sensitiveWords){ |
| | | content = content.replaceAll(s.getContent(), "***"); |
| | | for(SensitiveWords s : sensitiveWords) { |
| | | content = content.replaceAll(s.getContent().toLowerCase(), "***"); |
| | | } |
| | | } |
| | | |
| | | Feedback feedback = new Feedback(); |
| | | feedback.setContent(content); |
| | | feedback.setFlag(1); |
| | |
| | | this.insert(feedback); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | } |