Commit 1a284d6f by Lem

数据结构

parent b7f59d04
...@@ -28,6 +28,8 @@ public class GetArticleListResponse { ...@@ -28,6 +28,8 @@ public class GetArticleListResponse {
private Integer readNum; private Integer readNum;
private String dateTime;
private List<TagInfoResponse> tags; private List<TagInfoResponse> tags;
private Integer deleted; private Integer deleted;
......
...@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service; ...@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.sql.Date;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -541,6 +542,7 @@ public class ArticleServiceImpl implements ArticleService { ...@@ -541,6 +542,7 @@ public class ArticleServiceImpl implements ArticleService {
.build()).collect(Collectors.toList())) .build()).collect(Collectors.toList()))
.deleted(article.getDeleted()) .deleted(article.getDeleted())
.readNum(article.getReadNum()) .readNum(article.getReadNum())
.dateTime(DateUtil.format(article.getReleaseTime(), DateUtil.MDHM_))
.build()); .build());
} }
return responses; return responses;
......
...@@ -166,6 +166,11 @@ public class MatchServiceImpl implements MatchService { ...@@ -166,6 +166,11 @@ public class MatchServiceImpl implements MatchService {
break; 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<>(); Map<String, List<MatchHomeListByDayResponse.MatchInfo>> responseMap = new LinkedHashMap<>();
for (Match match : matches) { for (Match match : matches) {
MatchHomeListByDayResponse.MatchInfo matchInfo = new MatchHomeListByDayResponse.MatchInfo(); MatchHomeListByDayResponse.MatchInfo matchInfo = new MatchHomeListByDayResponse.MatchInfo();
...@@ -220,9 +225,7 @@ public class MatchServiceImpl implements MatchService { ...@@ -220,9 +225,7 @@ public class MatchServiceImpl implements MatchService {
.matchInfos(responseMap.get(key)) .matchInfos(responseMap.get(key))
.build()); .build());
} }
return responses;
return ResponseData.successResponse(new ResultPage(commonStringId.getPageNum(), commonStringId.getPageSize(),
(int) count, responses));
} }
@Override @Override
...@@ -854,34 +857,8 @@ public class MatchServiceImpl implements MatchService { ...@@ -854,34 +857,8 @@ public class MatchServiceImpl implements MatchService {
} }
} }
MatchHomeListByDayResponse response = new MatchHomeListByDayResponse(); List<MatchHomeListByDayResponse> responses = returnWebMatchList(request, matches);
response.setMatchInfos(new ArrayList<>()); return ResponseData.successResponse(new ResultPage<>(commonPage.getPageNum(), commonPage.getPageSize(), (int) count, responses));
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));
} }
@Override @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