From dc5be7d38446f70e6ff86df311119c32b41fe7f8 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 28 十一月 2020 16:37:05 +0800 Subject: [PATCH] 大淘客搜索接口升级 --- fanli/src/main/java/com/yeshi/fanli/service/impl/help/AppPageNotificationServiceImpl.java | 60 +++++++++++++++++++++++++++++++----------------------------- 1 files changed, 31 insertions(+), 29 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/help/AppPageNotificationServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/help/AppPageNotificationServiceImpl.java index e0dc307..024f7f2 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/help/AppPageNotificationServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/help/AppPageNotificationServiceImpl.java @@ -8,6 +8,7 @@ import javax.annotation.Resource; +import com.yeshi.fanli.entity.SystemEnum; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -33,44 +34,46 @@ @Resource private AppVersionService appVersionService; - + @Resource private AdActivityVersionControlService adActivityVersionControlService; - - - @Override - public AppPageNotification getAppPageNotificationByType(String type) { - return appPageNotificationMapper.selectByType(type); + @Override + public AppPageNotification getAppPageNotificationByType(String type, SystemEnum system) { + + return appPageNotificationMapper.selectByType(type,system); } - @Cacheable(value = "configCache", key = "'getValidNotificationByTypeCache-'+#type+'-'+ #platform+'-'+#versionCode") + @Cacheable(value = "configCache", key = "'getValidNotificationByTypeCache-'+#type+'-'+ #platform+'-'+#versionCode+'-'+#system") @Override - public AppPageNotification getValidNotificationByTypeCache(String type, String platform, Integer versionCode) { - AppPageNotification record = appPageNotificationMapper.selectValidByType(type); - if (record == null) + public AppPageNotification getValidNotificationByTypeCache(String type, String platform, Integer versionCode, SystemEnum system) { + List<AppPageNotification> recordList = appPageNotificationMapper.listValidByType(type,system); + if (recordList == null || recordList.size() == 0) return null; - + // 杩囨护鐗堟湰 - AppVersionInfo app = appVersionService.getClientVersion(platform, versionCode); + AppVersionInfo app = appVersionService.getClientVersion(platform, versionCode,system); if (app == null) { return null; } List<Long> versionIdList = new ArrayList<>(); versionIdList.add(app.getId()); - + List<Long> sourceIdList = new ArrayList<>(); - sourceIdList.add(record.getId()); + for (AppPageNotification an : recordList) + sourceIdList.add(an.getId()); Set<Long> sourceIds = adActivityVersionControlService.filterSourceIdByVersion(sourceIdList, AdActivityType.notification, versionIdList); - - if (!sourceIds.contains(record.getId())) { + if (sourceIds == null || sourceIds.size() == 0) return null; + long sourceId = sourceIds.iterator().next(); + + for (AppPageNotification record : recordList) { + if (record.getId().longValue() == sourceId) + return record; } - - return record; + return null; } - @Override public void addAppPageNotification(AppPageNotification apn) throws Exception { @@ -78,7 +81,7 @@ return; if (apn.getType() == null) throw new Exception("绫诲瀷涓虹┖"); - AppPageNotification old = getAppPageNotificationByType(apn.getType().name()); + AppPageNotification old = getAppPageNotificationByType(apn.getType().name(),apn.getSystem()); if (old != null) throw new Exception("宸插瓨鍦ㄦ敼绫诲瀷"); @@ -96,12 +99,12 @@ @Override public void updateByPrimaryKey(AppPageNotification record) { - appPageNotificationMapper.updateByPrimaryKey(record); + appPageNotificationMapper.updateByPrimaryKey(record); } - + @Override public void updateByPrimaryKeySelective(AppPageNotification record) { - appPageNotificationMapper.updateByPrimaryKeySelective(record); + appPageNotificationMapper.updateByPrimaryKeySelective(record); } @Override @@ -115,16 +118,15 @@ } @Override - public List<AppPageNotification> listQuery(long start, int count, String key, Integer show, Integer canClose) { - return appPageNotificationMapper.listQuery(start, count, key, show, canClose); + public List<AppPageNotification> listQuery(long start, int count, String key, Integer show, Integer canClose, SystemEnum system) { + return appPageNotificationMapper.listQuery(start, count, key, show, canClose,system); } @Override - public long countQuery(String key, Integer show, Integer canClose) { - return appPageNotificationMapper.countQuery(key, show, canClose); + public long countQuery(String key, Integer show, Integer canClose, SystemEnum system) { + return appPageNotificationMapper.countQuery(key, show, canClose,system); } - @Transactional(rollbackFor = Exception.class) @Override public void setVersions(Long id, List<Long> versions) throws Exception { @@ -171,5 +173,5 @@ } } } - + } -- Gitblit v1.8.0