From f99d8098b0aee17c09be5dfee8b4f72a6f4071b1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期日, 26 四月 2020 11:57:39 +0800
Subject: [PATCH] 同步老用户等级数据

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
index 5bae6ea..d685960 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -36,6 +36,7 @@
 import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
 import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.FilePathEnum;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
 import com.yeshi.fanli.vo.brand.BrandInfoVO;
@@ -201,20 +202,42 @@
 	 * @throws Exception
 	 */
 	public String uploadPicture(MultipartFile file) throws Exception {
-
 		// 鏂囦欢瑙f瀽
 		InputStream inputStream = file.getInputStream();
 		String contentType = file.getContentType();
 		String type = contentType.substring(contentType.indexOf("/") + 1);
 
 		// 鏂囦欢璺緞
-		String filePath = "/img/brand/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
+		String filePath = FilePathEnum.brand.getPath() + UUID.randomUUID().toString().replace("-", "") + "." + type;
 		// 鎵ц涓婁紶
-		String fileLink = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
-
-		return fileLink;
+		return COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
 	}
 
+	
+	@Override
+	public void switchState(Long id) throws BrandInfoException {
+		if (id == null) {
+			throw new BrandInfoException(1, "璇蜂紶閫掓纭弬鏁�");
+		}
+		BrandInfo resultObj = brandInfoMapper.selectByPrimaryKey(id);
+		if (resultObj == null) {
+			throw new BrandInfoException(1, "姝ゅ唴瀹瑰凡涓嶅瓨鍦�");
+		}
+		
+		Integer state = resultObj.getState();
+		if (state == null || state == 0) {
+			state = 1;
+		} else {
+			state = 0;
+		}
+		
+		BrandInfo updateObj = new BrandInfo();
+		updateObj.setId(id);
+		updateObj.setState(state);
+		brandInfoMapper.updateByPrimaryKeySelective(updateObj);
+	}
+	
+	
 	@Override
 	public int deleteBatchByPrimaryKey(List<Long> list) {
 		executor.execute(new Runnable() {

--
Gitblit v1.8.0