From 4a05f1c9c508ab7f10c5eae22a5c716f5454ca02 Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期二, 12 三月 2019 16:29:55 +0800 Subject: [PATCH] 冲突提交 --- fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/SwiperBannerAdminController.java | 78 ++++++++++++++++++++++----------------- 1 files changed, 44 insertions(+), 34 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/SwiperBannerAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/SwiperBannerAdminController.java index ed1ff94..955142c 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/homemodule/SwiperBannerAdminController.java +++ b/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(); + } + } /** * 淇敼鎺掑簭 -- Gitblit v1.8.0