From eec7e789a87863c25d92c10ad5dfc22ad80c448d Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 14 七月 2020 12:36:48 +0800 Subject: [PATCH] 系统区分BUG修复 --- fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SwiperPictureServiceImpl.java | 52 ++++++++++++++++++++++++++++++++-------------------- 1 files changed, 32 insertions(+), 20 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SwiperPictureServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SwiperPictureServiceImpl.java index 63077aa..895fd7c 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SwiperPictureServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SwiperPictureServiceImpl.java @@ -12,6 +12,7 @@ import javax.annotation.Resource; +import com.yeshi.fanli.entity.SystemEnum; import org.apache.commons.beanutils.PropertyUtils; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; @@ -106,7 +107,7 @@ } String params = record.getParams(); - if (params == null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) { + if (params == null || params.trim().length() == 0 || "null".equalsIgnoreCase(params) || "\"null\"".equalsIgnoreCase(params)) { record.setParams(null); } else if (!StringUtil.isJson(params)) { throw new SwiperPictureException(1, "璺宠浆鍙傛暟闈濲SON鏍煎紡"); @@ -114,6 +115,17 @@ record.setParams(params.trim()); } + String title = record.getTitle(); + if (!StringUtil.isNullOrEmpty(title) && ("null".equalsIgnoreCase(title) || "\"null\"".equalsIgnoreCase(title))) { + record.setTitle(null); + } + + String desc = record.getDesc(); + if (!StringUtil.isNullOrEmpty(desc) && ("null".equalsIgnoreCase(desc) || "\"null\"".equalsIgnoreCase(desc))) { + record.setDesc(null); + } + + if (!StringUtil.isNullOrEmpty(jumpType)) { List<JumpDetailV2> listByType = jumpDetailV2Service.listByType(jumpType); if (listByType != null && listByType.size() > 0) { @@ -310,9 +322,9 @@ } @Override - @Cacheable(value = "bannerCache", key = "'getByBannerCard-'+#card") - public List<BannerVO> getByBannerCard(String card) { - List<SwiperPicture> list = swiperPictureMapper.getByBannerCard(card); + @Cacheable(value = "bannerCache", key = "'getByBannerCard-'+#card+'-'+#system") + public List<BannerVO> getByBannerCard(String card,SystemEnum system) { + List<SwiperPicture> list = swiperPictureMapper.getByBannerCard(card,system); if (list != null && list.size() > 0) { for (SwiperPicture swiperPicture : list) { boolean needLogin = swiperPicture.isJumpNeedLogin(); @@ -323,7 +335,7 @@ } } } - return transformVO(list); + return transformVO(list,system); } /** @@ -333,10 +345,10 @@ * @param platform * @param versionCode */ - private void filterSwipePicture(List<SwiperPicture> list, String platform, int versionCode) { + private void filterSwipePicture(List<SwiperPicture> list, String platform, int versionCode,SystemEnum system) { if (list == null || list.size() == 0) return; - AppVersionInfo app = appVersionService.getClientVersion(platform, versionCode); + AppVersionInfo app = appVersionService.getClientVersion(platform, versionCode,system); if (app == null) { list.clear(); return; @@ -357,34 +369,34 @@ } } - @Cacheable(value = "bannerCache", key = "'getByBannerCardAndVersion-'+#card+'-'+#platform+'-'+#version") + @Cacheable(value = "bannerCache", key = "'getByBannerCardAndVersion-'+#card+'-'+#platform+'-'+#version+'-'+#system") @Override - public List<BannerVO> getByBannerCardAndVersion(String card, String platform, int version) { - List<SwiperPicture> list = swiperPictureMapper.getByBannerCard(card); - filterSwipePicture(list, platform, version); + public List<BannerVO> getByBannerCardAndVersion(String card, String platform, int version,SystemEnum system) { + List<SwiperPicture> list = swiperPictureMapper.getByBannerCard(card,system); + filterSwipePicture(list, platform, version,system); for (SwiperPicture picture : list) { if (picture.isJumpNeedLogin() && picture.getJumpDetail() != null) { picture.getJumpDetail().setNeedLogin(true); } } - return transformVO(list); + return transformVO(list,system); } @Override @Cacheable(value = "bannerCache", key = "'getByBannerId-'+#bannerId") - public List<BannerVO> getByBannerId(Long bannerId) { + public List<BannerVO> getByBannerId(Long bannerId,SystemEnum system) { List<SwiperPicture> pictureList = swiperPictureMapper.getByBannerId(bannerId); - return transformVO(pictureList); + return transformVO(pictureList,system); } - @Cacheable(value = "bannerCache", key = "'getByBannerId-'+#bannerId+'-'+#platform+'-'+#version") + @Cacheable(value = "bannerCache", key = "'getByBannerId-'+#bannerId+'-'+#platform+'-'+#version+'-'+#system") @Override - public List<BannerVO> getByBannerId(Long bannerId, String platform, int version) + public List<BannerVO> getByBannerId(Long bannerId, String platform, int version,SystemEnum system) throws SwiperPictureException { List<SwiperPicture> pictureList = swiperPictureMapper.getByBannerId(bannerId); - filterSwipePicture(pictureList, platform, version); - return transformVO(pictureList); + filterSwipePicture(pictureList, platform, version,system); + return transformVO(pictureList,system); } @Transactional(rollbackFor = Exception.class) @@ -444,7 +456,7 @@ * @param list * @return */ - private List<BannerVO> transformVO(List<SwiperPicture> list) { + private List<BannerVO> transformVO(List<SwiperPicture> list, SystemEnum system) { List<BannerVO> listVo = new ArrayList<BannerVO>(); if (list != null && list.size() > 0) { for (SwiperPicture swiperPicture: list) { @@ -460,7 +472,7 @@ CommonShareInfo info = commonShareInfoService.getByPidAndType(bannerVO.getId(), CommonShareInfoEnum.banner.name()); if (info != null && !StringUtil.isNullOrEmpty(info.getComment())) { - String link = configService.get(ConfigKeyEnum.activityDetailLink.getKey()) + "?type=%s&id=%s"; + String link = configService.getValue(ConfigKeyEnum.activityDetailLink.getKey(),system) + "?type=%s&id=%s"; link = String.format(link, CommonShareInfoEnum.banner.name(),bannerVO.getId()); JSONObject params = new JSONObject(); -- Gitblit v1.8.0