From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassLabelAdminController.java | 260 ++++++++++++++++++++++++++-------------------------- 1 files changed, 130 insertions(+), 130 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassLabelAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassLabelAdminController.java index 02f7bba..9c0335f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassLabelAdminController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsSubClassLabelAdminController.java @@ -1,130 +1,130 @@ -package com.yeshi.fanli.controller.admin; - -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -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.yeshi.utils.JsonUtil; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; -import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel; -import com.yeshi.fanli.exception.goods.GoodsClassException; -import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService; -import com.yeshi.fanli.tag.PageEntity; -import com.yeshi.fanli.util.StringUtil; - -import net.sf.json.JSONObject; - -@Controller -@RequestMapping("admin/new/api/v1/goodsSubClassLabel") -public class GoodsSubClassLabelAdminController { - - @Resource - private GoodsSubClassLabelService goodsSubClassLabelService; - - /** - * 鏍囩鍒楄〃 - * - * @param callback - * @param classId - * @param pageIndex - * @param pageSize - * @param request - * @param out - */ - @RequestMapping(value = "labelList") - public void labelList(AdminAcceptData acceptData, String callback, Long classId, int pageIndex, int pageSize, HttpServletRequest request, - PrintWriter out) { - - if (classId != null && classId == 0) - classId = null; - List<GoodsSubClassLabel> list = goodsSubClassLabelService.listLabelByClassId(classId); - GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.serializeNulls(); // 閲嶇偣 - Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create(); - - JSONObject data = new JSONObject(); - data.put("resultList", gson.toJson(list)); - PageEntity pe = new PageEntity(pageIndex, pageSize, list.size(), 1); - data.put("pe", pe); - out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); - } - - /** - * 淇濆瓨淇℃伅 - * - * @param callback - * @param special - * @param out - */ - @RequestMapping(value = "saveLabel") - public void save(AdminAcceptData acceptData,String callback, GoodsSubClassLabel label, HttpServletRequest request, PrintWriter out) { - if (StringUtil.isNullOrEmpty(label.getName()) || label.getGoodsClass() == null || label.getOrderBy() == null) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏁版嵁涓嶅畬鏁�")); - return; - } - if (label.getId() == null)// 鏂板 - { - if (label.getGoodsClass().getId() == null) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鍒嗙被涓嶈兘涓虹┖")); - return; - } - - label.setCreateTime(new Date()); - try { - String[] names = label.getName().replace("锛�", ",").split(","); - int orderBy = label.getOrderBy(); - for (String name : names) { - label.setId(null); - label.setOrderBy(orderBy++); - label.setName(name); - goodsSubClassLabelService.addSubClassLabel(label); - } - } catch (GoodsClassException e) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage())); - } - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("娣诲姞鎴愬姛")); - } else {// 淇敼 - goodsSubClassLabelService.updateSubClassLabel(label); - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇敼鎴愬姛")); - } - } - - /** - * 鎵归噺鍒犻櫎 - * - * @param callback - * @param ids - * @param out - */ - @RequestMapping(value = "deleteLabelBatch") - 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()); - - if (recordIds == null || recordIds.size() == 0) { - out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇烽�夋嫨闇�鍒犻櫎鏁版嵁"))); - } else { - - for (String id : recordIds) - goodsSubClassLabelService.deleteLabel(Long.parseLong(id)); - out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"))); - } - } catch (Exception e) { - out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); - e.printStackTrace(); - } - } - -} +package com.yeshi.fanli.controller.admin; + +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +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.yeshi.utils.JsonUtil; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel; +import com.yeshi.fanli.exception.goods.GoodsClassException; +import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService; +import com.yeshi.common.entity.PageEntity; +import com.yeshi.fanli.util.StringUtil; + +import net.sf.json.JSONObject; + +@Controller +@RequestMapping("admin/new/api/v1/goodsSubClassLabel") +public class GoodsSubClassLabelAdminController { + + @Resource + private GoodsSubClassLabelService goodsSubClassLabelService; + + /** + * 鏍囩鍒楄〃 + * + * @param callback + * @param classId + * @param pageIndex + * @param pageSize + * @param request + * @param out + */ + @RequestMapping(value = "labelList") + public void labelList(AdminAcceptData acceptData, String callback, Long classId, int pageIndex, int pageSize, HttpServletRequest request, + PrintWriter out) { + + if (classId != null && classId == 0) + classId = null; + List<GoodsSubClassLabel> list = goodsSubClassLabelService.listLabelByClassId(classId); + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.serializeNulls(); // 閲嶇偣 + Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create(); + + JSONObject data = new JSONObject(); + data.put("resultList", gson.toJson(list)); + PageEntity pe = new PageEntity(pageIndex, pageSize, list.size(), 1); + data.put("pe", pe); + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); + } + + /** + * 淇濆瓨淇℃伅 + * + * @param callback + * @param special + * @param out + */ + @RequestMapping(value = "saveLabel") + public void save(AdminAcceptData acceptData,String callback, GoodsSubClassLabel label, HttpServletRequest request, PrintWriter out) { + if (StringUtil.isNullOrEmpty(label.getName()) || label.getGoodsClass() == null || label.getOrderBy() == null) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏁版嵁涓嶅畬鏁�")); + return; + } + if (label.getId() == null)// 鏂板 + { + if (label.getGoodsClass().getId() == null) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鍒嗙被涓嶈兘涓虹┖")); + return; + } + + label.setCreateTime(new Date()); + try { + String[] names = label.getName().replace("锛�", ",").split(","); + int orderBy = label.getOrderBy(); + for (String name : names) { + label.setId(null); + label.setOrderBy(orderBy++); + label.setName(name); + goodsSubClassLabelService.addSubClassLabel(label); + } + } catch (GoodsClassException e) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage())); + } + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("娣诲姞鎴愬姛")); + } else {// 淇敼 + goodsSubClassLabelService.updateSubClassLabel(label); + JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("淇敼鎴愬姛")); + } + } + + /** + * 鎵归噺鍒犻櫎 + * + * @param callback + * @param ids + * @param out + */ + @RequestMapping(value = "deleteLabelBatch") + 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()); + + if (recordIds == null || recordIds.size() == 0) { + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("璇烽�夋嫨闇�鍒犻櫎鏁版嵁"))); + } else { + + for (String id : recordIds) + goodsSubClassLabelService.deleteLabel(Long.parseLong(id)); + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"))); + } + } catch (Exception e) { + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父"))); + e.printStackTrace(); + } + } + +} -- Gitblit v1.8.0