admin
2019-03-13 33b4ed2bbf28ec16b66e552680f56a691a4e908d
fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/SwiperBannerAdminController.java
@@ -384,6 +384,7 @@
         record.setOrder(maxOrder + 1);
         // 默认停用
         record.setState(1);
         record.setAutoControl(1);
         record.setCreatetime(new Date());
         record.setUpdatetime(new Date());
         
@@ -470,40 +471,7 @@
            return;
         }
         SwiperPicture resultObj = swiperPictureService.selectByPrimaryKey(id);
         if (resultObj == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
            return;
         }
         String params = record.getParams();
         String remark = record.getRemark();
         if (StringUtil.isNullOrEmpty(params) && StringUtil.isNullOrEmpty(jumpType)
               && StringUtil.isNullOrEmpty(remark)) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作内容不能为空"));
            return;
         }
         if (!StringUtil.isNullOrEmpty(params)) {
            String jumpValue = systemConfigService.get("jump");
            if (StringUtil.isNullOrEmpty(jumpValue)) {
               jumpValue = "{\"url\":\"#\"}";
            }
            params = jumpValue.replace("#", params);
            record.setParams(params);
         }
         if (!StringUtil.isNullOrEmpty(jumpType)) {
            List<JumpDetailV2> listByType = jumpDetailV2Service.listByType(jumpType);
            if (listByType !=null && listByType.size() > 0) {
               record.setJumpDetail(listByType.get(0));
            }
         }
         swiperPictureService.updateByPrimaryKeySelective(record);
         swiperPictureService.save(record);
         
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
         
@@ -588,6 +556,48 @@
         e.printStackTrace();
      }
   }
   /**
    *  更新自动控制状态
    * @param callback
    * @param id
    * @param out
    */
   @RequestMapping(value = "updateAutoControl")
   public void updateAutoControl(String callback, Long id, PrintWriter out) {
      try {
         if (id == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("ID不能为空"));
            return;
         }
         SwiperPicture resultObj = swiperPictureService.selectByPrimaryKey(id);
         if (resultObj == null) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
            return;
         }
         Integer state = resultObj.getAutoControl();
         if (state == null ||  state.equals(1) || state == 1) {
            resultObj.setAutoControl(0);
         } else {
            resultObj.setAutoControl(1);
         }
         swiperPictureService.updateByPrimaryKeySelective(resultObj);
         JSONObject data = new JSONObject();
         data.put("state", resultObj.getState());
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
      } catch (SwiperPictureException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
         e.printStackTrace();
      }
   }
   /**
    * 修改排序