From 953f4931a963e031dc35c9a42d342672317fb933 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期日, 26 四月 2020 17:12:37 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div
---
fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java | 80 +++++++++++++++++++++------------------
1 files changed, 43 insertions(+), 37 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..ca1cf36 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
@@ -15,8 +15,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 +37,23 @@
@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(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,7 +71,6 @@
}
-
@RequestMapping(value = "getGoodsClasAll")
public void getGoodsClassAll(String callback, PrintWriter out) {
List<GoodsClass> goodsClassList = goodsClassService.getGoodsClassAll();
@@ -89,7 +85,6 @@
}
}
-
/**
* 淇濆瓨淇℃伅
*
@@ -98,24 +93,47 @@
* @param out
*/
@RequestMapping(value = "save")
- public void save(String callback, GoodsClass goodsClass, String jumpType, HttpServletRequest request,PrintWriter out) {
+ public void save(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(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();
+ }
+ }
+
/**
@@ -137,7 +155,7 @@
e.printStackTrace();
}
}
-
+
/**
* 鎵归噺鍒犻櫎
*
@@ -147,9 +165,7 @@
*/
@RequestMapping(value = "deleteBatch")
public void deleteBatch(String callback, String ids, PrintWriter out) {
-
Gson gson = new Gson();
-
try {
List<String> recordIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {
}.getType());
@@ -162,25 +178,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();
}
-
}
-
-
/**
* 鍒犻櫎鍥剧墖
@@ -192,7 +204,6 @@
*/
@RequestMapping(value = "removePicture")
public void removePicture(String callback, Long id, PrintWriter out) {
-
try {
GoodsClass goodsClass = goodsClassService.getGoodsClass(id);
@@ -210,9 +221,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(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 +238,12 @@
JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("娣诲姞鎴愬姛"));
}
}
-
-
+
@RequestMapping(value = "getClassOption")
public void getClassOption(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