From d03cfc79aefff8db901df9bb3f6436d89a6d9819 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Mon, 30 Sep 2019 11:01:37 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=B5=AE=E5=B1=82=E5=B9=BF=E5=91=8A][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E4=B8=8B=E7=BA=BF]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/market/WxFloatingLayerController.java | 12 ++++++++---- .../com/iformall/service/WxFloatingLayerService.java | 2 ++ .../impl/WxCuserFloatingLayerServiceImpl.java | 8 +++++--- .../service/impl/WxFloatingLayerServiceImpl.java | 8 ++++++++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFloatingLayerController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFloatingLayerController.java index 96162ee9a..dad3572c2 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFloatingLayerController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxFloatingLayerController.java @@ -2,6 +2,7 @@ package com.iformall.controller.market; import com.github.pagehelper.PageInfo; import com.iformall.annotation.SystemControllerLog; +import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; @@ -62,13 +63,16 @@ public class WxFloatingLayerController extends BaseController { } @ApiOperation("根据id更新接口") - @PostMapping("/update") + @PostMapping("/updateStatus") @SystemControllerLog(description = "id更新") - public ResultData update(@RequestBody WxFloatingLayer wxFloatingLayer) { - logger.debug("[" + getIpAddr() + "] WxFloatingLayerController::update"); + public ResultData updateStatus(@RequestBody WxFloatingLayer wxFloatingLayer) { + logger.debug("[" + getIpAddr() + "] WxFloatingLayerController::updateStatus"); + if (wxFloatingLayer.getId() == null) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "id不能为空"); + } try { wxFloatingLayer.setStatus(EnumFloatingLayerStatus.STATUS_TAKE_OFFF.getCode()); - return wxFloatingLayerService.saveOrUpdate(wxFloatingLayer); + return wxFloatingLayerService.updateStatus(wxFloatingLayer); } catch (MallinkException e) { logger.error(e.getMessage()); return new ResultData(e.getErrorCode(), e.getMessage()); diff --git a/mallinkService/src/main/java/com/iformall/service/WxFloatingLayerService.java b/mallinkService/src/main/java/com/iformall/service/WxFloatingLayerService.java index 59232c9fd..dbaa8aaa5 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxFloatingLayerService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxFloatingLayerService.java @@ -36,4 +36,6 @@ public interface WxFloatingLayerService { ResultData saveOrUpdate(WxFloatingLayer record); + ResultData updateStatus(WxFloatingLayer wxFloatingLayer); + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java index dd9ffbf7d..f34658896 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCuserFloatingLayerServiceImpl.java @@ -40,8 +40,9 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ WxCUser user = new WxCUser(); user.setOpenId(openId); WxCUser byOpenId = wxCUserMapper.findByOpenId(user); + String tenantId = byOpenId.getTenantId(); if (byOpenId == null) { - return getWxFloatingLayer(); + return getWxFloatingLayer(tenantId); } //2 用户存在 查看是否已有弹出记录 没有 保存记录后返回浮层信息 WxCuserFloatingLayer wxCuserFloatingLayerQuery = new WxCuserFloatingLayer(); @@ -49,7 +50,7 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ WxCuserFloatingLayer wxCuserFloatingLayer = wxCuserFloatingLayerMapper.selectOne(new QueryWrapper<>(wxCuserFloatingLayerQuery)); if (wxCuserFloatingLayer == null) { saveCuserFloatingLayer(byOpenId); - return getWxFloatingLayer(); + return getWxFloatingLayer(tenantId); } return null; } @@ -65,8 +66,9 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ wxCuserFloatingLayerMapper.insert(wxCuserFloatingLayer); } - public WxFloatingLayer getWxFloatingLayer() { + public WxFloatingLayer getWxFloatingLayer(String tenantId) { WxFloatingLayer wxFloatingLayer = new WxFloatingLayer(); + wxFloatingLayer.setTenantId(tenantId); wxFloatingLayer.setStatus(EnumFloatingLayerStatus.STATUS_THROW_IN.getCode()); return wxFloatingLayerMapper.selectOne(new QueryWrapper<>(wxFloatingLayer)); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFloatingLayerServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFloatingLayerServiceImpl.java index 5ac85241d..bcd1eef51 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFloatingLayerServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFloatingLayerServiceImpl.java @@ -71,4 +71,12 @@ public class WxFloatingLayerServiceImpl implements WxFloatingLayerService { return new ResultData(Result.SUCCESS, "操作成功"); } + @Override + public ResultData updateStatus(WxFloatingLayer wxFloatingLayer) { + wxFloatingLayer.setUpdateTime(new Date()); + wxFloatingLayerMapper.updateById(wxFloatingLayer); + return new ResultData(Result.SUCCESS, "操作成功"); + + } + }