Commit 1a284d6f by Lem

数据结构

parent b7f59d04
......@@ -28,6 +28,8 @@ public class GetArticleListResponse {
private Integer readNum;
private String dateTime;
private List<TagInfoResponse> tags;
private Integer deleted;
......
......@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.sql.Date;
import java.util.*;
import java.util.stream.Collectors;
......@@ -541,6 +542,7 @@ public class ArticleServiceImpl implements ArticleService {
.build()).collect(Collectors.toList()))
.deleted(article.getDeleted())
.readNum(article.getReadNum())
.dateTime(DateUtil.format(article.getReleaseTime(), DateUtil.MDHM_))
.build());
}
return responses;
......
......@@ -166,6 +166,11 @@ public class MatchServiceImpl implements MatchService {
break;
}
List<MatchHomeListByDayResponse> responses = returnWebMatchList(request, matches);
return ResponseData.successResponse(new ResultPage<>(commonStringId.getPageNum(), commonStringId.getPageSize(), (int) count, responses));
}
private List<MatchHomeListByDayResponse> returnWebMatchList(HttpServletRequest request, List<Match> matches){
Map<String, List<MatchHomeListByDayResponse.MatchInfo>> responseMap = new LinkedHashMap<>();
for (Match match : matches) {
MatchHomeListByDayResponse.MatchInfo matchInfo = new MatchHomeListByDayResponse.MatchInfo();
......@@ -220,9 +225,7 @@ public class MatchServiceImpl implements MatchService {
.matchInfos(responseMap.get(key))
.build());
}
return ResponseData.successResponse(new ResultPage(commonStringId.getPageNum(), commonStringId.getPageSize(),
(int) count, responses));
return responses;
}
@Override
......@@ -854,34 +857,8 @@ public class MatchServiceImpl implements MatchService {
}
}
MatchHomeListByDayResponse response = new MatchHomeListByDayResponse();
response.setMatchInfos(new ArrayList<>());
for (Match match : matches) {
MatchHomeListByDayResponse.MatchInfo matchInfo = new MatchHomeListByDayResponse.MatchInfo();
matchInfo.setSubscribed(true);
Team home = teamMapper.selectById(match.getHomeId());
Team away = teamMapper.selectById(match.getAwayId());
Sports sports = sportsMapper.selectById(match.getSportsId());
matchInfo.setMatchId(match.getId());
matchInfo.setMatchShortName(match.getCompetitionShortName());
matchInfo.setAway(MatchListInfo.builder()
.teamName(away.getTeamName())
.teamLogo(away.getTeamIcon())
.score(match.getAwayScore())
.build());
matchInfo.setHome(MatchListInfo.builder()
.teamName(home.getTeamName())
.teamLogo(home.getTeamIcon())
.score(match.getHomeScore())
.build());
matchInfo.setMatchTime(DateUtil.format(match.getMatchTime(), DateUtil.HM_));
matchInfo.setSportsType(sports.getSportsId());
response.getMatchInfos().add(matchInfo);
}
return ResponseData.successResponse(new ResultPage<>(commonPage.getPageNum(), commonPage.getPageSize(), (int) count, response));
List<MatchHomeListByDayResponse> responses = returnWebMatchList(request, matches);
return ResponseData.successResponse(new ResultPage<>(commonPage.getPageNum(), commonPage.getPageSize(), (int) count, responses));
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment