|
@@ -179,6 +179,44 @@ public class HomePageDataInfoServiceImpl extends ServiceImpl<HomePageDataInfoMap
|
|
|
return Response.success(map);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询首页数据列表--字典参数
|
|
|
+ * @param dictValues
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Response dictValueHomePageDataList(String[] dictValues) {
|
|
|
+ Map<String, List<HomePageDataInfoVo>> map = new HashMap<>();
|
|
|
+
|
|
|
+ for (String dictData : dictValues) {
|
|
|
+ List<HomePageDataInfoVo> newInfos = new ArrayList<>();
|
|
|
+ Set carouselChartkeys = redisTemplate.keys(Constants.HOME_PAGE_DATA_KEY + dictData+":*");
|
|
|
+ if (!carouselChartkeys.isEmpty()){
|
|
|
+ for (Object key : carouselChartkeys) {
|
|
|
+ String jsonStr = (String) redisTemplate.opsForValue().get(key);
|
|
|
+ HomePageDataInfoVo homePageDataInfoVo = JSONObject.parseObject(jsonStr).toJavaObject(HomePageDataInfoVo.class);
|
|
|
+ newInfos.add(homePageDataInfoVo);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //数据库获取(此处可不做查询!)
|
|
|
+ HomePageDataInfo homePageDataInfo = new HomePageDataInfo();
|
|
|
+ homePageDataInfo.setDataType(dictData);
|
|
|
+ homePageDataInfo.setStatus("0");//启用状态
|
|
|
+ newInfos = homePageDataInfoMapper.selectHomePageDataInfoList(homePageDataInfo);
|
|
|
+ }
|
|
|
+ //排序
|
|
|
+ List<HomePageDataInfoVo> infoVos = newInfos.stream()
|
|
|
+ .sorted(Comparator.comparing(HomePageDataInfoVo::getWeight).reversed())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ map.put(dictData,infoVos);
|
|
|
+ }
|
|
|
+
|
|
|
+ return Response.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 同步数据
|
|
|
* @return
|