From f862a844ea7e212f8cc0622b858308e2b91dca2e Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 04 七月 2020 16:35:50 +0800
Subject: [PATCH] 后台管理相关Controller注入系统

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java |   38 +++++++++++++++++++++++++++++++-------
 1 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java
index 9b3b57f..b414e8f 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/FloatADServiceImpl.java
@@ -12,6 +12,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;
@@ -174,7 +175,6 @@
 
 	/**
 	 * 鍒犻櫎鍥剧墖-涓嶆洿鏂版暟鎹簱
-	 * @param record
 	 * @throws Exception
 	 */
 	public void removePicture(String picture) throws Exception {
@@ -215,6 +215,31 @@
 		floatADMapper.updateByPrimaryKey(resultObj);
 		floatADMapper.updateByPrimaryKey(exchangeObject);
 	}
+	
+	
+	@Override
+	public void switchState(Long id) throws FloatADException {
+		if (id == null) {
+			throw new FloatADException(1, "璇蜂紶閫掓纭弬鏁�");
+		}
+		FloatAD resultObj = floatADMapper.selectByPrimaryKey(id);
+		if (resultObj == null) {
+			throw new FloatADException(1, "姝ゅ唴瀹瑰凡涓嶅瓨鍦�");
+		}
+		
+		Integer state = resultObj.getState();
+		if (state == null || state == 0) {
+			state = 1;
+		} else {
+			state = 0;
+		}
+		
+		FloatAD updateObj = new FloatAD();
+		updateObj.setId(id);
+		updateObj.setState(state);
+		floatADMapper.updateByPrimaryKeySelective(updateObj);
+	}
+	
 	
 	@Override
 	@Transactional(rollbackFor=Exception.class)
@@ -367,13 +392,12 @@
 		}
 	}
 	
-	@Cacheable(value = "configCache", key = "'getValidFloatADCache-'+#position+'-'+#type+'-'+#platform+'-'+#versionCode")
+	@Cacheable(value = "configCache", key = "'getValidFloatADCache-'+#position+'-'+#type+'-'+#platform+'-'+#versionCode+'-'+system")
 	@Override
-	public List<FloatAD> getValidFloatADCache(String position, Integer type, String platform, Integer versionCode) {
+	public List<FloatAD> getValidFloatADCache(String position, Integer type, String platform, Integer versionCode, SystemEnum system) {
 		List<FloatAD> list = floatADMapper.getValidFloatAD(position, type);
 		// 杩囨护
-		filterFloatAD(list, platform, versionCode);
-		
+		filterFloatAD(list, platform, versionCode,system);
 		return list;
 	}
 	
@@ -384,10 +408,10 @@
 	 * @param platform
 	 * @param versionCode
 	 */
-	private void filterFloatAD(List<FloatAD> list, String platform, int versionCode) {
+	private void filterFloatAD(List<FloatAD> 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;

--
Gitblit v1.8.0