From eec7e789a87863c25d92c10ad5dfc22ad80c448d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 14 七月 2020 12:36:48 +0800
Subject: [PATCH] 系统区分BUG修复

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java |   93 ++++++++++++++++++++++++----------------------
 1 files changed, 49 insertions(+), 44 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java
index 2114953..f2ddc4b 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java
@@ -7,6 +7,7 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
+import com.yeshi.fanli.entity.accept.AdminAcceptData;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
@@ -15,8 +16,7 @@
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
-import com.yeshi.fanli.exception.FloatADException;
-import com.yeshi.fanli.exception.GoodsClassException;
+import com.yeshi.fanli.exception.goods.GoodsClassException;
 import com.yeshi.fanli.service.inter.config.BusinessSystemService;
 import com.yeshi.fanli.service.inter.goods.GoodsClassService;
 import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
@@ -38,25 +38,21 @@
 	@Resource
 	private SuperGoodsClassService superGoodsClassService;
 
-
 	@Resource
 	private GoodsSecondClassService goodsSecondClassService;
 
 	@Resource
 	private GoodsSubClassService goodsSubClassService;
-	
+
 	@Resource
 	private LabelClassService labelClassService;
 
-	@Resource
-	private BusinessSystemService businessSystemService;
-
 
 	@RequestMapping(value = "queryAll")
-	public void queryAll(String callback, String platform, String packages, PrintWriter out) {
+	public void listquery(AdminAcceptData acceptData, String callback, Integer sex, PrintWriter out) {
 
 		try {
-			List<GoodsClass> goodsClassList = goodsClassService.queryAll(platform, packages);
+			List<GoodsClass> goodsClassList = goodsClassService.listquery(sex);
 
 			if (goodsClassList == null || goodsClassList.size() == 0) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"));
@@ -74,9 +70,8 @@
 
 	}
 
-	
 	@RequestMapping(value = "getGoodsClasAll")
-	public void getGoodsClassAll(String callback, PrintWriter out) {
+	public void getGoodsClassAll(AdminAcceptData acceptData,String callback, PrintWriter out) {
 		List<GoodsClass> goodsClassList = goodsClassService.getGoodsClassAll();
 
 		if (goodsClassList == null || goodsClassList.size() == 0) {
@@ -89,7 +84,6 @@
 		}
 	}
 
-	
 	/**
 	 * 淇濆瓨淇℃伅
 	 * 
@@ -98,24 +92,47 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "save")
-	public void save(String callback, GoodsClass goodsClass, String jumpType, HttpServletRequest request,PrintWriter out) {
+	public void save(AdminAcceptData acceptData,String callback, GoodsClass goodsClass, String jumpType, HttpServletRequest request,
+			PrintWriter out) {
+		if (goodsClass.getTaobaoCids() != null)
+			goodsClass.setTaobaoCids(goodsClass.getTaobaoCids().replace("锛�", ","));
 		try {
-			// 1. 鍏堝垽鏂環ttpRequest 鏄惁鍚湁鏂囦欢绫诲瀷 
+			// 1. 鍏堝垽鏂環ttpRequest 鏄惁鍚湁鏂囦欢绫诲瀷
 			if (request instanceof MultipartHttpServletRequest) {
-		        MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
-		        goodsClassService.saveObject(fileRequest.getFile("file"), goodsClass);
-	        }else{
-	        	goodsClassService.saveObject(null, goodsClass);
-	        }
-			
+				MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
+				goodsClassService.saveObject(fileRequest.getFile("file"), goodsClass);
+			} else {
+				goodsClassService.saveObject(null, goodsClass);
+			}
+
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇濆瓨鎴愬姛"));
-		} catch (FloatADException e) {
+		} catch (GoodsClassException e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
 		} catch (Exception e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("淇濆瓨澶辫触"));
 			e.printStackTrace();
 		}
 	}
+	
+	/**
+	 * 淇敼鐘舵��
+	 * @param callback
+	 * @param id
+	 * @param out
+	 */
+	@RequestMapping(value = "switchState")
+	public void switchState(AdminAcceptData acceptData,String callback, Long id, PrintWriter out) {
+		try {
+			goodsClassService.switchState(id);
+			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛"));
+		} catch (GoodsClassException e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
+		} catch (Exception e) {
+			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔澶辫触"));
+			e.printStackTrace();
+		}
+	}
+	
 	
 
 	/**
@@ -126,7 +143,7 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "updateOrder")
-	public void updateOrder(String callback, Long id, Integer moveType, PrintWriter out) {
+	public void updateOrder(AdminAcceptData acceptData,String callback, Long id, Integer moveType, PrintWriter out) {
 		try {
 			goodsClassService.updateOrder(id, moveType);
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鎿嶄綔鎴愬姛"));
@@ -137,7 +154,7 @@
 			e.printStackTrace();
 		}
 	}
-	
+
 	/**
 	 * 鎵归噺鍒犻櫎
 	 * 
@@ -146,10 +163,8 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "deleteBatch")
-	public void deleteBatch(String callback, String ids, PrintWriter out) {
-
+	public void deleteBatch(AdminAcceptData acceptData,String callback, String ids, PrintWriter out) {
 		Gson gson = new Gson();
-
 		try {
 			List<String> recordIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {
 			}.getType());
@@ -162,25 +177,21 @@
 					Long recordId = Long.parseLong(id);
 
 					superGoodsClassService.deleteSuperGoodsClass(recordId);
-					
+
 					// 鍒犻櫎瀛愮被鍒嗙被
 					goodsSubClassService.deleteByRootId(recordId);
 					// 鍒犻櫎绫诲埆鍏宠仈鏍囩
 					labelClassService.deleteByClassId(recordId);
-					
+
 					goodsClassService.deleteGoodsClass(recordId);
 				}
 				JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"));
 			}
-
 		} catch (Exception e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"));
 			e.printStackTrace();
 		}
-
 	}
-
-	
 
 	/**
 	 * 鍒犻櫎鍥剧墖
@@ -191,8 +202,7 @@
 	 * @param response
 	 */
 	@RequestMapping(value = "removePicture")
-	public void removePicture(String callback, Long id, PrintWriter out) {
-
+	public void removePicture(AdminAcceptData acceptData,String callback, Long id, PrintWriter out) {
 		try {
 			GoodsClass goodsClass = goodsClassService.getGoodsClass(id);
 
@@ -210,9 +220,10 @@
 			out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")));
 		}
 	}
-	
+
 	@RequestMapping(value = "setSuperSystem")
-	public void setSuperSystem(String callback,String type, Long gcid, String platform, String packageName, PrintWriter out) {
+	public void setSuperSystem(AdminAcceptData acceptData,String callback, String type, Long gcid, String platform, String packageName,
+			PrintWriter out) {
 		platform = Utils.getMap().get(platform);
 		if (Constant.DEL.equals(type)) {
 			Integer integer = superGoodsClassService.deleteSuperGoodsClass(gcid, platform, packageName);
@@ -226,18 +237,12 @@
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("娣诲姞鎴愬姛"));
 		}
 	}
-	
-	
+
 	@RequestMapping(value = "getClassOption")
-	public void getClassOption(String callback, PrintWriter out) {
-
+	public void getClassOption(AdminAcceptData acceptData,String callback, PrintWriter out) {
 		List<GoodsClass> goodsClassList = goodsClassService.getGoodsClassAll();
-
 		JSONObject data = new JSONObject();
-
 		data.put("result_list", goodsClassList);
-
 		JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
-
 	}
 }

--
Gitblit v1.8.0