From 74ee9c42c1d87f3724a21e92871bc8c95c8364c6 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 03 九月 2019 17:04:03 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java index beaa01e..d3ec032 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialServiceImpl.java @@ -18,11 +18,13 @@ import com.yeshi.fanli.dao.mybatis.homemodule.SpecialMapper; import com.yeshi.fanli.dto.common.CommonContentTypeEnum; +import com.yeshi.fanli.entity.AppVersionInfo; import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.homemodule.Special; import com.yeshi.fanli.entity.common.JumpDetailV2; import com.yeshi.fanli.exception.homemodule.SpecialException; import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; +import com.yeshi.fanli.service.inter.config.AppVersionService; import com.yeshi.fanli.service.inter.config.ConfigService; import com.yeshi.fanli.service.inter.homemodule.SpecialCardService; import com.yeshi.fanli.service.inter.homemodule.SpecialPlaceService; @@ -50,6 +52,10 @@ @Resource private ConfigService configService; + + @Resource + private AppVersionService appVersionService; + @Override public Special selectByPrimaryKey(Long id) { @@ -73,6 +79,26 @@ Integer sex = record.getSex(); if (sex == null) { throw new SpecialException(1, "鎬у埆涓嶈兘涓虹┖"); + } + + String version = record.getVersion(); + Integer platformCode = record.getPlatform(); + if (!StringUtil.isNullOrEmpty(version) && platformCode != null) { + String platform = "android"; + if (platformCode == 2) + platform = "ios"; + AppVersionInfo versionInfo = appVersionService.getByPlatformAndVersion(platform, version); + if (versionInfo == null) + throw new SpecialException(1, "鐗堟湰鍙蜂俊鎭己澶�"); + + record.setVersionCode(versionInfo.getVersionCode()); + record.setPlatform(platformCode); + } else { + if (!StringUtil.isNullOrEmpty(version)) + throw new SpecialException(1, "骞冲彴绫诲瀷涓嶈兘涓虹┖"); + + if (platformCode != null) + throw new SpecialException(1, "鐗堟湰鍙蜂笉鑳戒负绌�"); } String params = record.getParams(); @@ -366,6 +392,13 @@ } @Override + @Cacheable(value = "specialCache", key = "'listByVersion-'+#start+'-'+#count+'-'+#card+'-'+#platform+'-'+#versionCode") + public List<Special> listByVersion(long start, int count, String card, Integer platform, Integer versionCode) { + return specialMapper.listByVersion(start, count, card, platform, versionCode); + } + + + @Override @Cacheable(value = "specialCache", key = "'listCacheSpecialToIndex'+#acceptData.platform+'-'+#acceptData.version+'-'+#sex") public JSONObject listCacheSpecialToIndex(AcceptData acceptData, Integer sex) throws Exception { -- Gitblit v1.8.0