|
@@ -44,6 +44,8 @@ public class AppHomeServiceImpl implements IAppHomeService {
|
|
|
private AppGameMapper appGameMapper;
|
|
|
@Resource
|
|
|
private AppSearchHotMapper appSearchHotMapper;
|
|
|
+ @Resource
|
|
|
+ private AppGamePriceRulesMapper appGamePriceRulesMapper;
|
|
|
|
|
|
@Override
|
|
|
public HomeVO homeInfo() {
|
|
@@ -284,9 +286,32 @@ public class AppHomeServiceImpl implements IAppHomeService {
|
|
|
Page<SearchVO.SearchRaceVO> page = new Page<>(searchDTO.getCurrent(), searchDTO.getSize());
|
|
|
Page<SearchVO.SearchRaceVO> searchCompetitionVOPage = appGameMapper.convertSearchCompetitionVOPage(page, searchDTO);
|
|
|
searchCompetitionVOPage.getRecords().forEach(competitionVO -> {
|
|
|
- AppSite appSite = appSiteMapper.selectOne(Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode,competitionVO.getOrgCode()));
|
|
|
+ AppSite appSite = appSiteMapper.selectOne(
|
|
|
+ Wrappers.<AppSite>lambdaQuery().eq(AppSite::getOrgCode, competitionVO.getOrgCode()));
|
|
|
+ competitionVO.setKm(PositionUtil.calculateDistance(
|
|
|
+ searchDTO.getLatitude(), searchDTO.getLongitude(),
|
|
|
+ appSite.getLatitude().doubleValue(), appSite.getLongitude().doubleValue()));
|
|
|
+ // 获取价格规则并判断 type
|
|
|
+ List<AppGamePriceRules> appGamePriceRules = appGamePriceRulesMapper.selectList(
|
|
|
+ Wrappers.<AppGamePriceRules>lambdaQuery()
|
|
|
+ .eq(AppGamePriceRules::getGameId, competitionVO.getId()));
|
|
|
+ int targetType = -1; // 默认无效状态
|
|
|
+ if (appGamePriceRules != null && !appGamePriceRules.isEmpty()) {
|
|
|
+ boolean hasType0 = appGamePriceRules.stream()
|
|
|
+ .anyMatch(rule -> rule.getType() == 0);
|
|
|
+ boolean hasType1 = appGamePriceRules.stream()
|
|
|
+ .anyMatch(rule -> rule.getType() == 1);
|
|
|
+ if (hasType0 && hasType1) {
|
|
|
+ targetType = 2;
|
|
|
+ } else if (hasType0) {
|
|
|
+ targetType = 0;
|
|
|
+ } else if (hasType1) {
|
|
|
+ targetType = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ competitionVO.setType(targetType);
|
|
|
competitionVO.setKm(PositionUtil.calculateDistance(searchDTO.getLatitude(), searchDTO.getLongitude(), appSite.getLatitude().doubleValue(), appSite.getLongitude().doubleValue()));
|
|
|
-
|
|
|
+ competitionVO.setCategory(getCategoryName(appSite.getCategoryId()));
|
|
|
});
|
|
|
return page;
|
|
|
}
|
|
@@ -308,7 +333,8 @@ public class AppHomeServiceImpl implements IAppHomeService {
|
|
|
List<SearchVO.SearchCoursesVO> courseInfoVOS = courses.stream()
|
|
|
.map(course -> {
|
|
|
SearchVO.SearchCoursesVO vo = new SearchVO.SearchCoursesVO();
|
|
|
- BeanUtils.copyProperties(vo, course);
|
|
|
+ BeanUtils.copyProperties(course, vo);
|
|
|
+ vo.setSales(666);
|
|
|
return vo;
|
|
|
})
|
|
|
.collect(Collectors.toList());
|