1.资讯精选列表页面增加评分列和评分范围查询以及查看评分详情

2.禅道上的bug修复解决
This commit is contained in:
sunflower2014 2025-06-09 19:58:18 +08:00
parent 9b5ef05076
commit 14456b8270
4 changed files with 73 additions and 63 deletions

View File

@ -71,6 +71,7 @@ public interface NewsMapper {
@Select("select last_insert_id()")
Long getLastInsertId();
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert("insert into news_draft(title, summary, picture, type, content, create_time, update_time)" +
"values (#{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now())")
void saveDraft(NewsDraft newsDraft);

View File

@ -2,11 +2,14 @@ package com.jinrui.reference.core.model.entity;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* 全量资讯
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class NewsInfo {
public static final String INDEX_NAME = "news_info";
@ -31,6 +34,7 @@ public class NewsInfo {
* 数据输入时间
*/
@JsonProperty("input_date")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Shanghai")
private Date inputDate;
private Integer words;
@ -113,6 +117,7 @@ public class NewsInfo {
* 创建时间
*/
@JsonProperty("create_time")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Shanghai")
private Date createTime;
/**
@ -124,6 +129,7 @@ public class NewsInfo {
* 修改时间
*/
@JsonProperty("update_time")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss", timezone = "Asia/Shanghai")
private Date updateTime;
/**
@ -131,7 +137,8 @@ public class NewsInfo {
*/
private Long editorId;
public NewsInfo() {}
public NewsInfo() {}
public String getId() {
return id;
@ -309,6 +316,7 @@ public class NewsInfo {
this.words = words;
}
public News toNews() {
News news = new News();
news.setTitle(this.getTitle());

View File

@ -1,7 +1,10 @@
package com.jinrui.reference.core.model.vo.news;
import java.util.ArrayList;
import java.util.List;
import org.springframework.util.CollectionUtils;
import com.jinrui.reference.core.model.entity.NewsTags;
public class NewsScoreVO {
@ -9,15 +12,15 @@ public class NewsScoreVO {
private List<String> industryLabel;
private List<Double> industryConfidence;
private List<Number> industryConfidence;
private List<Double> industryScore;
private List<Number> industryScore;
private List<String> conceptLabel;
private List<Double> conceptConfidence;
private List<Number> conceptConfidence;
private List<Double> conceptScore;
private List<Number> conceptScore;
private Integer sourceImpact;
@ -33,22 +36,36 @@ public class NewsScoreVO {
public NewsScoreVO(NewsTags newsTags) {
this.id = newsTags.getId();
this.industryLabel = newsTags.getIndustryLabel();
this.industryConfidence = newsTags.getIndustryConfidence();
this.industryScore = newsTags.getIndustryScore();
if (!CollectionUtils.isEmpty(newsTags.getIndustryConfidence())) {
this.industryConfidence = new ArrayList<>();
this.industryConfidence.addAll(newsTags.getIndustryConfidence());
}
if (!CollectionUtils.isEmpty(newsTags.getIndustryScore())) {
this.industryScore = new ArrayList<>();
this.industryScore.addAll(newsTags.getIndustryScore());
}
this.conceptLabel = newsTags.getConceptLabel();
this.conceptConfidence = newsTags.getConceptConfidence();
this.conceptScore = newsTags.getConceptScore();
if (!CollectionUtils.isEmpty(newsTags.getConceptConfidence())) {
this.conceptConfidence = new ArrayList<>();
this.conceptConfidence.addAll(newsTags.getConceptConfidence());
}
if (!CollectionUtils.isEmpty(newsTags.getConceptScore())) {
this.conceptScore = new ArrayList<>();
this.conceptScore.addAll(newsTags.getConceptScore());
}
this.sourceImpact = newsTags.getSourceImpact();
this.chinaFactor = newsTags.getChinaFactor();
this.publicOpinionScore = newsTags.getPublicOpinionScore();
this.newsScore = newsTags.getNewsScore();
}
public List<Double> getIndustryScore() {
public List<Number> getIndustryScore() {
return industryScore;
}
public void setIndustryScore(List<Double> industryScore) {
public void setIndustryScore(List<Number> industryScore) {
this.industryScore = industryScore;
}
@ -60,19 +77,19 @@ public class NewsScoreVO {
this.conceptLabel = conceptLabel;
}
public List<Double> getConceptConfidence() {
public List<Number> getConceptConfidence() {
return conceptConfidence;
}
public void setConceptConfidence(List<Double> conceptConfidence) {
public void setConceptConfidence(List<Number> conceptConfidence) {
this.conceptConfidence = conceptConfidence;
}
public List<Double> getConceptScore() {
public List<Number> getConceptScore() {
return conceptScore;
}
public void setConceptScore(List<Double> conceptScore) {
public void setConceptScore(List<Number> conceptScore) {
this.conceptScore = conceptScore;
}
@ -124,11 +141,11 @@ public class NewsScoreVO {
this.industryLabel = industryLabel;
}
public List<Double> getIndustryConfidence() {
public List<Number> getIndustryConfidence() {
return industryConfidence;
}
public void setIndustryConfidence(List<Double> industryConfidence) {
public void setIndustryConfidence(List<Number> industryConfidence) {
this.industryConfidence = industryConfidence;
}
}

View File

@ -23,6 +23,7 @@ import org.springframework.util.StringUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.jinrui.reference.core.mapper.ColumnMapper;
import com.jinrui.reference.core.mapper.IndustryMapper;
import com.jinrui.reference.core.mapper.NewsMapper;
@ -347,19 +348,9 @@ public class NewsService {
saveNewsDTO.setStatus(2);
saveNewsDTO.setPublishTime(new Date());
saveNewDraft(saveNewsDTO, null);
// newsId = newsMapper.getLastInsertId();
// List<News> newList = newsMapper.queryNews(null, null, null, null, "createTime", null, 1, 0);
// newsId = newList.get(0).getId();
newsId = newsMapper.getNewsLastInsertId();
}
Long newIdRl;
if (id == null) {
newIdRl = newsId;
} else {
newIdRl = id;
}
Long newIdRl = saveNewsDTO.getId();
news = new News(saveNewsDTO);
news.setStatus(2);
news.setEditorId(editorId);
@ -558,12 +549,13 @@ public class NewsService {
return ResultObject.failed(500, "服务器错误,请联系系统管理员!");
}
Long draftId = newsMapper.getLastInsertId();
Long draftId = newsDraft.getId();
if (news == null) {
news = new News(saveNewsDTO);
news.setDraftId(draftId);
try {
newsMapper.saveNews(news);
saveNewsDTO.setId(news.getId());
} catch (Exception e) {
log.error("保存新闻错误!", e);
return ResultObject.failed(500, "服务器错误,请联系系统管理员!");
@ -591,15 +583,7 @@ public class NewsService {
}
}
}
Long newsId;
if (news.getId() != null) {
newsId = news.getId();
} else {
// List<News> newList = newsMapper.queryNews(null, null, null, null, "createTime", null, 1, 0);
// newsId = newList.get(0).getId();
newsId = newsMapper.getNewsLastInsertId();
}
Long newsId = news.getId();
// 保存新闻标签关系
try {
SaveDraftTag saveDraftTag = saveNewsDTO.getTag();
@ -611,23 +595,23 @@ public class NewsService {
// 先查到这个标签有没有关联过
List<NewsTagRel> newsTagRelList = tagMapper.getNewsTagRelList(newsId);
// 频道标签多个批量插
List<Long> fieldArr = saveDraftTag.getFieldArr();
// 如果前端传进来的没有而库里有就删掉
for(NewsTagRel newsTagRel: newsTagRelList){
boolean isIn = false;
for (Long item : fieldArr) {
if(item == newsTagRel.getTagId()){
isIn = true;
if (fieldArr != null) {
// 如果前端传进来的没有而库里有就删掉
for(NewsTagRel newsTagRel: newsTagRelList){
boolean isIn = false;
for (Long item : fieldArr) {
if(item == newsTagRel.getTagId()){
isIn = true;
break;
}
}
if(!isIn){
tagMapper.deleteNews(newsTagRel.getNewsId());
}
}
if(!isIn){
tagMapper.deleteNews(newsTagRel.getNewsId());
}
}
if (fieldArr != null) {
for (Long item : fieldArr) {
tagMapper.saveNewsTagRel(newsId, item);
// boolean canSave = true;
@ -664,19 +648,19 @@ public class NewsService {
List<DraftTagRel> draftTagRelList = tagMapper.getDraftTagRelList(newsId);
List<Long> fieldArr = saveDraftTag.getFieldArr();
// 如果前端传进来的没有而库里有就删掉
for(DraftTagRel draftTagRel: draftTagRelList){
boolean isIn = false;
for (Long item : fieldArr) {
if(item == draftTagRel.getTagId()){
isIn = true;
if (fieldArr != null) {
// 如果前端传进来的没有而库里有就删掉
for(DraftTagRel draftTagRel: draftTagRelList){
boolean isIn = false;
for (Long item : fieldArr) {
if(item == draftTagRel.getTagId()){
isIn = true;
}
}
if(!isIn){
tagMapper.deleteDraft(draftTagRel.getDraftId());
}
}
if(!isIn){
tagMapper.deleteDraft(draftTagRel.getDraftId());
}
}
if (fieldArr != null) {
for (Long item : fieldArr) {
tagMapper.saveDraftTagRel(draftId, item);