| | |
| | | import com.linghu.service.KeywordService; |
| | | import com.linghu.mapper.KeywordMapper; |
| | | |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ResponseResult<List<PlatformProportionVO>> getResultByTypeId(Integer keywordId, Integer questionId, Integer typeId) { |
| | | public ResponseResult<List<PlatformProportionVO>> getResultByTypeId(Integer keywordId, Integer questionId, |
| | | Integer typeId) { |
| | | //1.关键词是否存在 |
| | | Keyword keyword = this.getById(keywordId); |
| | | if (keyword == null) { |
| | |
| | | if (!"completed".equals(keyword.getStatus())){ |
| | | return ResponseResult.error("关键词采集未完成"); |
| | | } |
| | | List<PlatformProportionVO> result = this.getBaseMapper().getResultByTypeId(keywordId, questionId, keyword.getNum(), typeId); |
| | | List<PlatformProportionVO> result = this.getBaseMapper().getResultByTypeId(keywordId, questionId, |
| | | keyword.getNum(), typeId); |
| | | return ResponseResult.success(result); |
| | | } |
| | | |
| | | @Override |
| | | public ResponseResult<List<ResultListVO>> getResultByPlatformId(Integer keywordId, Integer questionId, Integer platformId) { |
| | | public ResponseResult<List<ResultListVO>> getResultByPlatformId(Integer keywordId, Integer questionId, |
| | | Integer platformId) { |
| | | //1.关键词是否存在 |
| | | Keyword keyword = this.getById(keywordId); |
| | | if (keyword == null) { |
| | |
| | | return ResponseResult.error("关键词采集未完成"); |
| | | } |
| | | |
| | | List<ResultListVO> result = this.getBaseMapper().getResultByPlatformId(keywordId, questionId, keyword.getNum(), platformId); |
| | | List<ResultListVO> result = this.getBaseMapper().getResultByPlatformId(keywordId, questionId, keyword.getNum(), |
| | | platformId); |
| | | return ResponseResult.success(result); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Keyword> getKeywordsByOrderId(String orderId) { |
| | |
| | | return keywordMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean saveKeywords(String keywords, String order_id) { |
| | | if (StringUtils.hasText(keywords)) { |
| | | List<Keyword> keywordList = new ArrayList<>(); |
| | | String[] keywordArray = keywords.split("\\n"); |
| | | for (String keyword : keywordArray) { |
| | | Keyword newKeyword = new Keyword(); |
| | | newKeyword.setKeyword_name(keyword); |
| | | newKeyword.setOrder_id(order_id); |
| | | newKeyword.setStatus("notSubmitted"); |
| | | keywordList.add(newKeyword); |
| | | } |
| | | return this.saveBatch(keywordList); |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } |