| | |
| | |
|
| | | 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;
|
| | |
| | | }
|
| | |
|
| | | 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, "跳转参数非JSON格式");
|
| | |
| | | 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) {
|
| | |
| | | }
|
| | |
|
| | | @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();
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | return transformVO(list);
|
| | | return transformVO(list,system);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @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;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @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)
|
| | |
| | | * @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) {
|
| | |
| | | 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();
|