admin
2020-07-04 9d35ba657fa5e3add766405d76e3ff8c4dcd4ad4
fanli/src/main/java/com/yeshi/fanli/controller/admin/BrandShopAdminController.java
@@ -9,6 +9,8 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.yeshi.fanli.entity.SystemEnum;
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;
@@ -54,13 +56,14 @@
    * 保存信息
    * 
    * @param callback
    * @param special
    * @param out
    */
   @RequestMapping(value = "save")
   public void save(String callback, BrandClass brandClass, PrintWriter out) {
   public void save(AdminAcceptData acceptData, String callback, BrandClass brandClass, PrintWriter out) {
      try {
         brandClassService.saveObject(brandClass);
         List<SystemEnum> systemList=new ArrayList<>();
         systemList.add(acceptData.getSystem());
         brandClassService.saveObject(brandClass,systemList);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
      } catch (BrandClassException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
@@ -74,13 +77,12 @@
    * 修改排序
    * 
    * @param callback
    * @param goodsClass
    * @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 {
         brandClassService.updateOrder(id, moveType);
         brandClassService.updateOrder(id, moveType,acceptData.getSystem());
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
      } catch (BrandClassException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
@@ -101,9 +103,8 @@
    * @param out
    */
   @RequestMapping(value = "query")
   public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer state,
   public void query(AdminAcceptData acceptData, String callback, Integer pageIndex, Integer pageSize, String key, Integer state,
         PrintWriter out) {
      if (pageIndex == null || pageIndex < 1) {
         pageIndex = 1;
      }
@@ -113,14 +114,13 @@
      }
      try {
         List<BrandClass> list = brandClassService.listQuery((pageIndex - 1) * pageSize, pageSize, key, state);
         List<BrandClass> list = brandClassService.listQuery((pageIndex - 1) * pageSize, pageSize, key, state,acceptData.getSystem());
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            return;
         }
         long count = brandClassService.countQuery(key, state);
         long count = brandClassService.countQuery(key, state,acceptData.getSystem());
         int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
         PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
@@ -132,11 +132,28 @@
         JSONObject data = new JSONObject();
         data.put("pe", pe);
         data.put("result_list", gson.toJson(list));
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
      } catch (Exception e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
         e.printStackTrace();
      }
   }
   /**
    * 修改状态
    * @param callback
    * @param id
    * @param out
    */
   @RequestMapping(value = "switchStateClass")
   public void switchStateClass(String callback, Long id, PrintWriter out) {
      try {
         brandClassService.switchState(id);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
      } catch (BrandClassException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
         e.printStackTrace();
      }
   }
@@ -150,7 +167,6 @@
    */
   @RequestMapping(value = "delete")
   public void delete(String callback, String idArray, PrintWriter out) {
      try {
         if (StringUtil.isNullOrEmpty(idArray)) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
@@ -179,9 +195,9 @@
    * @param out
    */
   @RequestMapping(value = "getOptions")
   public void getOptions(String callback, PrintWriter out) {
   public void getOptions(AdminAcceptData acceptData, String callback, PrintWriter out) {
      try {
         List<BrandClass> list = brandClassService.listEffective();
         List<BrandClass> list = brandClassService.listEffective(acceptData.getSystem());
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            return;
@@ -278,7 +294,6 @@
    * 添加店铺入库
    * 
    * @param callback
    * @param special
    * @param out
    */
   @RequestMapping(value = "saveShopInfo")
@@ -362,7 +377,6 @@
    * 保存信息
    * 
    * @param callback
    * @param special
    * @param out
    */
   @RequestMapping(value = "saveClassShop")
@@ -388,7 +402,6 @@
    * 修改排序
    * 
    * @param callback
    * @param goodsClass
    * @param out
    */
   @RequestMapping(value = "updateOrderClassShop")
@@ -465,6 +478,25 @@
   
   
   /**
    * 修改状态
    * @param callback
    * @param id
    * @param out
    */
   @RequestMapping(value = "switchStateBrand")
   public void switchStateBrand(String callback, Long id, PrintWriter out) {
      try {
         brandInfoService.switchState(id);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
      } catch (BrandInfoException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
         e.printStackTrace();
      }
   }
   /**
    * 删除
    * 
    * @param callback
@@ -498,7 +530,6 @@
    * 修改排序
    * 
    * @param callback
    * @param goodsClass
    * @param out
    */
   @RequestMapping(value = "updateOrderBrand")