From c8f11c229b87d1652b6da0b15576c166cd51eb8b Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 01 一月 2020 14:25:22 +0800
Subject: [PATCH] 首页悬浮图mapperbug修改,增加商品详情中的比例展示

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 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 141e179..32dbdc3 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
@@ -22,7 +22,7 @@
 import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
 import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
 import com.yeshi.fanli.entity.bus.clazz.TaoBaoClass;
-import com.yeshi.fanli.exception.GoodsClassException;
+import com.yeshi.fanli.exception.goods.GoodsClassException;
 import com.yeshi.fanli.service.inter.goods.GoodsClassService;
 import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
 import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
@@ -81,9 +81,9 @@
 	}
 
 	@Override
-	public List<GoodsClass> listquery() throws Exception {
+	public List<GoodsClass> listquery(Integer sex) throws Exception {
 
-		List<GoodsClass> list = goodsClassMapper.getGoodsClassAll();
+		List<GoodsClass> list = goodsClassMapper.getGoodsClassAll(sex);
 
 		if (list != null && list.size() == 0) {
 			return list;
@@ -135,18 +135,23 @@
 	}
 
 	public List<GoodsClass> getGoodsClassAll() {
-		return goodsClassMapper.getGoodsClassAll();
+		return goodsClassMapper.getGoodsClassAll(null);
 	}
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor=Exception.class)
 	public void saveObject(MultipartFile file, GoodsClass record) throws GoodsClassException, Exception {
 
 		String name = record.getName();
 		if (name == null || name.trim().length() == 0) {
 			throw new GoodsClassException(1, "鍒嗙被鍚嶇О涓嶈兘涓虹┖");
 		}
-
+		
+		Integer sex = record.getSex();
+		if (sex == null) {
+			throw new GoodsClassException(1, "鎬у埆璁剧疆涓嶈兘涓虹┖");
+		}
+		
 		// 鍥剧墖涓婁紶
 		String picture = null;
 		if (file != null) {
@@ -209,9 +214,16 @@
 
 		// 淇濆瓨娣樺疂鍟嗗搧鍒嗙被id
 		String taobaoCids = record.getTaobaoCids();
+		List<Long> tbCidList = new ArrayList<>();
 		if (!StringUtil.isNullOrEmpty(taobaoCids) && !"null".equalsIgnoreCase(taobaoCids)) {
-			taoBaoClassService.save(record.getId(), taobaoCids);
+
+			String[] sts = taobaoCids.split(",");
+			for (String st : sts) {
+				String cid = st.split("-")[st.split("-").length - 1].trim();
+				tbCidList.add(Long.parseLong(cid));
+			}
 		}
+		taoBaoClassService.save(record.getId(), tbCidList);
 	}
 
 	/**
@@ -302,7 +314,7 @@
 
 	@Override
 	@Cacheable(value = "classCache", key = "'getEffectiveClassCache'")
-	public List<GoodsClass> getEffectiveClassCache() throws Exception {
+	public List<GoodsClass> getEffectiveClassCache() {
 		return goodsClassMapper.getEffectiveClass();
 	}
 
@@ -363,7 +375,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