From d343ae58950d1b311c904d9290fbbadfed6c585d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 26 五月 2020 15:07:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div
---
fanli/src/main/java/com/yeshi/fanli/service/impl/help/AppPageNotificationServiceImpl.java | 37 +++++++++++++++++++------------------
1 files changed, 19 insertions(+), 18 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..3f4453c 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
@@ -33,11 +33,10 @@
@Resource
private AppVersionService appVersionService;
-
+
@Resource
private AdActivityVersionControlService adActivityVersionControlService;
-
-
+
@Override
public AppPageNotification getAppPageNotificationByType(String type) {
@@ -47,10 +46,10 @@
@Cacheable(value = "configCache", key = "'getValidNotificationByTypeCache-'+#type+'-'+ #platform+'-'+#versionCode")
@Override
public AppPageNotification getValidNotificationByTypeCache(String type, String platform, Integer versionCode) {
- AppPageNotification record = appPageNotificationMapper.selectValidByType(type);
- if (record == null)
+ List<AppPageNotification> recordList = appPageNotificationMapper.listValidByType(type);
+ if (recordList == null || recordList.size() == 0)
return null;
-
+
// 杩囨护鐗堟湰
AppVersionInfo app = appVersionService.getClientVersion(platform, versionCode);
if (app == null) {
@@ -58,19 +57,22 @@
}
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 {
@@ -96,12 +98,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
@@ -124,7 +126,6 @@
return appPageNotificationMapper.countQuery(key, show, canClose);
}
-
@Transactional(rollbackFor = Exception.class)
@Override
public void setVersions(Long id, List<Long> versions) throws Exception {
@@ -171,5 +172,5 @@
}
}
}
-
+
}
--
Gitblit v1.8.0