From f67743e47f57dafc7031af44e2037c03e680a60c Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期一, 25 三月 2019 11:30:43 +0800 Subject: [PATCH] 清理无效引用 --- fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsClassAdminCotroller.java | 129 +++--------------------------------------- 1 files changed, 11 insertions(+), 118 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 7277912..195619b 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 @@ -8,7 +8,6 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -17,14 +16,14 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.commons.CommonsMultipartFile; +import org.yeshi.utils.JsonUtil; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.yeshi.fanli.entity.admin.GoodsClassAdmin; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; -import com.yeshi.fanli.entity.system.System; -import com.yeshi.fanli.service.inter.config.SystemService; -import com.yeshi.fanli.service.inter.goods.ClassRecommendGoodsService; +import com.yeshi.fanli.entity.system.BusinessSystem; +import com.yeshi.fanli.service.inter.config.BusinessSystemService; import com.yeshi.fanli.service.inter.goods.GoodsClassService; import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService; import com.yeshi.fanli.service.inter.goods.GoodsSubClassService; @@ -34,8 +33,6 @@ import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.Utils; -import com.yeshi.fanli.util.annotation.RequestNoLogin; -import org.yeshi.utils.JsonUtil; import net.sf.json.JSONObject; @@ -49,8 +46,6 @@ @Resource private SuperGoodsClassService superGoodsClassService; - @Resource - private ClassRecommendGoodsService classRecommendGoodsService; @Resource private GoodsSecondClassService goodsSecondClassService; @@ -62,11 +57,9 @@ private LabelClassService labelClassService; @Resource - private SystemService systemService; + private BusinessSystemService businessSystemService; - // private static final String IMGPATH="/upload/class"; - - @RequestMapping(value = "getGoodsClassList"/* , method = RequestMethod.POST */) + @RequestMapping(value = "getGoodsClassList") public void getGoodsClassList(String callback, Integer pageIndex, String platform, String packages, String key, PrintWriter out) { List<GoodsClassAdmin> goodsClassList = goodsClassService.getGoodsClassAdmins(pageIndex - 1, platform, packages, key); @@ -81,17 +74,12 @@ pe.setParams(map); JSONObject data = new JSONObject(); data.put("pe", pe); - List<System> systemList = systemService.getSystems(); + List<BusinessSystem> systemList = businessSystemService.getBusinessSystems(); data.put("systemList", systemList); data.put("goodsClassList", goodsClassList); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); - - // out.print(JsonUtil.loadTrueResult(data)); - - return; - } @RequestMapping(value = "queryAll") @@ -105,26 +93,19 @@ return; } - Map<String, String> map = new HashMap<String, String>(); - map.put("platform", platform); - map.put("packages", packages); JSONObject data = new JSONObject(); - - // List<System> systemList = systemService.getSystems(); - // data.put("systemList", systemList); - data.put("goodsClassList", goodsClassList); JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); } } - @RequestMapping(value = "getGoodsClasAll"/* , method = RequestMethod.POST */) + + @RequestMapping(value = "getGoodsClasAll") public void getGoodsClassAll(String callback, PrintWriter out) { List<GoodsClass> goodsClassList = goodsClassService.getGoodsClassAll(); @@ -138,67 +119,6 @@ } } - @RequestMapping(value = "addGoodsClass", method = RequestMethod.POST) - public void addGoodsClass(GoodsClass goodsClass, PrintWriter out) { - if (goodsClass == null) { - out.print(JsonUtil.loadFalseResult("goodsClass涓嶈兘涓虹┖")); - return; - } - Integer res = goodsClassService.addGoodsClass(goodsClass); - if (res == null) { - out.print(JsonUtil.loadTrueResult("娣诲姞鍒嗙被鎴愬姛")); - } else { - out.print(JsonUtil.loadFalseResult("娣诲姞澶辫触")); - } - return; - } - - // @RequestMapping(value="uploadImg",method=RequestMethod.POST) - // public void uploadImg(@RequestParam("file") CommonsMultipartFile - // file,HttpServletRequest request,PrintWriter out){ - // ServletContext servletContext = request.getSession().getServletContext(); - // JSONObject json=new JSONObject(); - // if(file != null){ - // String root=servletContext.getRealPath(IMGPATH); - // if (!new File(root).exists()){ - // new File(root).mkdirs(); - // } - // File newFile=new File(root+"/"+file.getOriginalFilename()); - // //閫氳繃CommonsMultipartFile鐨勬柟娉曠洿鎺ュ啓鏂囦欢锛堟敞鎰忚繖涓椂鍊欙級 - // try { - // file.transferTo(newFile); - // json.put("code", "0"); - // json.put("path", IMGPATH+"/"+newFile.getName()); - // } catch (IllegalStateException e) { - // e.printStackTrace(); - // json.put("code", "1"); - // } catch (IOException e) { - // e.printStackTrace(); - // json.put("code", "1"); - // }finally{ - // out.print(json); - // } - // }else{ - // json.put("code", "1"); - // out.print(json); - // } - // } - - @RequestMapping(value = "setGoodsClassSystem", method = RequestMethod.POST) - public void setGoodsClassSystem(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); - if (integer > 0) { - out.print(JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛")); - } else { - out.print(JsonUtil.loadTrueResult("鍒犻櫎澶辫触")); - } - } else { - superGoodsClassService.addSuperGoodsClass(gcid, platform, packageName); - out.print(JsonUtil.loadTrueResult("娣诲姞鎴愬姛")); - } - } @RequestMapping(value = "getGoodsClass", method = RequestMethod.POST) public void getGoodsClass(long id, PrintWriter out) { @@ -210,17 +130,6 @@ out.print(JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨGoodsClass")); } - @RequestMapping(value = "deleteGoodsClass", method = RequestMethod.POST) - public void deleteGoodsClass(long[] gcids, PrintWriter out) { - goodsClassService.deleteGoodsClasss(gcids); - out.print(JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛")); - } - - @RequestMapping(value = "updateGoodsClass", method = RequestMethod.POST) - public void updateGoodsClass(GoodsClass goodsClass, PrintWriter out) { - goodsClassService.updateGoodsClass(goodsClass); - out.print(JsonUtil.loadTrueResult("淇敼鎴愬姛")); - } /** * 娣诲姞绫诲埆 @@ -230,12 +139,8 @@ * @param request * @param out */ - @RequestNoLogin() @RequestMapping(value = "saveAdd", method = RequestMethod.POST) - public void saveAdd(String callback, GoodsClass goodsClass, HttpServletRequest request, HttpServletResponse response, PrintWriter out) { - - response.setHeader("Access-Control-Allow-Origin", "*"); - response.setHeader("Access-Control-Allow-Methods", "*"); + public void saveAdd(String callback, GoodsClass goodsClass, HttpServletRequest request, PrintWriter out) { try { String name = goodsClass.getName(); @@ -382,10 +287,7 @@ Long recordId = Long.parseLong(id); superGoodsClassService.deleteSuperGoodsClass(recordId); - classRecommendGoodsService.deleteClassGoodsByGC(recordId); - // goodsSecondClassService.deleteSecondClassByGC(recordId); - // 鍒犻櫎瀛愮被鍒嗙被 goodsSubClassService.deleteByRootId(recordId); // 鍒犻櫎绫诲埆鍏宠仈鏍囩 @@ -414,18 +316,13 @@ * @param out * @param response */ - @RequestNoLogin() @RequestMapping(value = "uploadPicture") - public void uploadPicture(Long id, @RequestParam("file") CommonsMultipartFile file, PrintWriter out, HttpServletResponse response) { - - response.setHeader("Access-Control-Allow-Origin", "*"); - response.setHeader("Access-Control-Allow-Methods", "*"); + public void uploadPicture(Long id, @RequestParam("file") CommonsMultipartFile file, PrintWriter out) { try { - GoodsClass goodsClass = goodsClassService.getGoodsClass(id); - if (goodsClass == null) { + if (goodsClass == null ) { out.print(JsonUtil.loadFalseResult("璇ョ被鍒笉瀛樺湪鎴栧凡琚垹闄�")); return; } @@ -436,15 +333,11 @@ } goodsClassService.uploadPicture(goodsClass, file); - out.print(JsonUtil.loadTrueResult("涓婁紶鎴愬姛")); - } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); out.print(JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); } - } /** -- Gitblit v1.8.0