| | |
| | | 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;
|
| | |
| | | @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("暂无数据"));
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | @RequestMapping(value = "getGoodsClasAll")
|
| | | public void getGoodsClassAll(String callback, PrintWriter out) {
|
| | | List<GoodsClass> goodsClassList = goodsClassService.getGoodsClassAll();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 保存信息
|
| | | *
|
| | |
| | | * @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. 先判断httpRequest 是否含有文件类型 |
| | | // 1. 先判断httpRequest 是否含有文件类型
|
| | | 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();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | |
|
| | | /**
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 批量删除
|
| | | *
|
| | |
| | | */
|
| | | @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());
|
| | |
| | | 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();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 删除图片
|
| | |
| | | */
|
| | | @RequestMapping(value = "removePicture")
|
| | | public void removePicture(String callback, Long id, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | GoodsClass goodsClass = goodsClassService.getGoodsClass(id);
|
| | |
|
| | |
| | | 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);
|
| | |
| | | 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));
|
| | |
|
| | | }
|
| | | }
|