From 98205369380710cb8f69ca4e35dd7b3d7f1f4b63 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Mon, 10 Apr 2023 09:47:22 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E8=AE=BE=E5=A4=87=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=96=B9=E5=BC=8F=E6=94=B9=E4=B8=BA=E9=9B=AA?= =?UTF-8?q?=E8=8A=B1=E7=BC=96=E7=A0=81=20#=20=E6=B6=88=E6=81=AF=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/service/impl/EmInfoServiceImpl.java | 3 ++- .../controller/MessagePushRecordController.java | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java index 5430d51..7551fd2 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.hnac.hzims.equipment.EquipmentContants; @@ -107,7 +108,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl send(@PathVariable @ApiParam("消息记录ID") Long id) { return R.data(messagePushRecordService.send(id)); } + + @GetMapping("/readMessage/{id}") + @ApiOperation("读取消息") + @ApiOperationSupport(order = 6) + public R readMessage(@PathVariable @ApiParam("消息记录ID") Long id) { + MessagePushRecordEntity record = messagePushRecordService.getById(id); + if(!record.getPusher().equals(AuthUtil.getUserId())) { + return R.fail("当前登录人不是消息推送人,修改状态失败"); + } + LambdaUpdateWrapper eq = Wrappers.lambdaUpdate() + .set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM) + .set(MessagePushRecordEntity::getRespondTime, LocalDateTime.now()) + .eq(MessagePushRecordEntity::getId, id); + return R.status(messagePushRecordService.update(eq)); + } }