From 24a8d17e007545f7426c48352109aa1a9c6587ee Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 06 五月 2020 12:02:09 +0800
Subject: [PATCH] IOS上线隐藏我的界面的banner与超级会员升级信息

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java
index f22e70a..8cc434f 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java
@@ -28,6 +28,7 @@
 import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
 import com.yeshi.fanli.service.inter.lable.LabelClassService;
 import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.FilePathEnum;
 import com.yeshi.fanli.util.StringUtil;
 
 @Service
@@ -139,7 +140,7 @@
 	}
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor=Exception.class)
 	public void saveObject(MultipartFile file, GoodsClass record) throws GoodsClassException, Exception {
 
 		String name = record.getName();
@@ -241,7 +242,7 @@
 		String type = contentType.substring(contentType.indexOf("/") + 1);
 
 		// 鏂囦欢璺緞
-		String filePath = "/img/GoodsClass/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
+		String filePath = FilePathEnum.goodsClass.getPath() + UUID.randomUUID().toString().replace("-", "") + "." + type;
 		// 鎵ц涓婁紶
 		String fileLink = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
 
@@ -268,7 +269,7 @@
 		String contentType = file.getContentType();
 		String type = contentType.substring(contentType.indexOf("/") + 1);
 		// 涓婁紶鏂囦欢鐩稿浣嶇疆
-		String fileUrl = "ClassImg/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
+		String fileUrl = FilePathEnum.goodsClassOld.getPath()+ UUID.randomUUID().toString().replace("-", "") + "." + type;
 
 		boolean deleteFile = true;
 
@@ -312,6 +313,30 @@
 		}
 	}
 
+	@Override
+	public void switchState(Long id) throws GoodsClassException {
+		if (id == null) {
+			throw new GoodsClassException(1, "璇蜂紶閫掓纭弬鏁�");
+		}
+		GoodsClass resultObj = goodsClassMapper.selectByPrimaryKey(id);
+		if (resultObj == null) {
+			throw new GoodsClassException(1, "姝ゅ唴瀹瑰凡涓嶅瓨鍦�");
+		}
+		
+		Integer state = resultObj.getState();
+		if (state == null || state == 0) {
+			state = 1;
+		} else {
+			state = 0;
+		}
+		
+		GoodsClass updateObj = new GoodsClass();
+		updateObj.setId(id);
+		updateObj.setState(state);
+		goodsClassMapper.updateByPrimaryKeySelective(updateObj);
+	}
+	
+	
 	@Override
 	@Cacheable(value = "classCache", key = "'getEffectiveClassCache'")
 	public List<GoodsClass> getEffectiveClassCache() {
@@ -375,7 +400,7 @@
 	}
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor=Exception.class)
 	public void updateOrder(Long id, Integer moveType) throws GoodsClassException {
 
 		if (id == null || moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {

--
Gitblit v1.8.0