| @@ -2,6 +2,7 @@ package com.iformall.controller.market; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| @@ -62,13 +63,16 @@ public class WxFloatingLayerController extends BaseController { | |||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("/update") | |||||
| @PostMapping("/updateStatus") | |||||
| @SystemControllerLog(description = "id更新") | @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 { | try { | ||||
| wxFloatingLayer.setStatus(EnumFloatingLayerStatus.STATUS_TAKE_OFFF.getCode()); | wxFloatingLayer.setStatus(EnumFloatingLayerStatus.STATUS_TAKE_OFFF.getCode()); | ||||
| return wxFloatingLayerService.saveOrUpdate(wxFloatingLayer); | |||||
| return wxFloatingLayerService.updateStatus(wxFloatingLayer); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | return new ResultData(e.getErrorCode(), e.getMessage()); | ||||
| @@ -36,4 +36,6 @@ public interface WxFloatingLayerService { | |||||
| ResultData saveOrUpdate(WxFloatingLayer record); | ResultData saveOrUpdate(WxFloatingLayer record); | ||||
| ResultData updateStatus(WxFloatingLayer wxFloatingLayer); | |||||
| } | } | ||||
| @@ -40,8 +40,9 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ | |||||
| WxCUser user = new WxCUser(); | WxCUser user = new WxCUser(); | ||||
| user.setOpenId(openId); | user.setOpenId(openId); | ||||
| WxCUser byOpenId = wxCUserMapper.findByOpenId(user); | WxCUser byOpenId = wxCUserMapper.findByOpenId(user); | ||||
| String tenantId = byOpenId.getTenantId(); | |||||
| if (byOpenId == null) { | if (byOpenId == null) { | ||||
| return getWxFloatingLayer(); | |||||
| return getWxFloatingLayer(tenantId); | |||||
| } | } | ||||
| //2 用户存在 查看是否已有弹出记录 没有 保存记录后返回浮层信息 | //2 用户存在 查看是否已有弹出记录 没有 保存记录后返回浮层信息 | ||||
| WxCuserFloatingLayer wxCuserFloatingLayerQuery = new WxCuserFloatingLayer(); | WxCuserFloatingLayer wxCuserFloatingLayerQuery = new WxCuserFloatingLayer(); | ||||
| @@ -49,7 +50,7 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ | |||||
| WxCuserFloatingLayer wxCuserFloatingLayer = wxCuserFloatingLayerMapper.selectOne(new QueryWrapper<>(wxCuserFloatingLayerQuery)); | WxCuserFloatingLayer wxCuserFloatingLayer = wxCuserFloatingLayerMapper.selectOne(new QueryWrapper<>(wxCuserFloatingLayerQuery)); | ||||
| if (wxCuserFloatingLayer == null) { | if (wxCuserFloatingLayer == null) { | ||||
| saveCuserFloatingLayer(byOpenId); | saveCuserFloatingLayer(byOpenId); | ||||
| return getWxFloatingLayer(); | |||||
| return getWxFloatingLayer(tenantId); | |||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -65,8 +66,9 @@ public class WxCuserFloatingLayerServiceImpl implements WxCuserFloatingLayerServ | |||||
| wxCuserFloatingLayerMapper.insert(wxCuserFloatingLayer); | wxCuserFloatingLayerMapper.insert(wxCuserFloatingLayer); | ||||
| } | } | ||||
| public WxFloatingLayer getWxFloatingLayer() { | |||||
| public WxFloatingLayer getWxFloatingLayer(String tenantId) { | |||||
| WxFloatingLayer wxFloatingLayer = new WxFloatingLayer(); | WxFloatingLayer wxFloatingLayer = new WxFloatingLayer(); | ||||
| wxFloatingLayer.setTenantId(tenantId); | |||||
| wxFloatingLayer.setStatus(EnumFloatingLayerStatus.STATUS_THROW_IN.getCode()); | wxFloatingLayer.setStatus(EnumFloatingLayerStatus.STATUS_THROW_IN.getCode()); | ||||
| return wxFloatingLayerMapper.selectOne(new QueryWrapper<>(wxFloatingLayer)); | return wxFloatingLayerMapper.selectOne(new QueryWrapper<>(wxFloatingLayer)); | ||||
| } | } | ||||
| @@ -71,4 +71,12 @@ public class WxFloatingLayerServiceImpl implements WxFloatingLayerService { | |||||
| return new ResultData(Result.SUCCESS, "操作成功"); | return new ResultData(Result.SUCCESS, "操作成功"); | ||||
| } | } | ||||
| @Override | |||||
| public ResultData updateStatus(WxFloatingLayer wxFloatingLayer) { | |||||
| wxFloatingLayer.setUpdateTime(new Date()); | |||||
| wxFloatingLayerMapper.updateById(wxFloatingLayer); | |||||
| return new ResultData(Result.SUCCESS, "操作成功"); | |||||
| } | |||||
| } | } | ||||